http://stackoverflow.com/q/23679321
has comment: http://stackoverflow.com/comment/36400722
tagged with: jbutton
has title: JButton.setToolTiptext causing UI freeze
tagged with: java
has comment: http://stackoverflow.com/comment/36379707
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/36379594
score: 0
answer count: 0
has body: I am trying to add JButton and setting Tooltip to the button on a JPanel. It basically goes like this public class CustomPanel extends JPanel{ public CustomPanel(){ .. initGraphics(); ... } public void initGraphics(){ JButton button1 = new JButton("button1"); JButton button2 = new Jbutton("button2"); button1.setToolTipText("hello1"); add(button1); add(button2); } When i run the program and mouse over on the button1, UI is getting freezed for 3 seconds or so and no tooltip is being shown. Can somebody tell me what i am missing?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36383684
tagged with: swing

http://stackoverflow.com/q/23701278
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6591388
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I need to use the Jackson parser to handle json that contains non-standard single quotes instead of double quotes. This question has been asked before: Configure Jackson to deserialize single quoted (invalid) JSON but the "JsonParser" class no longer exists in Jackson 2.0+. It looks like the newer way to configure the ObjectMapper is like this: mapper.enable(DeserializationFeature.FEATURE_NAME_HERE); but I can't find an ALLOW_SINGLE_QUOTES feature. Maybe I'm just not seeing it. How do I deserialize single quotes in Jackson 2.x? EDIT OOPS, never mind. JsonParser does exist. In my project it was being shadowed by the Json Smart class with the same name.
type: Question
score: 3
has answer: http://stackoverflow.com/a/23702775
tagged with: jackson
has title: Jackson 2.x single-quote handling
upvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23659283
answer count: 2
upvote count: 7
tagged with: jpa
tagged with: jpa-2.0
favorite count: 0
possible better answer: http://stackoverflow.com/a/43820574
has comment: http://stackoverflow.com/comment/36353342
has body: The JPA specification (2.1) says that: The following types are supported for version properties: int, Integer, short, Short, long,Long, Timestamp What is the expected behavior after a @Version property overflows?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36340947
tagged with: java
has comment: http://stackoverflow.com/comment/36341026
score: 6
has answer: http://stackoverflow.com/a/23659585
accepted answer: http://stackoverflow.com/a/23659585
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/43820574
has title: JPA @Version overflow
has comment: http://stackoverflow.com/comment/36345891

string
tags question: http://stackoverflow.com/q/23653244
tags question: http://stackoverflow.com/q/23751362
tags question: http://stackoverflow.com/q/23650730
tags question: http://stackoverflow.com/q/23625706
tags question: http://stackoverflow.com/q/23695951
tags question: http://stackoverflow.com/q/23691001
tags question: http://stackoverflow.com/q/23756488
tags question: http://stackoverflow.com/q/23737813
tags question: http://stackoverflow.com/q/23678656
tags question: http://stackoverflow.com/q/23741636
tags question: http://stackoverflow.com/q/23692887
tags question: http://stackoverflow.com/q/23622239
tags question: http://stackoverflow.com/q/23715490
tags question: http://stackoverflow.com/q/23701931
tags question: http://stackoverflow.com/q/23633572
tags question: http://stackoverflow.com/q/23733549
tags question: http://stackoverflow.com/q/23772738
tags question: http://stackoverflow.com/q/23738010
tags question: http://stackoverflow.com/q/23626136
tags question: http://stackoverflow.com/q/23729944
tags question: http://stackoverflow.com/q/23671621
tags question: http://stackoverflow.com/q/23673038
tags question: http://stackoverflow.com/q/23664078
tags question: http://stackoverflow.com/q/23693356
tags question: http://stackoverflow.com/q/23687491
tags question: http://stackoverflow.com/q/23624188
tags question: http://stackoverflow.com/q/23729780
tags question: http://stackoverflow.com/q/23666722
tags question: http://stackoverflow.com/q/23720217
tags question: http://stackoverflow.com/q/23717378
tags question: http://stackoverflow.com/q/23758486
tags question: http://stackoverflow.com/q/23728778
tags question: http://stackoverflow.com/q/23726146
tags question: http://stackoverflow.com/q/23739118
tags question: http://stackoverflow.com/q/23735872
tag name: string
tags question: http://stackoverflow.com/q/23745089
tags question: http://stackoverflow.com/q/23664414
tags question: http://stackoverflow.com/q/23655889
tags question: http://stackoverflow.com/q/23632557
tags question: http://stackoverflow.com/q/23702926
tags question: http://stackoverflow.com/q/23722456
tags question: http://stackoverflow.com/q/23684473
tags question: http://stackoverflow.com/q/23700606
tags question: http://stackoverflow.com/q/23636058
tags question: http://stackoverflow.com/q/23762324
tags question: http://stackoverflow.com/q/23670715
tags question: http://stackoverflow.com/q/23751276
tags question: http://stackoverflow.com/q/23716836
type: Tag
tags question: http://stackoverflow.com/q/23641872
tags question: http://stackoverflow.com/q/23748186
tags question: http://stackoverflow.com/q/23637537
tags question: http://stackoverflow.com/q/23659606
tags question: http://stackoverflow.com/q/23642529
tags question: http://stackoverflow.com/q/23649927
tags question: http://stackoverflow.com/q/23763200
tags question: http://stackoverflow.com/q/23736600
tags question: http://stackoverflow.com/q/23727659
tags question: http://stackoverflow.com/q/23677772
tags question: http://stackoverflow.com/q/23686292
tags question: http://stackoverflow.com/q/23747866
tags question: http://stackoverflow.com/q/23777508
tags question: http://stackoverflow.com/q/23736772
tags question: http://stackoverflow.com/q/23690437
tags question: http://stackoverflow.com/q/23685721
tags question: http://stackoverflow.com/q/23653258
tags question: http://stackoverflow.com/q/23730092
tags question: http://stackoverflow.com/q/23646813
tags question: http://stackoverflow.com/q/23718983
tags question: http://stackoverflow.com/q/23769751
tags question: http://stackoverflow.com/q/23776168
tags question: http://stackoverflow.com/q/23716929
tags question: http://stackoverflow.com/q/23689443
tags question: http://stackoverflow.com/q/23724401
tags question: http://stackoverflow.com/q/23742932
tags question: http://stackoverflow.com/q/23671705
tags question: http://stackoverflow.com/q/23727204
tags question: http://stackoverflow.com/q/23619759
tags question: http://stackoverflow.com/q/23618409

eclipse
tags question: http://stackoverflow.com/q/23755657
tags question: http://stackoverflow.com/q/23629116
tags question: http://stackoverflow.com/q/23714643
tag name: eclipse
tags question: http://stackoverflow.com/q/23708546
tags question: http://stackoverflow.com/q/23768388
tags question: http://stackoverflow.com/q/23754863
tags question: http://stackoverflow.com/q/23683953
tags question: http://stackoverflow.com/q/23760786
tags question: http://stackoverflow.com/q/23668854
tags question: http://stackoverflow.com/q/23769870
tags question: http://stackoverflow.com/q/23721291
tags question: http://stackoverflow.com/q/23627720
tags question: http://stackoverflow.com/q/23777229
tags question: http://stackoverflow.com/q/23677976
tags question: http://stackoverflow.com/q/23712118
tags question: http://stackoverflow.com/q/23703008
tags question: http://stackoverflow.com/q/23702670
tags question: http://stackoverflow.com/q/23671024
tags question: http://stackoverflow.com/q/23665219
tags question: http://stackoverflow.com/q/23637277
tags question: http://stackoverflow.com/q/23661625
tags question: http://stackoverflow.com/q/23663062
tags question: http://stackoverflow.com/q/23667895
tags question: http://stackoverflow.com/q/23701361
tags question: http://stackoverflow.com/q/23698204
tags question: http://stackoverflow.com/q/23639403
tags question: http://stackoverflow.com/q/23775950
tags question: http://stackoverflow.com/q/23752595
tags question: http://stackoverflow.com/q/23690862
tags question: http://stackoverflow.com/q/23713163
tags question: http://stackoverflow.com/q/23700397
tags question: http://stackoverflow.com/q/23655416
tags question: http://stackoverflow.com/q/23644520
tags question: http://stackoverflow.com/q/23708691
tags question: http://stackoverflow.com/q/23773254
tags question: http://stackoverflow.com/q/23777914
tags question: http://stackoverflow.com/q/23751481
tags question: http://stackoverflow.com/q/23775949
tags question: http://stackoverflow.com/q/23656002
tags question: http://stackoverflow.com/q/23656135
tags question: http://stackoverflow.com/q/23622259
tags question: http://stackoverflow.com/q/23768838
tags question: http://stackoverflow.com/q/23691593
tags question: http://stackoverflow.com/q/23640003
tags question: http://stackoverflow.com/q/23721680
tags question: http://stackoverflow.com/q/23746672
tags question: http://stackoverflow.com/q/23653045
tags question: http://stackoverflow.com/q/23755887
tags question: http://stackoverflow.com/q/23777467
tags question: http://stackoverflow.com/q/23656314
tags question: http://stackoverflow.com/q/23665105
tags question: http://stackoverflow.com/q/23688674
tags question: http://stackoverflow.com/q/23632493
tags question: http://stackoverflow.com/q/23702476
tags question: http://stackoverflow.com/q/23695075
tags question: http://stackoverflow.com/q/23671002
tags question: http://stackoverflow.com/q/23645674
tags question: http://stackoverflow.com/q/23633992
tags question: http://stackoverflow.com/q/23685501
tags question: http://stackoverflow.com/q/23688555
tags question: http://stackoverflow.com/q/23635915
tags question: http://stackoverflow.com/q/23749844
tags question: http://stackoverflow.com/q/23620580
tags question: http://stackoverflow.com/q/23638689
tags question: http://stackoverflow.com/q/23683708
tags question: http://stackoverflow.com/q/23663466
tags question: http://stackoverflow.com/q/23638122
tags question: http://stackoverflow.com/q/23642618
tags question: http://stackoverflow.com/q/23654054
tags question: http://stackoverflow.com/q/23675452
tags question: http://stackoverflow.com/q/23648373
tags question: http://stackoverflow.com/q/23772905
tags question: http://stackoverflow.com/q/23624038
tags question: http://stackoverflow.com/q/23672293
tags question: http://stackoverflow.com/q/23620055
tags question: http://stackoverflow.com/q/23772716
tags question: http://stackoverflow.com/q/23662306
tags question: http://stackoverflow.com/q/23751353
tags question: http://stackoverflow.com/q/23763345

http://stackoverflow.com/q/23741986
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: postgresql
has body: Scenario: Hibernate 3.6 with xml-based mapping, Java7, Postgresql 8.3. I'm currently refactoring an application where I have got this scenario for the database: main_table id integer other_field string (id) PK secondary_table other_field string value string (other_field, value) PK Basically, there's a secondary table which contains an "other_field" which is matched on the main table; I need to extract all values for a certain record in main_table and map them. In SQL I'd use a query like: SELECT value FROM secondary table INNER JOIN main_table ON secondary_table.other_field == main_table.other_field where main_table.id = 1; But I don't understand how to map a collection of basic types (strings) to the Main object in Java using such a query (or a similar one if the one I propose is not hibernate friendly), so that I can have a "values" property on my mapped object, which should be a Set&lt;String&gt;
type: Question
has answer: http://stackoverflow.com/a/23742450
tagged with: hibernate-mapping
upvote count: 1
has title: Hibernate: mapping collection property with alternate join column
answer count: 1
tagged with: java
tagged with: hibernate
downvote count: 0

http://stackoverflow.com/a/23700911
accepted answer of: http://stackoverflow.com/q/23696956
score: 3
has body: private static pokeGrid world = new pokeGrid(); public static void main(String[] args) { ActorWorld world = new ActorWorld(); ... } The problem here is that the world variable of base type ActorWorld declared in main is shadowing your pokeGrid member variable world. The subsequent method calls on world are thus operating on a default world type, not your customized one. To fix this, remove the ActorWorld world = ... declaration from main. The method calls will then be operating on your customized class.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23696956

http://stackoverflow.com/comment/36511377
comment on: http://stackoverflow.com/q/23747369
score: 0
type: Comment
type: QuestionComment
has text: read log file line by line as you are doing it already and use any code as answered below.

http://stackoverflow.com/comment/36769359
score: 0
type: Comment
has text: Both answers works fine, but with this, the code stais more readable, and it's easier to implement.
comment on: http://stackoverflow.com/a/23716315
type: AnswerComment

http://stackoverflow.com/q/23709949
favorite count: 0
linked to: http://stackoverflow.com/q/23710025
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36437271
has comment: http://stackoverflow.com/comment/36437326
score: 2
has body: A thread opens a resource, which is a blocking operation. If and once it succeeded, the thread is required to close it again, which again is blocking but always succeeds in finite time. It is possible to use a flag (let's call it hasResource), which cannot be synchronized with other threads in any way, to indicate that the thread does not want to be interrupted. No other synchronization is allowed at all. Is the following a safe way to handle this scenario? @Override // we're subclassing Thread public void run () { try { while (!interrupted ()) { blockingOpen (); // glitch possibility in this line hasResource = true; blockingClose (); hasResource = false; } } catch (final InterruptedException e) { interrupt (); } } In particular, does this ensure that the thread will no be interrupted while it has the resource? As far as I can tell, there is only one window of error opportunity, which is right after the Open and before setting the flag. However, it seems this would not lead to leaking the resource, but to accidentally ignoring the interrupt request. Is it possible to prevent that?
tagged with: interrupted-exception
downvote count: 0
tagged with: java
tagged with: multithreading
has title: Is this a thread safe way to handle blocking close?
type: Question
has answer: http://stackoverflow.com/a/45684458
upvote count: 2
has answer: http://stackoverflow.com/a/45684234
answer count: 2
has comment: http://stackoverflow.com/comment/36437332
has comment: http://stackoverflow.com/comment/36437536
has comment: http://stackoverflow.com/comment/36437354

http://stackoverflow.com/a/23724289
upvote count: 1
has comment: http://stackoverflow.com/comment/36464968
answers question: http://stackoverflow.com/q/23724099
has body: Map is an interface. Therefore every instance of a Map has a concrete class different to Map.class, and the getClass() method doesn't return Map.class. But for the Class that is actually returned, there is no method that matches the signature. Also you may want to change Class.forName(param[i].getClass().getName()) to param[i].getClass()
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/23740436
tagged with: class-diagram
linked to: http://stackoverflow.com/q/23295339
type: AnsweredQuestion
tagged with: java
tagged with: uml
type: Question
has body: How does a Register cleaner tool works if you would analyze the code ? I'm not asking for specific code here...I'm just wondering the code for a tool like Ccleaner for instance is working, roughly explained. The reason why I ask this is because I want to create an class diagram about the Ccleaner tool. But ofcourse for Ccleaner specificly you would need the source code..and we all know no normal has acces to the source code of ccleaner But if anyone know's any registery and pc cleaner tool is getting to it to clean up the mess on your computer and how it's cleaning up your registery...it would help me big time to create an class diagram. Thanx
tagged with: .net
score: 0
upvote count: 1
has title: Understanding the code process of Ccleaner
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23743023
accepted answer: http://stackoverflow.com/a/23743023
has comment: http://stackoverflow.com/comment/36515832
favorite count: 0

http://stackoverflow.com/a/23686450
type: AcceptedAnswer
downvote count: 0
score: 1
has body: eclipse detects project type and it adds directory structure in .classpath and .project when you import new project, if you want to see raw structure, switch to navigator view windows &gt; show view &gt; navigator
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23686307
accepted answer of: http://stackoverflow.com/q/23686307

http://stackoverflow.com/q/23701872
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23701926
score: 1
upvote count: 1
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
has title: What exactly is the uri parameter for in the Intent constructor?
type: Question
has body: I've tried searching the web and looking through Google's documentation, but I've struggled to find anything that explains what it's used for or any example that shows it passed into the constructor.
tagged with: uri
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23701926

http://stackoverflow.com/comment/36533572
has text: I think the first error is very very very clear.. The second is very clear.
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/23760537

http://stackoverflow.com/q/23668631
has comment: http://stackoverflow.com/comment/36359387
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36359315
has comment: http://stackoverflow.com/comment/36439792
has comment: http://stackoverflow.com/comment/36359089
score: 1
tagged with: java
tagged with: jpanel
has title: Java: Why validate don't work
linked to: http://stackoverflow.com/q/5446396
type: Question
linked to: http://stackoverflow.com/q/6955334
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36362852
has answer: http://stackoverflow.com/a/23669241
has comment: http://stackoverflow.com/comment/36364028
tagged with: validation
has comment: http://stackoverflow.com/comment/36362795
favorite count: 0
has comment: http://stackoverflow.com/comment/36428636
upvote count: 1
has comment: http://stackoverflow.com/comment/36363146
has body: I want to change the panel dynamically and as this answer show, they recommend to use the cardLayout. But I want to change the whole UI(no old button left) and cardLayout seems not so convenient. So I have the following code: JFrame frame = new JFrame ("Key test"); MyDrawPanel1 dp1 = new MyDrawPanel1(frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible (true); JPanel p = new JPanel (); p.setLayout(new BorderLayout()); p.add(dp1,BorderLayout.CENTER); frame.getContentPane().add(p); frame.pack(); frame.setVisible (true); And in the MyDrawPanel1 there is a button to change panel: public MyDrawPanel1(final JFrame frame) { clickButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub frame.getContentPane().removeAll(); //frame.validate(); frame.getContentPane().add(new MyDrawPanel2()); ((JPanel)frame.getContentPane()).revalidate(); } }); this.add(clickButton); } Edit:some more codes in MyDrawPanel1. JButton clickButton = new JButton("click"); Image image = new ImageIcon("D:/0.jpg").getImage(); public void paintComponent (Graphics g) { super.paintComponent(g); g.drawImage(image, 3, 40, null); } public Dimension getPreferredSize() { if (image != null) { return new Dimension(image.getWidth(null), image.getHeight(null)); } return super.getPreferredSize(); // default } But the first panel doesn't disappear and I have to minimize it to refresh it so I can see the second panel. My question is the why validate don't work and if there is any other alternatives. Thanks. Edit:here are the pictures I snipped about the panel.(first panel): (after clicked): Edit: The madProgrammer and Adarsh Singhal provide two ways to solve the problem. The first is the second the panel don't call the super.paintComponent(), so add it then it works fine (as this answer say, it is the eraser so the first panel was gone). The second is calling the frame.repaint(), but I don't understand why?
has comment: http://stackoverflow.com/comment/36365455
accepted answer: http://stackoverflow.com/a/23669241

http://stackoverflow.com/comment/36278402
comment on: http://stackoverflow.com/a/23626850
has text: Check this answer to see a more detailed version of why it is bad (even if it is c#-ish): http://stackoverflow.com/questions/251391/why-is-lockthis-bad
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36452153
comment on: http://stackoverflow.com/q/23717749
has text: Could you be more specific about your problem? What are expected outputs? What are you getting instead?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23633878
score: 1
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/42351888
has comment: http://stackoverflow.com/comment/42332818
has answer: http://stackoverflow.com/a/26974929
tagged with: java
type: Question
tagged with: websphere
has body: I've had a web service, designed with WSDL-first with some methods defined withing. A WSDL file is stored in src\main\resources\wsdl\myservice.wsdl. The java source is generated with mvn jaxws:wsimport. Today I've added a simple method to the WebService and I've regenerated the sources. The RAD shows no error for the wsdl. However, it do shows not the error "WSDL file not found" on the servlet classes: @javax.jws.WebService(wsdlLocation = "wsdl/myservice.wsdl", endpointInterface = "com.example.MyService", targetNamespace = "http://example.com/myservice", serviceName = "myservice", portName = "myserviceSOAP11") @javax.xml.ws.BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING) public class MyServiceImpl implements MyService Nothing has changed in that class, except a new method was defined. I can't deploy the service now to the WebSphere, because of those validation errors. Where do those errors come from? Can it be an error in WSDL? If so, how can I check which, when IBM RAD 9.0 gives me absolute no error messages about the WSDL itself? --edit-- I was able to move all changes to the project copy loaded in older version of RAD (8.0) and managed to start and test the webservice. It look like RAD 9.0 doesn't accept some otherwise legal construction in WSDL. However, without giving any specific message. Is it possible to find out what line/construction exactly is causing problems for that IDE?
upvote count: 1
answer count: 1
tagged with: wsdl
favorite count: 0
has title: @javax.jws.WebService wsdlLocation ("WSLD file not found" - IBM RAD 9.0)
tagged with: ibm-rad
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23757247
has comment: http://stackoverflow.com/comment/36528154
score: 20
upvote count: 21
type: AcceptedAnswer
downvote count: 1
has body: Replace in Path (Ctrl+Shift+R by default) action with text to find OLD-ARTIFACT-ID and text to replace NEW-ARTIFACT-ID will do most of the work automatically with the minimum amount of false positives, especially if you additionally configure the proper file name filter (pom.xml, obviously). In detail, here is the complete sequence of steps to rename the maven-based module (assuming that the name of the module matches the name of the directory where the module is located): Comment out the relevant OLD-ARTIFACT-ID lines in parent/aggregator poms, then allow IDEA to re-import the project and allow it to remove excluded modules from the project. It is better to remove leftover .iml files too. Perform search&replace from OLD-ARTIFACT-ID to NEW-ARTIFACT-ID to rename the module in question and to fix all dependency references to it. Perform search&replace from OLD-ARTIFACT-ID to NEW-ARTIFACT-ID to fix all aggregation references to it. Rename the module directory. Uncomment the relevant NEW-ARTIFACT-ID lines in parent/aggregator POM files, then allow IDEA to re-import the project. If you feel like IDEA misses some useful functionality you should create a feature request at http://youtrack.jetbrains.com/. In this particular case, vote for IDEA-94223, IDEA-72181 and IDEA-104344.
has comment: http://stackoverflow.com/comment/36561148
accepted answer of: http://stackoverflow.com/q/23757048
has comment: http://stackoverflow.com/comment/40933686
answers question: http://stackoverflow.com/q/23757048
type: Answer
has comment: http://stackoverflow.com/comment/36547477
has comment: http://stackoverflow.com/comment/36566488
has comment: http://stackoverflow.com/comment/36547421

http://stackoverflow.com/comment/36534637
has text: Does `javax/management/NotificationEmitter.class` appear in two different sealed jars or could there be two versions of it loaded in different class loaders?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23760981
score: 0

http://stackoverflow.com/comment/36357205
has text: Its not freezing it's waiting for the connection; java sockets are asynchronous so it is waiting for the connection I would redo the way your starting your using thread... http://stackoverflow.com/questions/16489026/what-is-the-main-advantage-of-extending-thread-class-or-when-to-extend-thread-i How you might want to do it is: Thread tr = new Thread(new Runabble(){ void run(){ while( your socket is connected){ TCPClient.this.yourMehtod(); } } });
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23665706

http://stackoverflow.com/q/23719546
has comment: http://stackoverflow.com/comment/36456255
has body: I have simple example which illustrates how to cause deadlock: class Player { private String name; public Player(String name) { super(); this.name = name; } public synchronized void passTo(Player p) { System.out.println(this.name + " passes to " + p.name); // to imitate long task for (int i = 0; i &lt; 1000000000; i++) ; p.passBack(this); } private synchronized void passBack(Player p) { System.out.println(this.name + " passes back to " + p.name); } } public class Deadlock { public static void main(String[] args) { final Player ivan = new Player("Ivan"); final Player petro = new Player("Petro"); new Thread(new Runnable() { public void run() { ivan.passTo(petro); } }).start(); new Thread(new Runnable() { public void run() { petro.passTo(ivan); } }).start(); } } When I run this program it causes deadlock. What are possible solutions to prevent this simple deadlock? Thank you!
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36455813
tagged with: concurrency
tagged with: deadlock
has title: How to prevent this simple deadlock in java?
linked to: http://stackoverflow.com/q/21739080
answer count: 2
score: 3
has comment: http://stackoverflow.com/comment/36455882
downvote count: 0
duplicate of: http://stackoverflow.com/q/21739080
favorite count: 0
has answer: http://stackoverflow.com/a/23719584
has comment: http://stackoverflow.com/comment/36455789
accepted answer: http://stackoverflow.com/a/23719584
possible better answer: http://stackoverflow.com/a/23719743
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23719743
upvote count: 3

http://stackoverflow.com/a/23644078
has comment: http://stackoverflow.com/comment/36358033
has comment: http://stackoverflow.com/comment/36315473
has comment: http://stackoverflow.com/comment/36343607
has comment: http://stackoverflow.com/comment/36431944
has comment: http://stackoverflow.com/comment/36357593
has comment: http://stackoverflow.com/comment/36357242
type: Answer
has comment: http://stackoverflow.com/comment/36401959
has comment: http://stackoverflow.com/comment/36343735
has comment: http://stackoverflow.com/comment/36389850
has comment: http://stackoverflow.com/comment/36358394
has body: I agree @Alécio, please use a callback to do this. Add a callback interface in the non-activity class: class yourclass{ public interface callBack{ public void updateTotal(...); } private callBack callback; public void registerCallback(callBack callback){ this.callback = callback; } //somewhere call the updateTotal(...) callback.updateTotal(...); } In the Activity //the activity implement the callback and then register it, and call the callback when neccesary class yourActivity extends Activity implement callBack{ @Override onCreate(...){ ... yourclass.registerCallback(this); } @Override public void updateTotal(...){ ....... } } The sample code for multiple class comunicating. public class Controller { callBack callBack; public void registerCallBack(callBack back){ this.callBack = back; } public void show(){ callBack.update(1, "my name"); } public interface callBack{ public void update(int type, String message); } public callBack getCallBack(){ return callBack; } } public class AnotherClass { Controller controller = new Controller(); public void registerCallBack(callBack back){ controller.registerCallBack(back); } public void show(){ controller.getCallBack().update(1, "show me!"); } } public class MyActivity extends Activity implements callBack { AnotherClass myclass = new AnotherClass(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("TAG", "This is message!"); setContentView(R.layout.main); myclass.registerCallBack(this); } @Override protected void onResume() { super.onResume(); myclass.show(); } @Override public void update(int type, String message) { ((TextView) findViewById(R.id.display)).setText(message); } }
score: 0
has comment: http://stackoverflow.com/comment/36422089
answers question: http://stackoverflow.com/q/23643604
has comment: http://stackoverflow.com/comment/36357783
has comment: http://stackoverflow.com/comment/36358337
has comment: http://stackoverflow.com/comment/36311542
has comment: http://stackoverflow.com/comment/36361005

http://stackoverflow.com/comment/36509890
comment on: http://stackoverflow.com/a/23742420
type: Comment
has text: I can't explain if I do not know :/ I have 3/4 of a year experience with Java.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36290006
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your response. I went thru Eclipse Marketplace -> Installed tab and uninstalled 'GlassFish tools for Kepler' and installed it again after searching in FIND box. Now, when I'm trying the run the JSP file RUN AS -> RUN ON SERVER, not sure why GLASSFISH server is not showing up in 'select the server type' list
comment on: http://stackoverflow.com/a/23632856

http://stackoverflow.com/comment/36450451
has text: That's openjdk. You should not consider it as equivalent to Oracle Java as some aspects differ significantly. I once had to install standard Java on Ubuntu because it wouldn't run some software.
type: QuestionComment
comment on: http://stackoverflow.com/q/23716836
type: Comment
score: 0

http://stackoverflow.com/comment/36285466
score: 0
has text: Do you have android:configChanges in your activity xml file preventing the UI to recreate after rotation? If thaths not the reason please post your onCreate() code above
type: AnswerComment
comment on: http://stackoverflow.com/a/23630578
type: Comment

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23698417
tags question: http://stackoverflow.com/q/23654673
tags question: http://stackoverflow.com/q/23634292
tags question: http://stackoverflow.com/q/23626589
tags question: http://stackoverflow.com/q/23718835
tags question: http://stackoverflow.com/q/23635142
tags question: http://stackoverflow.com/q/23726474
tags question: http://stackoverflow.com/q/23692701
tags question: http://stackoverflow.com/q/23720639
tags question: http://stackoverflow.com/q/23665260
tags question: http://stackoverflow.com/q/23650843
tag name: jfreechart

http://stackoverflow.com/comment/36566031
comment on: http://stackoverflow.com/a/23777391
has text: @Anatoly what worries me more is how other people posted that worked fine =\
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23665385
type: Answer
downvote count: 0
has body: Apart from the exception, I don't think your merge logic is correct. Look at your codes: while(helperLeft &lt;= curr &amp;&amp; curr &lt;=helperRight) { if(helperLeft &lt;= curr) { arr[helperLeft] = helperLeft; helperLeft++; } else { arr[curr] = curr; curr++; } helperRight++; } here, helperLeft, helperRight and curr are all array indexes. You are setting the array element with indexes, like a[23]=23. it is not correct. In MergeSort's merge, we should compare elements from left and right and do merge, not indexes. I suggest that write a unittest for your mergesort, to make sure it works for all cases (including corner cases) then invoke your method in your real codes. Also would it be fine if your MergeSort.sort() is a static? I implemented a merge() too, you can check here : https://github.com/sk1418/jalgorithm/blob/master/src/main/java/com/kent/algorithm/sorting/MergeSort.java#L130 hope it helps.
score: 1
has comment: http://stackoverflow.com/comment/36353950
upvote count: 1
has comment: http://stackoverflow.com/comment/36353705
answers question: http://stackoverflow.com/q/23665119
has comment: http://stackoverflow.com/comment/36355528

http://stackoverflow.com/q/23752450
downvote count: 0
has title: Android Media Player playing multiple songs together
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/49825082
tagged with: audio
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23752908
score: 1
possible better answer: http://stackoverflow.com/a/49825082
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36518532
has body: I am writing a Church Application, in which i am providing Music Player functionality, and almost done with my requirement, but facing small issue. How i have implemented my Music Player: Listing Audio songs available in SD Card (path like: Environment.getExternalStorageDirectory() + "/Church Application/Prayers") Once user do tap on any of the Audio then launching Media Player In Media Player screen i am providing navigation to user to go back to Audio List User came back and now selected some other song to listen (here i am facing problem, user will be able to play new selected song, but old song also playing, whereas only last selected song would be play at a time, but in my case both the songs are playing) PlayListActivity.java:- // selecting single ListView item ListView lv = getListView(); // listening to single listitem click lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting listitem index int songIndex = position; // Starting new intent Intent in = new Intent(getApplicationContext(), MediaPlayerActivity.class); // Sending songIndex to PlayerActivity in.putExtra("songIndex", songIndex); setResult(100, in); startActivity(in); // Closing PlayListView finish(); } }); MediaPlayerActivity.java:- int value ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player); mp = new MediaPlayer(); songManager = new SongsManager(); utils = new Utilities(); songProgressBar.setOnSeekBarChangeListener(this); // Important mp.setOnCompletionListener(this); // Important songsList = songManager.getPlayList(); Bundle extras = getIntent().getExtras(); if (extras != null) { value = extras.getInt("songIndex"); } playSong(value); btnPlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // check for already playing if (mp.isPlaying()) { if (mp != null) { mp.pause()…
answer count: 2
has answer: http://stackoverflow.com/a/23752908

http://stackoverflow.com/comment/36593315
type: Comment
type: QuestionComment
has text: It is still always a good idea to tag the question with the language in question. It helps frame the question for answers (which you want to be in the right language!) and sets up the correct syntax highlighting.
score: 0
comment on: http://stackoverflow.com/q/23774941

http://stackoverflow.com/comment/36424975
has text: First, I don't see any listener to your `textField`. Second, which value/result are you talking about ?
type: Comment
comment on: http://stackoverflow.com/q/23703492
score: 0
type: QuestionComment

http://stackoverflow.com/q/23697709
has title: JAXB - XML to Java Unmarshal - Not Working
has body: I'm fairly new to JAXB, but I've been banging my head against this simple XML to Java conversion for quite a while now, and my guess is I'm missing something pretty elementary here. XML File (To Unmarshal): Linkin Park Linkin Park US Lincoln Park Linkin Park US Metadata.java @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name="metadata", namespace = "http://musicbrainz.org/ns/mmd-2.0#") public class Metadata { @XmlAttribute(name = "created") private String created; public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } @XmlElementWrapper(name="artist-list") @XmlElement(name = "artist") private List artists = new ArrayList (); public List getArtists() { return artists; } public void setArtists(List artists) { this.artists = artists; } } Artist.java @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "artist") public class Artist { @XmlAttribute(name = "id") private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } } When I try reading the XML by creating an object of Metadata, I'm able to retrieve the attribute 'created'. However, the artist list does not get populated. Kindly let me know if I'm missing something here. Note: I'm not facing an 'unexpected element' error here. The code executes without any issues; however, the object for 'artists' is not getting populated, whereas the 'created' attributed seems to be receiving the corresponding XML value.
upvote count: 1
duplicate of: http://stackoverflow.com/q/22212660
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22212660
downvote count: 0
score: 1
tagged with: java
tagged with: jaxb
type: Question

sql
tags question: http://stackoverflow.com/q/23672933
tags question: http://stackoverflow.com/q/23628672
tags question: http://stackoverflow.com/q/23676623
tags question: http://stackoverflow.com/q/23715723
tags question: http://stackoverflow.com/q/23633644
tags question: http://stackoverflow.com/q/23771539
tags question: http://stackoverflow.com/q/23729000
tags question: http://stackoverflow.com/q/23617560
tags question: http://stackoverflow.com/q/23633949
tags question: http://stackoverflow.com/q/23700376
tags question: http://stackoverflow.com/q/23659940
tags question: http://stackoverflow.com/q/23777581
tags question: http://stackoverflow.com/q/23741247
tags question: http://stackoverflow.com/q/23737579
tags question: http://stackoverflow.com/q/23698151
tags question: http://stackoverflow.com/q/23766841
tags question: http://stackoverflow.com/q/23664806
tags question: http://stackoverflow.com/q/23662285
tags question: http://stackoverflow.com/q/23674861
tags question: http://stackoverflow.com/q/23629760
tags question: http://stackoverflow.com/q/23766462
tags question: http://stackoverflow.com/q/23618232
tags question: http://stackoverflow.com/q/23728359
tags question: http://stackoverflow.com/q/23722802
tags question: http://stackoverflow.com/q/23672092
tags question: http://stackoverflow.com/q/23701420
tags question: http://stackoverflow.com/q/23744453
tag name: sql
tags question: http://stackoverflow.com/q/23625885
tags question: http://stackoverflow.com/q/23711419
tags question: http://stackoverflow.com/q/23723620
tags question: http://stackoverflow.com/q/23727520
type: Tag
tags question: http://stackoverflow.com/q/23775175
tags question: http://stackoverflow.com/q/23674365
tags question: http://stackoverflow.com/q/23777715
tags question: http://stackoverflow.com/q/23760687
tags question: http://stackoverflow.com/q/23684709
tags question: http://stackoverflow.com/q/23766423
tags question: http://stackoverflow.com/q/23718385
tags question: http://stackoverflow.com/q/23627476
tags question: http://stackoverflow.com/q/23757967
tags question: http://stackoverflow.com/q/23665537
tags question: http://stackoverflow.com/q/23671049
tags question: http://stackoverflow.com/q/23762643
tags question: http://stackoverflow.com/q/23670754
tags question: http://stackoverflow.com/q/23750834
tags question: http://stackoverflow.com/q/23651649
tags question: http://stackoverflow.com/q/23651336
tags question: http://stackoverflow.com/q/23720220
tags question: http://stackoverflow.com/q/23733036
tags question: http://stackoverflow.com/q/23716183
tags question: http://stackoverflow.com/q/23684790
tags question: http://stackoverflow.com/q/23686000
tags question: http://stackoverflow.com/q/23674691
tags question: http://stackoverflow.com/q/23624873
tags question: http://stackoverflow.com/q/23733758
tags question: http://stackoverflow.com/q/23775497
tags question: http://stackoverflow.com/q/23730204
tags question: http://stackoverflow.com/q/23705381
tags question: http://stackoverflow.com/q/23620485
tags question: http://stackoverflow.com/q/23771066
tags question: http://stackoverflow.com/q/23736109
tags question: http://stackoverflow.com/q/23728750
tags question: http://stackoverflow.com/q/23633523
tags question: http://stackoverflow.com/q/23770708
tags question: http://stackoverflow.com/q/23680629
tags question: http://stackoverflow.com/q/23673941
tags question: http://stackoverflow.com/q/23742389
tags question: http://stackoverflow.com/q/23690281
tags question: http://stackoverflow.com/q/23651482
tags question: http://stackoverflow.com/q/23622183
tags question: http://stackoverflow.com/q/23649187
tags question: http://stackoverflow.com/q/23723404
tags question: http://stackoverflow.com/q/23776277

http://stackoverflow.com/q/23674574
tagged with: spring
has answer: http://stackoverflow.com/a/23884536
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/23726916
has body: We have a couple of feature files, that share common steps. Login for example is the simplest step that comes to mind, if I want to get the user object that the login step created and was set in the LoginStepDefinitions.java file. Is it in my context, is there someway to access this class' variables, can I Autowire another step definition or something?
tagged with: java
has title: How to access common variables created through Gherkin step definitions in Java without redundancy?
score: 0
tagged with: cucumber
answer count: 2
tagged with: gherkin
accepted answer: http://stackoverflow.com/a/23884536
has answer: http://stackoverflow.com/a/23726916
tagged with: cucumber-jvm

http://stackoverflow.com/comment/36411147
has text: You may want to rephrase your title and contents slightly to remove the "best practice" vibe and focus more on "how do I couple these two classes together whilst obeying MVC". Otherwise the opinion-based closing squad will descend upon you and you'll get no answers :-(
score: 2
comment on: http://stackoverflow.com/q/23696308
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23766596
type: UnansweredQuestion
tagged with: sockets
score: -3
has body: I have the following script that connects without problems from JavaScript ( as client) to a function in Node.js server by socket.io that has the following code . But I have no idea what to call this same function (conremot.sockets.on("connection",recibeSMS);) from a java client. client JavaScript &lt;head&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt; &lt; / script &gt; &lt;script src="http://ec2-54-205-191-244.compute-1.amazonaws.com:6969/socket.io/socket.io.js"&gt; &lt; / script &gt; &lt;script&gt; var websocket = io . connect ( " http://ec2-54-205-191-244.compute-1.amazonaws.com:6969 "); $ (document ) on ( "ready" , start ) . ; } SendMsj function ( e) { e.preventDefault ( ) ; websocket.emit ( " nuevoMensaje ", " Hello SMS" ); websocket.on ( 'connect ', function () { } ) ; } &lt; / script &gt; &lt; / head&gt; Node.js server conremot var = require (" socket.io " ) listen ( 6969 ) ; conremot.sockets.on ( " connection" , recibeSMS ); / / Receiving variables : recibeSMS function (user) { usuario.on ( " nuevoMensaje " emitirSMS ) ; } / / Sending variables : emitirSMS function (sms ) { conremot.sockets.emit ( " SMS_DesdeServidor " sms) ; } Thank you in advance for your support .
tagged with: node.js
has title: How to call a function from java socket to Node.js
upvote count: 0
has answer: http://stackoverflow.com/a/23786372
downvote count: 3
tagged with: socket.io
type: Question
tagged with: java
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36352052
has text: I was about to replicate Mike Clark's answer when I saw it appear. Does it work? What does java -version output?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23660416

http://stackoverflow.com/comment/36498961
has text: Added the controller in, thanks!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23742089

http://stackoverflow.com/a/23713505
score: 0
answers question: http://stackoverflow.com/q/23713320
has body: you need to post the Runnable to be executed again and again in the main thread and not sleep it. something similar to this: GradientDrawable gd; Handler uiHandler; private View view; private void start(){ // create the drawable gd = new GradientDrawable(Orientation.TL_BR, green); gd.setGradientType(GradientDrawable.RADIAL_GRADIENT); gd.setGradientCenter(0.5f, 1.25f); gd.setCornerRadius(0f); // put it on the view view = findViewById(R.id.ms_layout); view.setBackgroundDrawable(gd); // get a handler for the main thread looper and run uiHandler = new Handler(Looper.getMainLooper()); uiHandler.post(myRun); } private Runnable myRun = new Runnable(){ int x = 0; @SuppressWarnings("deprecation") @Override public void run(){ for(int x = 0; x &lt; 400; x++){ // do the change gd.setGradientRadius((float) 400 - x); // ask system to re-draw it gd.invalidateSelf(); // update n re-post loop x++; if(x &lt; 400) uiHandler.post(myRun); } } }; ps.1: that's all done without testing, you'll have to adjust details yourself. ps.2: you can also use postDelayed like this uiHandler.postDelayed(myRun, 20); edit: in case you want to do something more modular, you could create your own Drawable that extends from GradientDrawable and use the setLevel(int) to start animation. I do it all the time, something like this: public class MyCustomDrawable extends GradientDrawable{ // put the same constructors GradientDrawable uses. private int x; protected boolean onLevelChange (int level){ x = 0; invalidateSelf(); // this will make the thing call draw } public void draw (Canvas canvas){ // adjust what to draw setGradientRadius((float) 400 - x); // let the GradientDrawable do its normal drawing thing super.draw(canvas); // and then check if it needs another update x++; if(x &lt; getLevel()) invalidateSelf(); } } put this in the background of your view and call gd.setLevel(400); everytime you want to do the animation. the beauty of this method is that you can adjust it freely for example, based on time if…
type: Answer

http://stackoverflow.com/comment/36522001
score: 0
type: Comment
has text: Im trying to read each of the file but I always failed top merge it
comment on: http://stackoverflow.com/a/23754112
type: AnswerComment

http://stackoverflow.com/q/23736328
tagged with: testing
tagged with: java
has comment: http://stackoverflow.com/comment/36487779
linked to: http://stackoverflow.com/q/4038547
score: 0
linked to: http://stackoverflow.com/q/10221891
tagged with: junit
has comment: http://stackoverflow.com/comment/36489226
has comment: http://stackoverflow.com/comment/36487901
has body: Currently i am writing integration test for a several ecommerce shops via a Junit. What I want to do is execute all test cases despite any failures occurring during, then report all failures at the end. Are there any frameworks, testCaseRunners e.t.c i can leverage to achieve this or will I have to manually achieve this via code i.e swapping junit assertions for simple equality checks whilst logging failures in a collection of some sort. Hope my question is understood but I can extend my question further if clarification is needed.
answer count: 0
type: UnansweredQuestion
has title: Run ALL junit integration tests before reporting failures
type: Question

http://stackoverflow.com/comment/132782380
has text: sorry no, I stopped the multiplayer module for a while ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23754448
type: QuestionComment

http://stackoverflow.com/comment/36526912
score: 0
type: Comment
type: QuestionComment
has text: I tried, but my maven installation path is in "C" directory , my workspace directory is in "E" directory. How can I run mvn site command from "C" directory which will refer the POM.xml which is located in "E:/TestProject/POM.xml"? please help me
comment on: http://stackoverflow.com/q/23756276

http://stackoverflow.com/a/23664354
answers question: http://stackoverflow.com/q/23662872
score: 0
has comment: http://stackoverflow.com/comment/36355660
has comment: http://stackoverflow.com/comment/36359786
type: Answer
has body: You can use a Shader for that: Shader alphaShader = new LinearGradient(0, 0, 0, textHeight, new int[] {Color.parseColor("#ff000000"), Color.parseColor("#00000000")}, new float[] {0, 1}, TileMode.CLAMP); textView.getPaint().setShader(alphaShader);

http://stackoverflow.com/a/23688562
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23688521
has body: public static void main (String [] args) { System.out.println(countToTen(1)); } public static int countToTen(int last_answer) { last_answer++; if(last_answer != 10) { return countToTen(last_answer); //Here was the error } return last_answer; }

http://stackoverflow.com/comment/36557984
score: 0
comment on: http://stackoverflow.com/a/23751650
type: Comment
has text: cool! it works. great. how does :: work? how is it different from :+ append and +: prepend.
type: AnswerComment

http://stackoverflow.com/comment/36306585
score: 0
has text: Try using the default constructor for CommonsClientHttpRequestFactory, which ought to configure a multithreaded connection manager already. See http://docs.spring.io/spring/docs/3.0.x/api/org/springframework/http/client/CommonsClientHttpRequestFactory.html
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23634389

http://stackoverflow.com/q/23648646
type: Question
has comment: http://stackoverflow.com/comment/36324083
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23648996
tagged with: jtable
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36322718
has answer: http://stackoverflow.com/a/23648996
favorite count: 0
has body: I'm stuck from 2 days in my project i cant implement how to make the ENTER KEY act like TAB KEY i tried key listener but the ENTER KEY have a default feature for JTable so it's not working it's keep moving down. I google it discovered that i need to use key binding but i'm unable to implement it. Can anyone give me a full coded example of this on a JTable ??? Please need you help. Thanks in advance
has answer: http://stackoverflow.com/a/23648781
possible better answer: http://stackoverflow.com/a/23648793
has answer: http://stackoverflow.com/a/23648793
tagged with: enter
has comment: http://stackoverflow.com/comment/36323111
type: AnsweredQuestion
tagged with: tabs
downvote count: 0
tagged with: swing
has title: Use Enter Key Act Like Tab Key on jTable

http://stackoverflow.com/comment/36365962
score: 2
has text: You can't directly convert the columns, but can't you alter the table to include a new column of spatial type and calculate it from the values within Lat and Lng???
type: Comment
comment on: http://stackoverflow.com/q/23672092
type: QuestionComment

http://stackoverflow.com/a/23707711
has comment: http://stackoverflow.com/comment/36433149
upvote count: 1
answers question: http://stackoverflow.com/q/23697817
score: 1
downvote count: 0
has body: These are the corresponding types: 1) Int in scala and integer/serial in postgresql are 32 bits and both go up to 2,147,483,647. Postgresql serial is only an auto-incrementing integer. 2) Long in scala and bigint/bigserial in postgresql are 64 bits and both go up to 9,223,372,036,854,775,807. Postgresql bigserial is only an auto-incrementing bigint. If you want to use the same types, you can use bigserial/Long or serial/Int. However, for our projects, we ended up using Long in Scala and serial in postgresql and this works fine. This gives us the freedom to simply change the data type in postgresql from serial to bigserial if required in future. As a side note, we could not see any real advantage for Pk[..] so decided to use Option[Long] instead of Pk[Long] and None instead of NotAssigned. Then you use the generic Option types and will never need to import anorm into your controllers.
type: Answer

http://stackoverflow.com/comment/36332689
type: AnswerComment
comment on: http://stackoverflow.com/a/23654932
type: Comment
has text: could you please let me know how to re run maven with -X switch
score: 0

http://stackoverflow.com/a/23640806
has comment: http://stackoverflow.com/comment/36323517
has body: VALID FOR JPA2.0 As Bhesh commented a simple JPQL won't make it. The resulting SQL has to contain a where clause similar to following: where keywords like '%keyword1%' or keywords like '%keyword2%' or ... or keywords like '%keywordN%' This means: We need a loop here! You could try to build a JPQL by yourself like Bhesh suggested in his first comment, though as he also stated it is not a brilliant idea. But don't worry - JPA provides also a Criteria API which comes handy in such situations. So, although you're not going to have a named query, you can still make it with JPA this way: public List&lt;YourEntity&gt; findAllByKeywords(List&lt;String&gt; keywords){ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;YourEntity&gt; query = builder.createQuery(YourEntity.class); Root&lt;YourEntity&gt; root = query.from(YourEntity.class); List&lt;Predicate&gt; predicates = new LinkedList&lt;&gt;(); for (String keyword : keywords) { predicates.add(builder.like(root.&lt;String&gt;get("keywords"), "%" + keyword + "%")); } return entityManager.createQuery( query.select(root).where( builder.or( predicates.toArray(new Predicate[predicates.size()]) ) )) .getResultList(); } or (always slightly better with Guava) public List&lt;YourEntity&gt; findAllByKeywords(List&lt;String&gt; keywords){ final CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;YourEntity&gt; query = builder.createQuery(YourEntity.class); final Root&lt;YourEntity&gt; root = query.from(YourEntity.class); return entityManager.createQuery( query.select(root).where( builder.or( transform(keywords, toPredicateFunction(builder, root)).toArray(new Predicate[]{}) ) )) .getResultList(); } private Function&lt;String, Predicate&gt; toPredicateFunction(final CriteriaBuilder builder, final Root&lt;YourEntity&gt; root) { return new Function&lt;String, Predicate&gt;() { @Override public Predicate apply(String input) { return builder.like(root.&lt;String&gt;get("keywords"), "%" …
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23633523
answers question: http://stackoverflow.com/q/23633523
downvote count: 0
has comment: http://stackoverflow.com/comment/36315023
has comment: http://stackoverflow.com/comment/36321632

http://stackoverflow.com/q/23765514
type: Question
tagged with: java
has title: Java File I/O not working with external library methods
has body: I am trying to create an application that utilizes a textfield that allows a user to save a file or load the existing text of the file specified in the program. Without the Jasypt library calls, the program works fine. However, my ultimate goal is to save the text entered as encrypted text in the txt file, and when the file is read into the textfield, it is decrypted. My save portion of the program works fine. However, my load event does not work properly. My program looks like this: import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import org.jasypt.util.password.StrongPasswordEncryptor; import org.jasypt.util.text.*; public class CheesyWP extends JFrame implements ActionListener { StrongTextEncryptor textEncryptor = new StrongTextEncryptor(); /** * @param args */ Panel center; Panel south; JMenuItem save; JMenuItem load; JMenuItem clip; JMenuItem finish; TextArea ta; public static void main(String[] args) { // TODO Auto-generated method stub CheesyWP cwp = new CheesyWP(); cwp.doIt(); } public void doIt() { setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(1000, 400); center = new Panel(); south = new Panel(); clip = new JMenuItem("Open Clipboard"); save = new JMenuItem("Save"); load = new JMenuItem("Load"); finish = new JMenuItem("Finish"); JMenuBar j = new JMenuBar(); JMenu option = new JMenu("Options"); j.add(option); option.add(clip); option.add(save); option.add(load); option.add(finish); setJMenuBar(j); clip.addActionListener(this); save.addActionListener(this); load.addActionListener(this); finish.addActionListener(this); ta = new TextArea(20, 80); center.add(ta); /*south.add(load); south.add(save); south.add(clip); south.add(finish);*/ this.add(center, BorderLayout.CENTER); this.add(south, BorderLayout.SOUTH); this.setSize(600, 300); this.setVisible(true); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == save) { try { File junk = new File("junk.txt"); FileWriter fw = new FileWriter(junk); String text = t…
answer count: 1
has answer: http://stackoverflow.com/a/23766471
score: 0
tagged with: file-io
tagged with: jasypt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23766471
tagged with: encryption

http://stackoverflow.com/comment/36261633
comment on: http://stackoverflow.com/a/23617896
has text: @Kon A simple solution for beginners is probably better for now.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23689511
has answer: http://stackoverflow.com/a/23689937
has body: I created a login page after the user enters the username and password correctly he is directed to another page (home page) @ManagedBean public class Superviseur { private String login; have get and set private String password;// have get and set public void checkLogin() { try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/supervision"; Connection con = DriverManager.getConnection(url,"root", ""); Statement stm = (Statement) con.createStatement(); String rq = "select * from superviseur "; ResultSet res=stm.executeQuery(rq); while (res.next()) { Superviseur sup=new Superviseur(); sup.setPassword(res.getString("password")); sup.setLogin(res.getString("login")); if(sup.getLogin().equals(login)&amp;&amp;sup.getPassword().equals(password)) { System.out.println( "WELCOM"); } else { System.out.println("ERROR login/password "); } } catch (Exception e) { System.out.println("ERROR :" + e.getMessage()); } } } the xhtml page contains two input and the commande button &lt;p:commandButton value="login" action="#{superviseurBean.checkLogin()}" /&gt; it displays to me in the console welcome if right (pass/login) else ERROR but i have to go to another page if the password and login are right
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23689937
has title: primefaces : submit after succes action
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java
tagged with: mysql
tagged with: authentication
type: Question

http://stackoverflow.com/a/23771814
answers question: http://stackoverflow.com/q/23770579
score: 0
type: Answer
has body: Facebook uses OAuth 2.0, which is a current standard for open authorization. This is a short description from wikipedia: OAuth provides client applications a 'secure delegated access' to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials. Designed specifically to work with Hypertext Transfer Protocol (HTTP), OAuth essentially allows access tokens to be issued to third-party clients by an authorization server, with the approval of the resource owner, or end-user. The client then uses the access token to access the protected resources hosted by the resource server.[1] OAuth is commonly used as a way for web surfers to log into third party web sites using their Google, Facebook or Twitter passwords, without worrying about their access credentials being compromised. You can read the RFC specification for more details: https://www.rfc-editor.org/rfc/rfc6749 You can also read information about the different integrations: http://oauth.net/2/ You cannot create a fake token. The user receives a token after typing his username and passwords, which means stealing his token is equivalent to stealing his credentials, as the token is randomly generated. I will explain the flow shortly: I'm an user, using in general facebook and your application. I log in facebook and reach your application in facebook or via external link and click on it. Then facebook will ask me if I want to share my personal information with your application (this is because I am logged in. If I were not, then it would ask me for my username and password). If I agree, facebook will send an access token to your application and with it you will access of my personal information. Thus this access will be highly restricted and you won't be able to do anything harmful and as well it will expire after a couple of time, depending on the implementation, but should be around one hour.

http://stackoverflow.com/a/23766165
has body: You need use the other static method, it don't receive a default value: JOptionPane.showInputDialog("") Check JOptionPane API here.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23765527

http://stackoverflow.com/comment/36425698
has text: @yshavit thanks! I wish I could deduce the steps to a problem off the top of my head like that :(
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23702969
type: AnswerComment

http://stackoverflow.com/comment/36392842
score: 0
has text: @durron597 Thanks for the suggestion. I tried that but it still runs and passes the test. I take it this behavior shouldn't be happening then?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23685035

http://stackoverflow.com/comment/36546669
score: 0
comment on: http://stackoverflow.com/q/23767056
type: QuestionComment
type: Comment
has text: @TimS. I am simply curious about mechanism of using generics (from compiler POV), because unlike C++ (yes, this is my background) generic classes are precompiled and then used.

itext
tags question: http://stackoverflow.com/q/23691970
tags question: http://stackoverflow.com/q/23759223
tags question: http://stackoverflow.com/q/23688308
tags question: http://stackoverflow.com/q/23731387
tags question: http://stackoverflow.com/q/23730886
tags question: http://stackoverflow.com/q/23624285
tag name: itext
tags question: http://stackoverflow.com/q/23693706
type: Tag
tags question: http://stackoverflow.com/q/23715280
tags question: http://stackoverflow.com/q/23657748

http://stackoverflow.com/q/23615744
has title: How to download a XML dynamic-generated file in JSF?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23617029
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36257991
accepted answer: http://stackoverflow.com/a/23617029
has body: In the JSF page I have: &lt;p:commandButton value="Download" action="#{myMBean.downloadXMLFile}" /&gt; In the MBean I have the following (try/catch ommited): public void downloadXMLFile() { String xml = this.getXML();//returns the whole XML but in String format. HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.setContentType("text/xml"); response.setHeader("Content-Disposition", "attachment;filename=file.xml"); ServletOutputStream out = response.getOutputStream(); out.write(xml.getBytes()); out.flush(); } But when I run it, I get an IllegalStateException: java.lang.IllegalStateException: setBufferSize() called after first write to Output Stream/Writer I tried also to convert the XML String to a Document and converting it to a File but got the same error. is it really necessary in order to work?
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: download
tagged with: jsf
score: 1
upvote count: 1

http://stackoverflow.com/comment/36355145
type: Comment
comment on: http://stackoverflow.com/q/23651572
score: 0
type: QuestionComment
has text: Local filepath is useless on the server. It would only be of use to hackers. That's why browsers don't send it as security measure.

http://stackoverflow.com/q/23731334
has comment: http://stackoverflow.com/comment/63635065
has body: I have a JTextPane which displays colored text . I use the followong piece of code to get text from JTextPane. String temp = pane.getDocument().getText(0,pane.getDocument().getLength()); However when i try to set the temp variable content to pane again, pane.select(0,pane.getDocument().getLength()); pane.replaceSelection(temp); by this way i lose the color and get white text. Is there anyway where i can maintain the color of text without copying the content to clipboard. Please help.
tagged with: htmleditorkit
has answer: http://stackoverflow.com/a/23731463
tagged with: jtextpane
upvote count: 1
tagged with: swing
answer count: 1
tagged with: java
downvote count: 0
type: UnansweredQuestion
favorite count: 0
tagged with: colors
type: Question
score: 1
has title: Jtextpane copy coloured text and paste

http://stackoverflow.com/q/23697832
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36414519
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/36414630
upvote count: 1
has comment: http://stackoverflow.com/comment/36414959
has comment: http://stackoverflow.com/comment/36415413
has body: So i've been wondering how to change the openGL version in lwjgl.. I know i can change the version with PixelFormat and ContextAttribs as being said on the wiki http://lwjgl.org/wiki/index.php?title=Version_selection But that only can take me down to 3.2 minimum what if i want to take it even lower? like maybe 2.1 or even 1.1? Is there any way to do this?
has answer: http://stackoverflow.com/a/23721984
type: Question
has comment: http://stackoverflow.com/comment/36414737
has comment: http://stackoverflow.com/comment/36420392
has comment: http://stackoverflow.com/comment/36456425
has comment: http://stackoverflow.com/comment/36414939
answer count: 1
downvote count: 0
favorite count: 0
has title: Changing OpenGL Version In LWJGL

tcp
tags question: http://stackoverflow.com/q/23770063
type: Tag
tags question: http://stackoverflow.com/q/23716830
tags question: http://stackoverflow.com/q/23737523
tags question: http://stackoverflow.com/q/23671267
tags question: http://stackoverflow.com/q/23702360
tags question: http://stackoverflow.com/q/23769143
tags question: http://stackoverflow.com/q/23730280
tags question: http://stackoverflow.com/q/23735602
tags question: http://stackoverflow.com/q/23718921
tags question: http://stackoverflow.com/q/23627154
tags question: http://stackoverflow.com/q/23696170
tags question: http://stackoverflow.com/q/23724112
tags question: http://stackoverflow.com/q/23688094
tags question: http://stackoverflow.com/q/23628514
tags question: http://stackoverflow.com/q/23749939
tags question: http://stackoverflow.com/q/23764826
tags question: http://stackoverflow.com/q/23653679
tags question: http://stackoverflow.com/q/23768176
tags question: http://stackoverflow.com/q/23665706
tags question: http://stackoverflow.com/q/23668476
tag name: tcp
tags question: http://stackoverflow.com/q/23632027
tags question: http://stackoverflow.com/q/23718466

http://stackoverflow.com/a/23677071
score: 0
type: Answer
has body: your TextFieldPanel should contain a Model or object to write its output to: public TextFieldPanel(final String id, final IModel&lt;FormElement&gt; model, IModel&lt;String&gt; content) { ... final TextField&lt;String&gt; textfield = new TextField&lt;String&gt;("textfield", content); ... } Now you can add a Model to the TextField to write the contents to.
answers question: http://stackoverflow.com/q/23676435
has comment: http://stackoverflow.com/comment/36374858
has comment: http://stackoverflow.com/comment/36377402
has comment: http://stackoverflow.com/comment/36378465

http://stackoverflow.com/q/23678766
has title: Neo4j core: Load RelationShips with order
tagged with: neo4j
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/36458972
tagged with: spring-data-neo4j
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23687291
has body: I am trying to develop and application that require millions of relationships. But when trying to get the last relations using cypher query or core java (parse all relations) based on creation time (timestamp) it takes a lot of time. Generally, users will access data starting from the last ones to the first ones and may need only to the last 50 one. So I How can I change the behavior of Neo4j when loading data in order to start from the last ones (even for data in cache) so I will not need to reorder them. Regards.
tagged with: java
has comment: http://stackoverflow.com/comment/36394421
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23685806

http://stackoverflow.com/comment/36436634
type: Comment
type: QuestionComment
has text: See also http://stackoverflow.com/questions/3692426/hashset-does-not-seem-to-realize-that-two-objects-are-the-same
score: 1
comment on: http://stackoverflow.com/q/23707983

http://stackoverflow.com/a/23738613
score: 0
answers question: http://stackoverflow.com/q/23738151
type: Answer
has body: You could use something like this: long minute = 1000*60; Date date1 = new Date(); //current date Date date2 = new Date(date1.getTime() - minute); //new date, 1 minute older //or another method long minute = 1000*60; Date date1 = new Date(); date1.setTime(date1.getTime() - minute); Date works with milliseconds since January 1, 1970, 00:00:00 GMT, so you can substract it like normal numbers.

http://stackoverflow.com/comment/36570445
score: 0
type: Comment
has text: Have you followed the instructions in the blog posts correctly?
comment on: http://stackoverflow.com/a/23778976
type: AnswerComment

http://stackoverflow.com/comment/36467677
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23725709
has text: Hey Atul, it is yeah :)
score: 0

http://stackoverflow.com/comment/36449778
score: 2
has text: _In the beginning i want the images to be hidden then after the game start they appear randomly_. Care to elaborate? How do you intend to start the game? And also, you use the same image for all `ImageViews`...
comment on: http://stackoverflow.com/q/23716473
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36373571
score: 0
type: Comment
has text: (Hint: look at `result.substring(result.length()-1).charAt(result.length()-1);` carefully. How long is `result.substring(result.length()-1)` going to be? Then think about what argument you'll be providing to `charAt`.)
type: QuestionComment
comment on: http://stackoverflow.com/q/23676358

http://stackoverflow.com/q/23771902
score: 3
has comment: http://stackoverflow.com/comment/36556207
has comment: http://stackoverflow.com/comment/36556246
has comment: http://stackoverflow.com/comment/36556686
tagged with: java
has comment: http://stackoverflow.com/comment/36556576
tagged with: eclipse
has body: I learn from http://developer.android.com/reference/android/widget/Button.html that "instead of applying an OnClickListener to the button in your activity, you can assign a method to your button in the XML layout, using the android:onClick attribute." However, I can only get it done with the XML approach, my Listener approach, specified by the following, leads to app crash. In my fragment_main.xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.myapp.MainActivity$PlaceholderFragment" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;Button android:id="@+id/try_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text = "TryButton" android:onClick="onClick" /&gt; &lt;/RelativeLayout&gt; In my activity_main.xml: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.myapp.MainActivity" tools:ignore="MergeRootFrame"&gt; &lt;/FrameLayout&gt; And in my MainActivity.java: public class MainActivity extends Activity implements OnClickListener{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } Button button = (Button)findViewById(R.id.try_button); butto…
tagged with: button
has comment: http://stackoverflow.com/comment/36556311
has title: How to implement OnClickListener on Android
has answer: http://stackoverflow.com/a/30682950
favorite count: 0
has answer: http://stackoverflow.com/a/32275443
answer count: 5
tagged with: android
downvote count: 1
possible better answer: http://stackoverflow.com/a/23772116
upvote count: 4
has comment: http://stackoverflow.com/comment/36556787
has answer: http://stackoverflow.com/a/23772116
has answer: http://stackoverflow.com/a/23772371
accepted answer: http://stackoverflow.com/a/23772371
tagged with: onclicklistener
has comment: http://stackoverflow.com/comment/36556257
has answer: http://stackoverflow.com/a/38618580
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/23783116
has body: EntityManager.createQuery() expects an JPQL query (not an SQL query). Try the following: em.createQuery("SELECT b.carID FROM Cars b INNER JOIN b.currentEmployee e WHERE e.id = :currentEmployeeID", Integer.class);
score: 0
has comment: http://stackoverflow.com/comment/36577383
answers question: http://stackoverflow.com/q/23771719
type: Answer

http://stackoverflow.com/comment/36524997
type: Comment
type: QuestionComment
has text: **A number is a number**. In every locale, the number is the very same. OR do you want it's **String representation** (which is NOT a number)?
comment on: http://stackoverflow.com/q/23755759
score: 0

http://stackoverflow.com/a/23643411
has body: Make an ArrayList&lt;Question&gt; and fill it up that way. Although you'll only have the interface available, that the Question class exposes.
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/23643384
score: 6

http://stackoverflow.com/q/23685602
has comment: http://stackoverflow.com/comment/36393582
linked to: http://stackoverflow.com/q/496928
has answer: http://stackoverflow.com/a/23687997
possible better answer: http://stackoverflow.com/a/23685749
has comment: http://stackoverflow.com/comment/36394309
has answer: http://stackoverflow.com/a/23685749
downvote count: 1
type: AnsweredQuestion
upvote count: 5
has comment: http://stackoverflow.com/comment/36391509
tagged with: java
accepted answer: http://stackoverflow.com/a/23687997
score: 4
has comment: http://stackoverflow.com/comment/36393700
has title: How do I create a method to check that an implementation satisfies an interface?
has comment: http://stackoverflow.com/comment/36393635
type: Question
answer count: 2
has body: I have an interface (p) and an implementation (imp). If I do the following in the code, then the check works: if (!(imp instanceof p)) { logger.error(imp.getClass().getName()+ " doesn't satisfy the interface " +p.getClass().getName()); } I tried to make it into a callable method as follows: private boolean checkInterfaceImplementation(Object implemen, Object inter){ return (implemen instanceof inter); } which failed. Then I found that inter needs to be a specific type and I cannot use a generic object. Then I found out about "B.class.isAssignableFrom(A.getClass())" Then I did: System.out.println("B.class.isAssignableFrom(A .getClass())"); The output was true I read up more from this question. My question is "Is this (the second implementation with ".isAssignableFrom") the preferred or standard way to implement said method? Is there any way that this present implementation can create problems?
has comment: http://stackoverflow.com/comment/36393396
has comment: http://stackoverflow.com/comment/36391618
favorite count: 0
tagged with: instanceof
tagged with: interface
has comment: http://stackoverflow.com/comment/36392130

http://stackoverflow.com/a/23617198
has comment: http://stackoverflow.com/comment/36350222
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/36259811
downvote count: 0
has body: You can use lengthChange attribute which allows user to select the size of a formatted page from a select menu (sizes are 10, 25, 50 and 100) this property will only work when paginate="true" if you don't want to show dropdown and would like change it to 15 then you override below property global.feature.displayLength=15 default value of above property is 10 thatswhy you are its showing 10 result. please use below code and give a try &lt;datatables:table id="mydata" data="${mydataset}" cdn="true" row="mr" theme="bootstrap2" cssClass="table table-striped" paginate="true" info="false" cssStyle="width: 150px;" align="left" dom="frtp" lengthChange="true"&gt; &lt;datatables:column title="Concept Type" cssStyle="width: 150px;" display="html"&gt; &lt;c:out value="${mr.something}"/&gt; &lt;/datatables:column&gt; &lt;datatables:prop name="feature.displayLength" value="15" /&gt; &lt;/datatables:table&gt; How to Override ?? you can add a file called datatables.properties at the root of the classpath, allowing you to redefine every property you need. Your custom global configuration will then be merged with the default one. Or you can locally override properties using the &lt;datatables:prop&gt; JSP tag. Just define the property's name and value.
has comment: http://stackoverflow.com/comment/63161969
answers question: http://stackoverflow.com/q/23616433
score: 5
accepted answer of: http://stackoverflow.com/q/23616433
type: AcceptedAnswer

http://stackoverflow.com/a/23718251
answers question: http://stackoverflow.com/q/23718190
type: Answer
has comment: http://stackoverflow.com/comment/36453274
has body: I would doubt of any tutorial that suggests using runOnUiThread() from an AsyncTasks's doInBackground() or any tutorial that uses runOnUIThread() in AsyncTasks' onPostExecute()(it already runs on the UI Thread). The Exception that you are getting (or will get for sure if is not this one) is a NetworkOnMainThread. If you want to update the UI after doInBackground() completes, you should do it in onPostExecute().
score: 0
has comment: http://stackoverflow.com/comment/36453314

http://stackoverflow.com/a/32304677
has body: Simple Approach String jsonData = "{\"results\":[{\"lat\":\"value\",\"lon\":\"value\" }]}"; System.out.println(jsonData); try { JSONArray result = new JSONObject(jsonData).getJSONArray("results"); result.getJSONObject(0).put("city","Singapore"); jsonData = "{\"results\":"+result.toString()+"}"; System.out.println(jsonData); } catch (JSONException e) { e.printStackTrace(); } OutPut Before Appending {"results":[{"lat":"value","lon":"value" }]} OutPut After Appending {"results":[{"lon":"value","lat":"value","city":"Singapore"}]}
score: 4
answers question: http://stackoverflow.com/q/23724221
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/36314130
comment on: http://stackoverflow.com/q/23645428
type: Comment
type: QuestionComment
score: 0
has text: Well, that is exactly what I want to do. I created a folder on Desktop and created 2 files. One is hidden and another one is visible. The problem is that I have no clue how test it and to do it right. I couldn't find any examples with these kind of tests and I'm some kind newbie with jUnit..

http://stackoverflow.com/comment/36422356
score: 0
type: Comment
type: QuestionComment
has text: Maybe I could create a `Thread` and each time I add an element to a set which is a member of `TreeBag<>`, I notify the thread?
comment on: http://stackoverflow.com/q/23701985

http://stackoverflow.com/comment/36530864
type: QuestionComment
has text: Hi @Vlad , Am using a thread pool executor only and sorry I forgot to add that code. Added it now.Each worker thread starts its own transaction and I have a flag which tells which row to access but I am not sure about the master thread concept.
comment on: http://stackoverflow.com/q/23755149
score: 0
type: Comment

http://stackoverflow.com/a/23688302
downvote count: 0
has body: You never could do that. Even with anonymous classes that would not work. You need some object wrapper that will allow you to hold the state, sth like class NumberOfInvocations { private int i = 0; public void increment(){ i +=1; } } but you would have to make sure that everything is thread safe, etc, or you could just use AtomicInteger as suggested by Adam.
answers question: http://stackoverflow.com/q/23684083
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/23739407
has comment: http://stackoverflow.com/comment/36493440
has comment: http://stackoverflow.com/comment/36493582
has body: Both FileNotFoundException and ArithmeticException are in the same level in java object hierarchy. Compiler confused to choose most specific method, Since both method are eligible for invocation. Even Compiler can't choose most specific method, if there are multiple object hierarchies. So removing either of FileNotFoundException or ArithmeticException won't solve the problem. From JLS 15.12.2.5 If more than one member method is both accessible and applicable to a method invocation, it is necessary to choose one to provide the descriptor for the run-time method dispatch. The Java programming language uses the rule that the most specific method is chosen. The informal intuition is that one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.
upvote count: 6
has comment: http://stackoverflow.com/comment/36493690
has comment: http://stackoverflow.com/comment/36493633
has comment: http://stackoverflow.com/comment/36493767
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36493848
answers question: http://stackoverflow.com/q/23739334
type: Answer
has comment: http://stackoverflow.com/comment/36493557
accepted answer of: http://stackoverflow.com/q/23739334
downvote count: 0
score: 6

http://stackoverflow.com/q/23638458
has body: I have looked at other do while issues on StackOverflow, but I could not find the solution to my issue. I have variables initialized outside the do{ and they are being use within, but when the variables reach a certain value, the while method does not jump out. Here is what I have: int aiShotHit = 0; int shotHit = 0; do{ showBoard(board); bAi.showAi(ai); shoot(shoot,ships); bAi.aiHit(aiShoot); attempts++; if(hit(shoot,ships)){ hint(shoot,ships,aiShips,attempts); shotHit++; System.out.println("\nShips Left on the Board: " + shotHit); } else hint(shoot,ships,aiShips,attempts); changeboard(shoot,ships,board); if(bAi.aiHit(aiShoot,aiShips)){ hint(shoot,ships,aiShips,attempts); aiShotHit++; } else System.out.print(""); bAi.changeAi(aiShoot,aiShips,ai); }while(shotHit !=3 || aiShotHit !=3); if (shotHit == 3){ System.out.println("\n\n\nBattleship Java game finished! You Beat the Computer"); } System.out.print("You lost! The Ai beat you");
answer count: 1
tagged with: boolean-logic
favorite count: 0
linked to: http://stackoverflow.com/q/2168603
type: UnansweredQuestion
tagged with: demorgans-law
has comment: http://stackoverflow.com/comment/36300128
has comment: http://stackoverflow.com/comment/36299822
has comment: http://stackoverflow.com/comment/36300000
tagged with: java
downvote count: 2
has title: java Do While confusion
has comment: http://stackoverflow.com/comment/36299772
upvote count: 1
has comment: http://stackoverflow.com/comment/36299774
type: Question
has comment: http://stackoverflow.com/comment/36300330
tagged with: do-while
has comment: http://stackoverflow.com/comment/36299960
has comment: http://stackoverflow.com/comment/36300047
score: -1
has comment: http://stackoverflow.com/comment/36299981
has answer: http://stackoverflow.com/a/23638619
has comment: http://stackoverflow.com/comment/36299805

http://stackoverflow.com/q/23747268
tagged with: java
tagged with: file
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23747467
has body: MyProject.war | --- META-INF/ | --- WEB-INF/ |--- classes/ (My compiles project classes) | |--- com | |--- package | |--- MyActionClass.class | |--- configuration | |--- config.xml |--- lib/ |--- MyProject.jar |--- com |--- package |--- MyServiceClass.class I need to read the config.xml from inside MyServiceClass.class. Tried several combinations like: MyServiceClass.class.getResourceAsStream("/configuration/config.xml"); MyServiceClass.class.getResourceAsStream("config.xml"); MyServiceClass.class.getResourceAsStream("classpath*:/configuration/config.xml"); Nothing worked. Any suggestions will be helpful.
tagged with: accessibility
possible better answer: http://stackoverflow.com/a/23747364
has answer: http://stackoverflow.com/a/23747364
score: -1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: How to read an xml file from a parent war file?
accepted answer: http://stackoverflow.com/a/23747467
tagged with: web-applications
type: AnsweredQuestion

http://stackoverflow.com/comment/36569403
type: AnswerComment
has text: Thanks Syam is there another we have to do same type of sorting ?
type: Comment
comment on: http://stackoverflow.com/a/23778244
score: 0

http://stackoverflow.com/comment/36486525
has text: And how did you arrive at the output `2014-06-01T00:00:00.000Z`?
type: Comment
comment on: http://stackoverflow.com/a/23735378
score: 0
type: AnswerComment

http://stackoverflow.com/a/23616293
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23616211
answers question: http://stackoverflow.com/q/23616211
score: 12
type: Answer
has body: You need mutable classes to deal with situations when transforming a class from state A to state Z would produce a lot of intermediate objects, which you would rather not spend time creating. One classic example is concatenating an array of strings. Let's say that you need to concatenate 100 strings, and produce a single result. Without a mutable string, you would need to produce 98 intermediate objects that would become eligible for garbage collection almost immediately. This is rather wasteful on the CPU, making a mutable object the right solution. There are other situations when mutable objects are desirable. For example passing mutable objects into methods lets you collect multiple results without jumping through too many syntactic hoops. Another example is sorting and filtering: of course, you could make a method that takes the original collection, and returns a sorted one, but that would become extremely wasteful for larger collections.
upvote count: 12

http://stackoverflow.com/a/23771175
has comment: http://stackoverflow.com/comment/36554892
upvote count: 2
answers question: http://stackoverflow.com/q/23771022
has body: Both runtimes make a decision about how many threads to use in order to complete the parallel operation. That is a non-trivial task that can take many factors into account, including the degree to which the task is CPU bound, the estimated time to complete the task, etc. Each runtime is different decisions about how many threads to use to resolve the request. Neither decision is obviously right or wrong in terms of system-wide scheduling, but the Java strategy performs the benchmark better (and leaves fewer CPU resources available for other tasks on the system).
downvote count: 0
has comment: http://stackoverflow.com/comment/36611587
has comment: http://stackoverflow.com/comment/36611538
type: Answer
score: 2

java
tags question: http://stackoverflow.com/q/23644431
tags question: http://stackoverflow.com/q/23772929
tags question: http://stackoverflow.com/q/23700849
tags question: http://stackoverflow.com/q/23700475
tags question: http://stackoverflow.com/q/23700739
tags question: http://stackoverflow.com/q/23748233
tags question: http://stackoverflow.com/q/23652334
tags question: http://stackoverflow.com/q/23647127
tags question: http://stackoverflow.com/q/23700297
tags question: http://stackoverflow.com/q/23763345
tags question: http://stackoverflow.com/q/23695726
tags question: http://stackoverflow.com/q/23756987
tags question: http://stackoverflow.com/q/23736053
tags question: http://stackoverflow.com/q/23710025
tags question: http://stackoverflow.com/q/23697433
tags question: http://stackoverflow.com/q/23655606
tags question: http://stackoverflow.com/q/23645878
tags question: http://stackoverflow.com/q/23667503
tags question: http://stackoverflow.com/q/23628495
tags question: http://stackoverflow.com/q/23622274
tags question: http://stackoverflow.com/q/23768759
tags question: http://stackoverflow.com/q/23729250
tags question: http://stackoverflow.com/q/23655348
tags question: http://stackoverflow.com/q/23710086
tags question: http://stackoverflow.com/q/23769212
tags question: http://stackoverflow.com/q/23639112
tags question: http://stackoverflow.com/q/23679391
tags question: http://stackoverflow.com/q/23722901
tags question: http://stackoverflow.com/q/23721636
tags question: http://stackoverflow.com/q/23697782
tags question: http://stackoverflow.com/q/23679455
tags question: http://stackoverflow.com/q/23756832
tags question: http://stackoverflow.com/q/23717382
tags question: http://stackoverflow.com/q/23633458
tags question: http://stackoverflow.com/q/23722260
tags question: http://stackoverflow.com/q/23775596
tags question: http://stackoverflow.com/q/23625693
tags question: http://stackoverflow.com/q/23703184
tags question: http://stackoverflow.com/q/23746876
tags question: http://stackoverflow.com/q/23615996
tags question: http://stackoverflow.com/q/23750840
tags question: http://stackoverflow.com/q/23721908
tags question: http://stackoverflow.com/q/23761505
tags question: http://stackoverflow.com/q/23649839
tags question: http://stackoverflow.com/q/23677328
tags question: http://stackoverflow.com/q/23668302
tags question: http://stackoverflow.com/q/23765286
tags question: http://stackoverflow.com/q/23731737
tags question: http://stackoverflow.com/q/23625933
tags question: http://stackoverflow.com/q/23658254
tags question: http://stackoverflow.com/q/23764088
tags question: http://stackoverflow.com/q/23707833
tags question: http://stackoverflow.com/q/23666738
tags question: http://stackoverflow.com/q/23626686
tags question: http://stackoverflow.com/q/23658651
tags question: http://stackoverflow.com/q/23700951
tags question: http://stackoverflow.com/q/23640809
tags question: http://stackoverflow.com/q/23651527
tags question: http://stackoverflow.com/q/23711409
tags question: http://stackoverflow.com/q/23625085
tags question: http://stackoverflow.com/q/23767997
tags question: http://stackoverflow.com/q/23732227
tags question: http://stackoverflow.com/q/23744201
tags question: http://stackoverflow.com/q/23743914
tags question: http://stackoverflow.com/q/23645746
tags question: http://stackoverflow.com/q/23686203
tags question: http://stackoverflow.com/q/23687897
tags question: http://stackoverflow.com/q/23765257
tags question: http://stackoverflow.com/q/23653378
tags question: http://stackoverflow.com/q/23703656
tags question: http://stackoverflow.com/q/23689297
tags question: http://stackoverflow.com/q/23754048
tags question: http://stackoverflow.com/q/23658550
tags question: http://stackoverflow.com/q/23684220
tags question: http://stackoverflow.com/q/23724112
tags question: http://stackoverflow.com/q/23641079
tags question: http://stackoverflow.com/q/23751232
tags question: http://stackoverflow.com/q/23750612
tags question: http://stackoverflow.com/q/23632950
tags question: http://stackoverflow.com/q/23686923

http://stackoverflow.com/q/23746851
accepted answer: http://stackoverflow.com/a/23747139
has title: Lock and Condition vs Synchronization
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/4201713
tagged with: synchronization
favorite count: 0
tagged with: multithreading
duplicate of: http://stackoverflow.com/q/4201713
has comment: http://stackoverflow.com/comment/36507642
has body: To put it short,my question is,what are the advantages of using Lock and Condition in java in place of synchronized keyword,Lock seems to be more error prone to me.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23747139
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36508096
upvote count: 1
type: Question
tagged with: locking
has comment: http://stackoverflow.com/comment/36508051

http://stackoverflow.com/q/23754871
tagged with: jenkins
has comment: http://stackoverflow.com/comment/36524693
tagged with: java
score: 0
linked to: http://stackoverflow.com/q/23915270
tagged with: maven
type: Question
has body: I know it's recurent question but I couldn't find a solution to my issue. In JENKINS, I run a SONAR analysis after the build. When Soanar gets to Java bytecode scan... it displays : WARN - Class '.../.../.../...' is not accessible through the ClassLoader. The scan is on a Maven project, and Sonar keeps displayin this message throw many other classes that uses Maven dependancies. The Sonar analysis is using the SONAR-RUNNER. I saw in many posts, that the issue could be fixed by adding sonar.librairies=/path/to/libraries/*jar in the sonar-project.properties but with Maven , dependancies are not grouped under one folder. Jar's are dispatched under different folders under the maven-repositories. So how can I fix this issue to scan my code without these warnings ? FYI : Jenkins 1.555 Sonar 4.2 Sonar Runner 2.3 Java 1.7 Maven 3.04 Stack Trace : 09:23:55.605 INFO - Java bytecode scan... 09:23:55.646 WARN - Class 'org/springframework/context/ApplicationContext' is not accessible through the ClassLoader. 09:23:55.656 WARN - Class 'com/mongodb/MongoClient' is not accessible through the ClassLoader. 09:23:55.657 WARN - Class 'com/mongodb/DB' is not accessible through the ClassLoader. 09:23:55.661 WARN - Class 'org/springframework/context/ApplicationContext' is not accessible through the ClassLoader. 09:23:55.662 WARN - Class 'org/springframework/context/ApplicationContext' is not accessible through the ClassLoader. ... 09:23:55.749 WARN - Class 'org/apache/log4j/Logger' is not accessible through the ClassLoader. 09:23:55.773 INFO - Java bytecode scan done: 168 ms Edit : Running mvn dependency:tree in jenkins build : [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) [INFO] +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile [INFO] | +- org.springframework:spring-aop:jar:4.0.3.RELEASE:compile [INFO] | | \- aopalliance:aopalliance:jar:1.0:compile [INFO] | +- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile [INFO] | +- org.springframework:spring-core:…
has comment: http://stackoverflow.com/comment/36563340
accepted answer: http://stackoverflow.com/a/23867587
has title: Class 'XXX/XXX/XXX ' is not accessible through the ClassLoader warning in Sonar analysis with Jenkins build and maven project
tagged with: sonarqube
tagged with: sonar-runner
has comment: http://stackoverflow.com/comment/36534121
has comment: http://stackoverflow.com/comment/36523328
has comment: http://stackoverflow.com/comment/86015363
has comment: http://stackoverflow.com/comment/36524459
answer count: 1
has comment: http://stackoverflow.com/comment/36532654
has comment: http://stackoverflow.com/comment/36733646
has comment: http://stackoverflow.com/comment/36610440
has comment: http://stackoverflow.com/comment/36525484
has comment: http://stackoverflow.com/comment/36576565
has comment: http://stackoverflow.com/comment/36523996
has comment: http://stackoverflow.com/comment/36568594
has comment: http://stackoverflow.com/comment/36524226
has comment: http://stackoverflow.com/comment/36523646
has answer: http://stackoverflow.com/a/23867587
has comment: http://stackoverflow.com/comment/36524053
has comment: http://stackoverflow.com/comment/36532613
type: AnsweredQuestion

http://stackoverflow.com/a/37193004
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23676286
has body: For the record I had a similar problem due to the key value setFecthMode(key,...) I was using table names instead of field names.

http://stackoverflow.com/comment/36625556
has text: Yes. Almost certain. I've gone through the source code of codemodel-2.6.jar and I couldn't find any. Unless someone have a very brilliant workaround.. ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23767004
type: Comment

http://stackoverflow.com/a/23700237
answers question: http://stackoverflow.com/q/23700112
downvote count: 4
has body: Why don't you just try -Xmx100m and -Xmx100M and check if there is any difference. k, m, g work exactly like K, M, G - they all mean binary units.
type: Answer
score: 3
upvote count: 7

http://stackoverflow.com/comment/36442438
type: AnswerComment
comment on: http://stackoverflow.com/a/23712372
score: 0
type: Comment
has text: Scroll down to the answer with **20** upvotes. It should be similar to your goal.

http://stackoverflow.com/a/23762213
has body: 1: before java 1.8 HashMap uses separate chaining with linked lists to resolve collisions. There is a linked list for every bucket. 2: hmmmmmm maybe this one? 3: yes, you are right, hashCode() is used to calculate the hash of the Key. Then the hash code will be transformed to a number between 0 and number of buckets - 1.
downvote count: 0
has comment: http://stackoverflow.com/comment/36543695
accepted answer of: http://stackoverflow.com/q/23761677
has comment: http://stackoverflow.com/comment/36537149
answers question: http://stackoverflow.com/q/23761677
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36537118
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36537126

http://stackoverflow.com/q/23757526
tagged with: icu
has comment: http://stackoverflow.com/comment/36563857
type: Question
tagged with: java
has title: Rule based number format - Indian currency
answer count: 2
score: 2
downvote count: 0
favorite count: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/71980091
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23757665
has body: http://icu-project.org/apiref/icu4j/com/ibm/icu/text/RuleBasedNumberFormat.html Using the above class, def format = new RuleBasedNumberFormat(new Locale("en", "in"), RuleBasedNumberFormat.SPELLOUT) format.format(value) for ₹ 9,00,000 value, it shows nine hundred thousand . But we have to show nine lakhs. How to do this?

http://stackoverflow.com/q/23620627
has answer: http://stackoverflow.com/a/23632565
has comment: http://stackoverflow.com/comment/36265536
has body: I'm using Z3 with Java API. In my SMT-LIB2 file, there are several variables: (declare-fun x0 () Int) (declare-fun x1 () Bool) ; alot more I want to get all these variables, and store them in an array of Expr. From the example distributed with z3, I find the API SMTLIBDecls that get declarations parsed from an SMT-LIB1 file, but there is no similar API for SMT-LIB2. How can I get the declarations? Thanks.
type: Question
tagged with: z3
accepted answer: http://stackoverflow.com/a/23632565
tagged with: java
linked to: http://stackoverflow.com/q/12501540
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/16646808
has title: Display declarations parsed from an SMT-LIB2 file
linked to: http://stackoverflow.com/q/8862109
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/a/23702613
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23701279
score: 2
has comment: http://stackoverflow.com/comment/36439303
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23701279
has body: Try with public class ArticleController { // inject the spring validator. @Autowired private LocalValidatorFactoryBean validator; @RequestMapping(value = "/edit", method = PUT) public String doEdit(@ModelAttribute("article") final Article article, final BindingResult bindingResult) { // generates article's tag, not editable by user article.setTag(generateTag(article)); // validate validator.validate(article, bindingResult); if (bindingResult.hasErrors()) { return "/edit"; } else { service.save(article); return "redirect:/list"; } } }

http://stackoverflow.com/a/23624486
upvote count: 12
has comment: http://stackoverflow.com/comment/36272718
accepted answer of: http://stackoverflow.com/q/23624442
downvote count: 0
answers question: http://stackoverflow.com/q/23624442
has comment: http://stackoverflow.com/comment/36273070
has comment: http://stackoverflow.com/comment/36272649
has comment: http://stackoverflow.com/comment/36272991
has comment: http://stackoverflow.com/comment/36273036
score: 12
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36272977
type: Answer
has comment: http://stackoverflow.com/comment/36272899
has body: The problem is that you mapped your servlet to /register.html and it expects POST method, because you implemented only doPost() method. So when you open register.html page, it will not open html page with the form but servlet that handles the form data. Alternatively when you submit POST form to non-existing URL, web container will display 405 error (method not allowed) instead of 404 (not found). To fix: Register /Register

http://stackoverflow.com/a/23675546
downvote count: 0
has body: try this \ for escaping double quote s.indexOf("\"");
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23675251

http://stackoverflow.com/comment/36479666
type: Comment
comment on: http://stackoverflow.com/q/23731680
has text: @SJuan76 But I tried both in the java.policy, and both are causing the same error.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23662101
has comment: http://stackoverflow.com/comment/36515638
has body: I have a pojo class named purchase. public class Purchase { private String name; private String remark; public void setName(String name) { this.name = name; } public String getName() { return name; } public void setRemark(String remark) { this.remark = remark; } public String getRemark() { return remark; } } Main class to generate pdf file. public class JasperReportIntro { public static void main(String[] args) { JasperReport jasperReport; JasperPrint jasperPrint; ArrayList<Purchase> list1 = new ArrayList<Purchase>(); ArrayList<Purchase> list2 = new ArrayList<Purchase>(); for(int i=0;i<20;i++) { Purchase purchase = new Purchase(); purchase.setName("Vivek" + i); purchase.setRemark("This is remark" + i); purchase.setDiscount(10.0); purchase.setId(i); list1.add(purchase); } for(int i=0;i<20;i++) { Purchase purchase = new Purchase(); purchase.setName("yadav" + i); purchase.setRemark("This is remark" + i); purchase.setDiscount(10.0); purchase.setId(i); list2.add(purchase); } try { jasperReport = JasperCompileManager.compileReport("path/to/report.jrxml"); Map<String, List> result = new HashMap<String, List>(); JRDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(list1); Map<String, Object> map = new HashMap<String, Object>(); map.put("dataForSubreport1",list1); map.put("dataForSubreport2",list2); jasperPrint = JasperFillManager.fillReport(jasperReport,map, beanCollectionDataSource); JasperExportManager.exportReportToPdfFile(jasperPrint, "path/to/simple_report.pdf"); System.out.println("Completed"); } catch (JRException e) { e.printStackTrace(); } } } Main report class report.jrxml. <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" …
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36502573
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23657690
answers question: http://stackoverflow.com/q/23657690
score: 1

jsp
tags question: http://stackoverflow.com/q/23662147
tags question: http://stackoverflow.com/q/23680634
tags question: http://stackoverflow.com/q/23617696
tags question: http://stackoverflow.com/q/23646853
tags question: http://stackoverflow.com/q/23724079
tags question: http://stackoverflow.com/q/23708320
tags question: http://stackoverflow.com/q/23616433
tags question: http://stackoverflow.com/q/23623487
tags question: http://stackoverflow.com/q/23700387
tags question: http://stackoverflow.com/q/23715264
tags question: http://stackoverflow.com/q/23698639
tags question: http://stackoverflow.com/q/23624308
tags question: http://stackoverflow.com/q/23731252
tags question: http://stackoverflow.com/q/23672827
tags question: http://stackoverflow.com/q/23626304
tags question: http://stackoverflow.com/q/23713884
tags question: http://stackoverflow.com/q/23677447
tags question: http://stackoverflow.com/q/23721942
tags question: http://stackoverflow.com/q/23651636
tags question: http://stackoverflow.com/q/23686801
tags question: http://stackoverflow.com/q/23707955
tags question: http://stackoverflow.com/q/23712510
tags question: http://stackoverflow.com/q/23647765
tags question: http://stackoverflow.com/q/23680578
tags question: http://stackoverflow.com/q/23698562
tags question: http://stackoverflow.com/q/23732409
tags question: http://stackoverflow.com/q/23645890
tags question: http://stackoverflow.com/q/23770770
tags question: http://stackoverflow.com/q/23742195
tags question: http://stackoverflow.com/q/23739683
tags question: http://stackoverflow.com/q/23652323
tags question: http://stackoverflow.com/q/23693124
tags question: http://stackoverflow.com/q/23714643
tags question: http://stackoverflow.com/q/23743546
tags question: http://stackoverflow.com/q/23732216
tags question: http://stackoverflow.com/q/23733007
tags question: http://stackoverflow.com/q/23704812
tags question: http://stackoverflow.com/q/23624374
tags question: http://stackoverflow.com/q/23761850
tags question: http://stackoverflow.com/q/23662863
tags question: http://stackoverflow.com/q/23731110
tags question: http://stackoverflow.com/q/23732721
tags question: http://stackoverflow.com/q/23670997
tags question: http://stackoverflow.com/q/23723299
tags question: http://stackoverflow.com/q/23617691
tags question: http://stackoverflow.com/q/23653119
tags question: http://stackoverflow.com/q/23752099
tags question: http://stackoverflow.com/q/23638610
tags question: http://stackoverflow.com/q/23713329
tags question: http://stackoverflow.com/q/23747095
tags question: http://stackoverflow.com/q/23715288
tags question: http://stackoverflow.com/q/23651059
tags question: http://stackoverflow.com/q/23692731
tags question: http://stackoverflow.com/q/23701420
tags question: http://stackoverflow.com/q/23646745
tags question: http://stackoverflow.com/q/23655338
tags question: http://stackoverflow.com/q/23627393
tags question: http://stackoverflow.com/q/23741996
tags question: http://stackoverflow.com/q/23664111
type: Tag
tags question: http://stackoverflow.com/q/23618147
tags question: http://stackoverflow.com/q/23654395
tags question: http://stackoverflow.com/q/23768987
tags question: http://stackoverflow.com/q/23674157
tags question: http://stackoverflow.com/q/23721691
tags question: http://stackoverflow.com/q/23769460
tags question: http://stackoverflow.com/q/23758206
tags question: http://stackoverflow.com/q/23683723
tags question: http://stackoverflow.com/q/23705919
tags question: http://stackoverflow.com/q/23670690
tags question: http://stackoverflow.com/q/23662675
tags question: http://stackoverflow.com/q/23669358
tags question: http://stackoverflow.com/q/23760501
tags question: http://stackoverflow.com/q/23734873
tags question: http://stackoverflow.com/q/23615721
tags question: http://stackoverflow.com/q/23766423
tags question: http://stackoverflow.com/q/23755741
tags question: http://stackoverflow.com/q/23625693
tags question: http://stackoverflow.com/q/23751232
tags question: http://stackoverflow.com/q/23676422

http://stackoverflow.com/q/23682663
has comment: http://stackoverflow.com/comment/36385973
answer count: 1
linked to: http://stackoverflow.com/q/19785290
has comment: http://stackoverflow.com/comment/36386247
linked to: http://stackoverflow.com/q/504103
accepted answer: http://stackoverflow.com/a/23682828
type: AnsweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/36385895
has title: Memory and execution time comparison between my code and apache poi
type: Question
has comment: http://stackoverflow.com/comment/36385889
has comment: http://stackoverflow.com/comment/36385955
tagged with: java
has comment: http://stackoverflow.com/comment/36386376
score: 0
has answer: http://stackoverflow.com/a/23682828
has body: I am in the middle of writing a XLSX parser. My usecase is just to read a spreadsheet and store the cell values into some object structure. Once complete, I want to compare my code's performance (memory and time) with that of Apache Poi. For time comparison, I was thinking of checking the delta System.nanotime(). I will parse the xlsx multiple times in a loop to make sure the execution time is in the order of seconds and then average. I need help with the following: Is there a better way to compare execution time? How can I compare the memory footprint of my code with Poi? Could anybody help with some information/suggestion please?
has comment: http://stackoverflow.com/comment/36386018

http://stackoverflow.com/q/23620112
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36265064
tagged with: android
has body: I've been making a game where a circles of decreasing size are drawn on the screen and with one finger pressed on the screen you must stay on these circles. If you come off the circles, you lose. I'm trying to get this game to pause a thread and resume it when the game stops after failing (the thread I am appears to be very processor intensive even when it isn't doing anything). I have included some code below, with all the touch event method provided. Does anyone know where I'm going wrong here? I've looked at a number of threads and tried a number of different approaches, but none have been successful so far. I have omitted some code to try and keep it clean. public class MainActivity extends Activity { ... Thread mainThread; public void onCreate(Bundle savedInstanceState) { ... paused = true; mainThread = new Thread(new Runnable() { public void run() { synchronized (this) { if (paused) { try { paused = false; wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } while (true) { if (!paused) { ... GAME STUFF ... } } } }); mainThread.start(); } public boolean onTouchEvent(MotionEvent e) { if (e.getPointerCount() == 1) { switch (e.getActionMasked()) { case MotionEvent.ACTION_DOWN: if (alertDialog == null) { go(); } else if (alertDialog.isShowing() == false) { go(); } return true; case MotionEvent.ACTION_UP: pause(); saveHighScore(); dialog("You lifted your finger from the screen! \n" + "You scored " + getScore() + ". \n" + "Your highscore is " + getHighScore()); reset(); return true; case MotionEvent.ACTION_MOVE: if (alertDialog == null) { go(); } else if (alertDialog.isShowing() == false) { if (!checkBounds(e.getX(), e.getY())) { pause(); saveHighScore(); dialog("You moved outside a circle! \n" + "You scored " + getScore() + ". \n" + "Your high score is " + getHighScore()); reset(); } } return true; } } else { pause(); saveHighScore(); dialog("You can only use 1 finger at a time! \n" + "You scored " + getScore() + ". \n" + "Your high score is " + get…
has comment: http://stackoverflow.com/comment/36264880
has comment: http://stackoverflow.com/comment/36265116
has comment: http://stackoverflow.com/comment/36264711
accepted answer: http://stackoverflow.com/a/23620224
favorite count: 0
has comment: http://stackoverflow.com/comment/36264644
has comment: http://stackoverflow.com/comment/36264728
has comment: http://stackoverflow.com/comment/36264597
tagged with: multithreading
upvote count: 1
has title: Waiting thread not resuming
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36265181
has comment: http://stackoverflow.com/comment/36264829
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36264561
type: Question
has comment: http://stackoverflow.com/comment/36264504
has answer: http://stackoverflow.com/a/23620224

http://stackoverflow.com/a/23635194
has body: Scanner#nextLine() Does not use the delimiter pattern, it used its own internal one to check for every instance of a new line. To fix it, use Scanner#next() with a delimiter pattern "\\n+" to check for multiple new lines in a row. // Change the delimiter to the newline char // \\r used just for Windows compatibility input.useDelimiter("[\\r\\n]+"); // Get the next non-blank line String nextLineThatHasSomething = input.next();
upvote count: 8
answers question: http://stackoverflow.com/q/23635037
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/36293360
has comment: http://stackoverflow.com/comment/36293439
downvote count: 0

http://stackoverflow.com/q/23619759
accepted answer: http://stackoverflow.com/a/23619954
score: -1
has answer: http://stackoverflow.com/a/23619954
answer count: 1
downvote count: 1
tagged with: utf-8
tagged with: string
favorite count: 0
tagged with: android
has title: Android UTF-8 vs ANSI .equals not working / how change charset?
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: i read a list for my android app from a csv or txt file. If the File is encoded UTF-8 with Notepad++ i seh the list all right. But i cant search/find strings with .equals. If the file is encoded with widows as ansi, is cant see äöü etc. But now i can find strings. Now my question. How can i found out what charset my string has? I compare my frist string (from the file) with another string, read in in the app with searchview. I "THINK" my searchview string from the app is ansi too, how to change that to UTF-8 and hope that the compare then works, again. Android 4.4.2 Thank you following dosent work: String s = null; try { s = new String(query.getBytes(), "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e("utf8", "conversion", e); }
type: Question

http://stackoverflow.com/comment/36313479
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23645348
has text: I'm just explaining where the question is coming from

http://stackoverflow.com/comment/36267804
comment on: http://stackoverflow.com/q/23621723
has text: @PeterNiederwieser Much closer, thanks!. Still having some issues though, but it may have to do with stdin, which I believe there is a simple fix for. Cheers!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36476845
score: 0
type: Comment
has text: `==` is evil and can sometimes trick you into believing that it works. Just don't pay attention to its output.
type: QuestionComment
comment on: http://stackoverflow.com/q/23730246

http://stackoverflow.com/comment/36291563
type: Comment
type: QuestionComment
has text: @SergiyMedvynskyy good catch I didn't even see that
comment on: http://stackoverflow.com/q/23634193
score: 0

http://stackoverflow.com/comment/116285065
comment on: http://stackoverflow.com/a/23697471
has text: Because Failover appender just helps call secondary appenders if primary appender fails. Say i have primary appender as appender1, secondary as appender2, i want appender2 to be called when appender1 throws, but this i need to happen only once, next time all calls to appender2 via appender1 should just become NOOP
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23713785
has comment: http://stackoverflow.com/comment/36444231
type: Question
has answer: http://stackoverflow.com/a/35417173
has title: Fibonnaci recurring value is not returning
downvote count: 4
answer count: 3
favorite count: 0
has body: This Fibonnaci program result is not printing the result. public int fibo(int n) { if(n <=1) return 1; else return fibo(n - 1) + fibo(n - 2); } public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("enter the number upto fibo needs"); int number=sc.nextInt(); System.out.println("1st stage"); Fibonnaci obj=new Fibonnaci(); obj.fibo(number); }
score: -3
has answer: http://stackoverflow.com/a/23714009
has comment: http://stackoverflow.com/comment/36448039
type: UnansweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23713818

http://stackoverflow.com/q/23741643
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23741970
has body: I get an exception like below SO question: SpringPersistenceUnitInfo :: AbstractMethodError Caused by: java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode My dependencies are in the screenshot, i tried almost all the advices, result is same exception: After adding dependencies in answer:
tagged with: eclipse
tagged with: jpa
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
linked to: http://stackoverflow.com/q/8034545
has answer: http://stackoverflow.com/a/23741970
type: AnsweredQuestion
has title: AbstractMethodError for getValidationMode()Ljavax/persistence/ValidationMode
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/comment/36359012
type: Comment
comment on: http://stackoverflow.com/a/23631135
has text: Reliability of test was a point to worry. Can you please give me any links for HW counters ? Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/q/23656915
upvote count: 3
has comment: http://stackoverflow.com/comment/36336731
tagged with: java
has comment: http://stackoverflow.com/comment/36335909
possible better answer: http://stackoverflow.com/a/23657777
type: Question
accepted answer: http://stackoverflow.com/a/23672073
downvote count: 0
has answer: http://stackoverflow.com/a/23657646
has body: As the title states, I get a java.lang.AbstractMethodError on a method that is definitively implemented by my class. The complete error message is: java.lang.AbstractMethodError: htmlexport.HTMLExport.getParameterFormDescriptor()Ljava/util/List; I have an interface that defines the method as follows: List&lt;ParamFormElement&gt; getParameterFormDescriptor(); And as I said this method is implemented by the implementing class. The interface is included in a jar that is in my local Maven repository. I already tried mvn clean and mvn install and bumping the version number, but this does not solve the problem. The implementing class is in another jar file which I create using an ANT-script. The file is then loaded via a ClassLoader in the main application. Any clues why I get this error? All other methods defined by the interface are working. Here comes the code I have a Wicket WebPage where I make the call to this method: public class AddJobPage extends BasePage { public AddJobPage(final PageParameters params) { super(params); final Workable w = WorkableManager.getInstance().findWorkableByName(params.get("workableName").toString()); w.getParameterFormDescriptor(); } } The WorkableManager internally loads the jar-file which includes the implementing class using an URLClassLoader. This is working fine and I get an instance of the needed class. The interface that defines the method is: public interface Workable { List&lt;ParamFormElement&gt; getParameterFormDescriptor(); } And the implementing class looks like this (Module extends Workable): public class HTMLExport implements Module { @Override public final List&lt;ParamFormElement&gt; getParameterFormDescriptor() { final List&lt;ParamFormElement&gt; form = new ArrayList&lt;&gt;(); form.add(new ParamFormElement(ParamFormElement.Type.TEXT, "Bitte eingeben:", "test")); return form; } } The interface is in a separate project and assembled as a jar-file in my local Maven repository. The HTMLExport class is in a different proje…
answer count: 3
has comment: http://stackoverflow.com/comment/36337200
favorite count: 0
has answer: http://stackoverflow.com/a/23672073
has title: Getting java.lang.AbstractMethodError on implemented method
has comment: http://stackoverflow.com/comment/36337056
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23657777

http://stackoverflow.com/a/23653916
has comment: http://stackoverflow.com/comment/36330047
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36330851
accepted answer of: http://stackoverflow.com/q/23653482
has body: Try with below code on menu item click event.... View v = view.getRootView(); v.setDrawingCacheEnabled(true); Bitmap b = v.getDrawingCache(); // give path of external directory to save image String extr = Environment.getExternalStorageDirectory().toString(); File myPath = new File(extr, "test.jpg"); FileOutputStream fos = null; try { fos = new FileOutputStream(myPath); b.compress(Bitmap.CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); } catch (Exception e) { e.printStackTrace(); } where view v is root layout...
downvote count: 0
has comment: http://stackoverflow.com/comment/36331003
has comment: http://stackoverflow.com/comment/36331184
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36330271
has comment: http://stackoverflow.com/comment/36329863
score: 1
has comment: http://stackoverflow.com/comment/36330459
has comment: http://stackoverflow.com/comment/36331533
answers question: http://stackoverflow.com/q/23653482
has comment: http://stackoverflow.com/comment/36330635

http://stackoverflow.com/a/23719493
accepted answer of: http://stackoverflow.com/q/23719454
score: 9
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23719454
type: Answer
has body: From the API Reference, setRotate sets a particular absolute rotation (around either (0,0) or some other user-supplied point), while postRotate adds to the rotation of the matrix it is called on. The question of which one should I use is best answered by trying each and seeing which one gives you the result that you want.
upvote count: 9

http://stackoverflow.com/comment/36360773
type: AnswerComment
comment on: http://stackoverflow.com/a/23669558
score: 0
type: Comment
has text: Still getting null only

http://stackoverflow.com/a/23713069
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23713001
downvote count: 0
has comment: http://stackoverflow.com/comment/36446132
has body: You could create an activity to start when needed with: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().setFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); } Wakelocks are deprecated and only the window flags should now be used. Edit: It works only with normal/transparent theme, it doesn't work with dialog theme.
type: Answer
has comment: http://stackoverflow.com/comment/36446191
answers question: http://stackoverflow.com/q/23713001
upvote count: 3
has comment: http://stackoverflow.com/comment/68752468
has comment: http://stackoverflow.com/comment/36445928
has comment: http://stackoverflow.com/comment/36446339
score: 3

http://stackoverflow.com/comment/36270192
has text: If they are not `.equals()`, they may or may not have the same hash code. But if they are `.equals()`, they MUST have the same hash code.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23622972

http://stackoverflow.com/a/23709537
has body: Using jquery ("#submitButton").click(function(){ var url="www.mysite.com/"; url= url + $("#feild1").val(); url = url + "sometext"; url = url + $("#feild2").val(); //Then use your url });
answers question: http://stackoverflow.com/q/23709433
score: 0
type: Answer

http://stackoverflow.com/comment/61700168
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23631936
has text: This may break functionality with regards setting default values for properties defined in @Value. Here's an open bug report about this: https://jira.spring.io/browse/SPR-9989 Reading the comments in that bug report, it seems that Spring team prefers not to have multiple property-placeholder configurers in a context and may deprecate it in the future.
type: Comment

http://stackoverflow.com/comment/36347635
type: AnswerComment
score: 0
type: Comment
has text: Glad I could help... if one of these answers helped you, please select it as accepted answer.
comment on: http://stackoverflow.com/a/23661252

http://stackoverflow.com/a/23708379
downvote count: 0
answers question: http://stackoverflow.com/q/23708308
has body: The method add should return boolean value, so all what you need to do is public boolean add(MyObject newvalue) { boolean retVal = super.add(newvalue); Result = Double.NaN; return retVal ; }
upvote count: 3
has comment: http://stackoverflow.com/comment/36434393
type: Answer
score: 3

http://stackoverflow.com/q/23658039
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36340122
has title: Java exec and environment variable in command path
tagged with: java
has answer: http://stackoverflow.com/a/23658191
type: Question
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/36338288
answer count: 1
has body: I try to execute a parameterized command with Runtime.exec() with environment variable in the command string. Example: String cmd = "%ProgramFiles%\\Internet Explorer\\iexplore.exe"; Runtime.getRuntime().exec(cmd); I got the following error: java.io.IOException: Cannot run program "%ProgramFiles%\Internet": CreateProcess error=2, Le fichier spécifié est introuvable at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:431) at java.lang.Runtime.exec(Runtime.java:369) at TestEnv.main(TestEnv.java:34) Caused by: java.io.IOException: CreateProcess error=2, Le fichier spécifié est introuvable at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:81) at java.lang.ProcessImpl.start(ProcessImpl.java:30) at java.lang.ProcessBuilder.start(ProcessBuilder.java:453) ... 4 more Without environment variable in the command it works and launches IE: String cmd = "C:\\Program Files\\Internet Explorer\\iexplore.exe"; Runtime.getRuntime().exec(cmd); I checked ProgramFiles variable exists: String path = System.getenv("ProgramFiles"); System.out.println(path); This returns well C:\Program Files I tried to put manually the variable, same error: Runtime.getRuntime().exec(cmd, new String[] {"ProgramFiles=C:\\Program Files"}); I tried with ProcessBuilder, same error: ProcessBuilder pb = new ProcessBuilder(cmd); pb.start(); What is the good way to do this, is it possible?
has comment: http://stackoverflow.com/comment/36338294

maven
tags question: http://stackoverflow.com/q/23777914
tags question: http://stackoverflow.com/q/23744021
tags question: http://stackoverflow.com/q/23656002
tags question: http://stackoverflow.com/q/23688063
tags question: http://stackoverflow.com/q/23653876
tags question: http://stackoverflow.com/q/23758759
tags question: http://stackoverflow.com/q/23682694
tags question: http://stackoverflow.com/q/23676282
type: Tag
tags question: http://stackoverflow.com/q/23650795
tags question: http://stackoverflow.com/q/23702476
tags question: http://stackoverflow.com/q/23635874
tags question: http://stackoverflow.com/q/23672205
tags question: http://stackoverflow.com/q/23761091
tags question: http://stackoverflow.com/q/23755037
tags question: http://stackoverflow.com/q/23630259
tags question: http://stackoverflow.com/q/23699552
tags question: http://stackoverflow.com/q/23661856
tags question: http://stackoverflow.com/q/23664751
tags question: http://stackoverflow.com/q/23663466
tags question: http://stackoverflow.com/q/23642618
tags question: http://stackoverflow.com/q/23772905
tags question: http://stackoverflow.com/q/23647073
tags question: http://stackoverflow.com/q/23619394
tags question: http://stackoverflow.com/q/23690990
tags question: http://stackoverflow.com/q/23678763
tags question: http://stackoverflow.com/q/23700895
tags question: http://stackoverflow.com/q/23633430
tags question: http://stackoverflow.com/q/23632010
tags question: http://stackoverflow.com/q/23654798
tags question: http://stackoverflow.com/q/23762473
tags question: http://stackoverflow.com/q/23745527
tags question: http://stackoverflow.com/q/23682125
tags question: http://stackoverflow.com/q/23745375
tags question: http://stackoverflow.com/q/23731393
tags question: http://stackoverflow.com/q/23761791
tags question: http://stackoverflow.com/q/23757048
tags question: http://stackoverflow.com/q/23777934
tags question: http://stackoverflow.com/q/23707607
tags question: http://stackoverflow.com/q/23687460
tags question: http://stackoverflow.com/q/23652496
tags question: http://stackoverflow.com/q/23742185
tags question: http://stackoverflow.com/q/23772247
tags question: http://stackoverflow.com/q/23685286
tags question: http://stackoverflow.com/q/23771705
tags question: http://stackoverflow.com/q/23745766
tags question: http://stackoverflow.com/q/23757979
tags question: http://stackoverflow.com/q/23704903
tags question: http://stackoverflow.com/q/23754871
tags question: http://stackoverflow.com/q/23674380
tags question: http://stackoverflow.com/q/23653477
tags question: http://stackoverflow.com/q/23739834
tags question: http://stackoverflow.com/q/23736756
tags question: http://stackoverflow.com/q/23635120
tags question: http://stackoverflow.com/q/23712731
tags question: http://stackoverflow.com/q/23641507
tags question: http://stackoverflow.com/q/23715268
tags question: http://stackoverflow.com/q/23665048
tags question: http://stackoverflow.com/q/23688889
tags question: http://stackoverflow.com/q/23622592
tags question: http://stackoverflow.com/q/23659829
tags question: http://stackoverflow.com/q/23684535
tags question: http://stackoverflow.com/q/23708916
tags question: http://stackoverflow.com/q/23683589
tags question: http://stackoverflow.com/q/23655990
tags question: http://stackoverflow.com/q/23775647
tags question: http://stackoverflow.com/q/23692101
tags question: http://stackoverflow.com/q/23642894
tags question: http://stackoverflow.com/q/23752899
tags question: http://stackoverflow.com/q/23652098
tags question: http://stackoverflow.com/q/23655552
tags question: http://stackoverflow.com/q/23650637
tags question: http://stackoverflow.com/q/23626293
tags question: http://stackoverflow.com/q/23648667
tags question: http://stackoverflow.com/q/23655206
tags question: http://stackoverflow.com/q/23737169
tags question: http://stackoverflow.com/q/23709635
tags question: http://stackoverflow.com/q/23628818
tags question: http://stackoverflow.com/q/23734285
tags question: http://stackoverflow.com/q/23680536

http://stackoverflow.com/a/23678353
has body: To delete the same object from both lists create a wrapper class like so class PointWrap{ int id = 0; Point p = null; public PointWrap( int inid, Point inp){ id = inid; p = inp; } } An insert would look like this tree.put( new PointWrap( id++, point) ); When you iterate through to delete just save the id before the delete occurs. This way you can delete from the other list/tree as well.
score: 0
answers question: http://stackoverflow.com/q/23677835
has comment: http://stackoverflow.com/comment/36377655
type: Answer
has comment: http://stackoverflow.com/comment/36377790
has comment: http://stackoverflow.com/comment/36377695

http://stackoverflow.com/comment/36266133
type: QuestionComment
comment on: http://stackoverflow.com/q/23616317
score: 0
has text: @CodeChimp would that still be the case once Oracle comes back online? I'm confused why MySQL doesn't behave this way.
type: Comment

hibernate
tags question: http://stackoverflow.com/q/23685384
tags question: http://stackoverflow.com/q/23730620
tags question: http://stackoverflow.com/q/23629760
tags question: http://stackoverflow.com/q/23693728
tags question: http://stackoverflow.com/q/23650386
tags question: http://stackoverflow.com/q/23620716
tags question: http://stackoverflow.com/q/23658954
tags question: http://stackoverflow.com/q/23708905
tags question: http://stackoverflow.com/q/23728881
tags question: http://stackoverflow.com/q/23623666
tags question: http://stackoverflow.com/q/23728688
tags question: http://stackoverflow.com/q/23697818
tags question: http://stackoverflow.com/q/23674480
tags question: http://stackoverflow.com/q/23737344
tags question: http://stackoverflow.com/q/23673183
tags question: http://stackoverflow.com/q/23647318
tags question: http://stackoverflow.com/q/23671049
tags question: http://stackoverflow.com/q/23646837
tags question: http://stackoverflow.com/q/23636083
tags question: http://stackoverflow.com/q/23741986
tags question: http://stackoverflow.com/q/23731172
tags question: http://stackoverflow.com/q/23708563
tags question: http://stackoverflow.com/q/23648614
tags question: http://stackoverflow.com/q/23745957
tags question: http://stackoverflow.com/q/23744453
tags question: http://stackoverflow.com/q/23625846
tags question: http://stackoverflow.com/q/23675798
tags question: http://stackoverflow.com/q/23759130
tags question: http://stackoverflow.com/q/23652289
tags question: http://stackoverflow.com/q/23736422
tags question: http://stackoverflow.com/q/23775175
tags question: http://stackoverflow.com/q/23719237
tags question: http://stackoverflow.com/q/23777715
tags question: http://stackoverflow.com/q/23673938
tags question: http://stackoverflow.com/q/23629118
tags question: http://stackoverflow.com/q/23678143
tags question: http://stackoverflow.com/q/23642792
tags question: http://stackoverflow.com/q/23730719
tags question: http://stackoverflow.com/q/23760687
tags question: http://stackoverflow.com/q/23623435
tags question: http://stackoverflow.com/q/23670690
tags question: http://stackoverflow.com/q/23681532
tags question: http://stackoverflow.com/q/23651999
tags question: http://stackoverflow.com/q/23662533
tags question: http://stackoverflow.com/q/23642734
tags question: http://stackoverflow.com/q/23634161
tags question: http://stackoverflow.com/q/23662039
tags question: http://stackoverflow.com/q/23730204
tags question: http://stackoverflow.com/q/23656332
tags question: http://stackoverflow.com/q/23702191
tags question: http://stackoverflow.com/q/23756987
tag name: hibernate
tags question: http://stackoverflow.com/q/23720103
tags question: http://stackoverflow.com/q/23770204
tags question: http://stackoverflow.com/q/23753510
tags question: http://stackoverflow.com/q/23677717
tags question: http://stackoverflow.com/q/23644823
tags question: http://stackoverflow.com/q/23653007
tags question: http://stackoverflow.com/q/23762252
tags question: http://stackoverflow.com/q/23749179
tags question: http://stackoverflow.com/q/23723469
tags question: http://stackoverflow.com/q/23736109
tags question: http://stackoverflow.com/q/23664728
tags question: http://stackoverflow.com/q/23696044
tags question: http://stackoverflow.com/q/23623151
tags question: http://stackoverflow.com/q/23768781
tags question: http://stackoverflow.com/q/23665537
tags question: http://stackoverflow.com/q/23776736
tags question: http://stackoverflow.com/q/23762643
tags question: http://stackoverflow.com/q/23638334
tags question: http://stackoverflow.com/q/23627482
tags question: http://stackoverflow.com/q/23708255
tags question: http://stackoverflow.com/q/23676644
tags question: http://stackoverflow.com/q/23714530
tags question: http://stackoverflow.com/q/23714974
tags question: http://stackoverflow.com/q/23750518
tags question: http://stackoverflow.com/q/23734247
tags question: http://stackoverflow.com/q/23671227
tags question: http://stackoverflow.com/q/23636312
tags question: http://stackoverflow.com/q/23690919

http://stackoverflow.com/q/23740462
tagged with: editingstate
downvote count: 0
has comment: http://stackoverflow.com/comment/36541016
has comment: http://stackoverflow.com/comment/36540015
has comment: http://stackoverflow.com/comment/36541047
answer count: 1
has comment: http://stackoverflow.com/comment/36538369
favorite count: 0
has comment: http://stackoverflow.com/comment/36540177
type: UnansweredQuestion
has title: How to correctly avoid specific TableViewCells of beeing editable?
upvote count: 1
tagged with: properties
has body: Following Issue: I need to know at specific moments, weather my TableView is currently beeing edited or not. I used the editingCellProperty and binded a specific businesslogic to it, to get informed, whenever the table switches these modes. Unfortunalty the state is not always shown correctly, because I have specific cells (within the same column) which are not supposed to be edited at all, but still when clicked on a noneditable cell a TablePosition is set into the editingCellProperty, hence I get the information, that my TableView is editing, eventhough per condition its been told, that this cell is not editable and the edit mode never really starts. I created a small example, where all even rows of ColumnName are editable, while odd rows are not. Example-Code: public class TableViewEditableStateError extends Application { public static void main( final String[] args ) { launch( args ); } @Override public void start( final Stage primaryStage ) { Item item1 = new Item( 1, "Item1" ); Item item2 = new Item( 2, "Item2" ); Item item3 = new Item( 3, "Item3" ); Item item4 = new Item( 4, "Item4" ); ObservableList&lt;Item&gt; itemList = FXCollections.observableArrayList( item1, item2, item3, item4 ); TableColumn&lt;Item, Integer&gt; columnId = new TableColumn&lt;&gt;( "ColumnId" ); TableColumn&lt;Item, String&gt; columnName = new TableColumn&lt;&gt;( "ColumnName" ); columnId.setCellValueFactory( new PropertyValueFactory&lt;Item, Integer&gt;( "id" ) ); columnName.setCellValueFactory( new PropertyValueFactory&lt;Item, String&gt;( "name" ) ); // columnName.setCellFactory( TextFieldTableCell.forTableColumn() ); -&gt; Using own implementation for editablestate-behaviour columnName.setCellFactory( new Callback&lt;TableColumn&lt;Item, String&gt;, TableCell&lt;Item, String&gt;&gt;() { @Override public TableCell&lt;Item, String&gt; call( final TableColumn&lt;Item, String&gt; column ) { TableCell&lt;Item, String&gt; cell = new EditableTableCell&lt;Item&gt;() { @Override public void …
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23764116
type: Question
tagged with: tableview
has comment: http://stackoverflow.com/comment/36539591

http://stackoverflow.com/q/23674185
has title: Using references like pointers in method call in Java
has answer: http://stackoverflow.com/a/23674253
has comment: http://stackoverflow.com/comment/36369666
has answer: http://stackoverflow.com/a/23674329
type: AnsweredQuestion
tagged with: java
has body: I encountered a problem while dealing with a call of a static method in another class. So I have a function which is like follow, where I need to extract two values, a counter and an object : public static int getEarliestValue(Map&lt;DBObject, DBCursor&gt; cursorMap, DBObject result) { int mergeCount = 1; if (!cursorMap.isEmpty()) { long ealiest = Long.MAX_VALUE; for (DBObject o : cursorMap.keySet()) { // do stuff to init tmp ... if (tmp &lt; ealiest) { result = o; ealiest = tmp; } // other stuff ..... } return mergeCount; } here is how I call it in my other class : DBObject result= null; int mergeCount = MongoTickReaderUtil.getEarliestValue(cursorList, result); I checked in debug mod and result is set in getEarliestValue but when it's go out of the function call result is still null. I thought that references where like pointers with the difference that we couldn't do arithmetic operation on the reference itself, but with this behavior it seems that even if we change the pointed value it still only in the local scope. The only idea that I found was to put it in a List but this is neither elegant nor optimal. Any suggestion ? Thanks in advance.
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/23674329
accepted answer: http://stackoverflow.com/a/23674253
has answer: http://stackoverflow.com/a/23674449
answer count: 4
tagged with: reference
has answer: http://stackoverflow.com/a/23719694

spring-data-redis
tags question: http://stackoverflow.com/q/23693427
tags question: http://stackoverflow.com/q/23731974
type: Tag
tag name: spring-data-redis

http://stackoverflow.com/q/23693796
has answer: http://stackoverflow.com/a/23834052
has comment: http://stackoverflow.com/comment/36407946
linked to: http://stackoverflow.com/q/18615774
has comment: http://stackoverflow.com/comment/36407839
has answer: http://stackoverflow.com/a/23693839
has answer: http://stackoverflow.com/a/23807812
has answer: http://stackoverflow.com/a/23793376
has answer: http://stackoverflow.com/a/23693897
has comment: http://stackoverflow.com/comment/36624369
has answer: http://stackoverflow.com/a/23693832
tagged with: tomcat
tagged with: spring-security
favorite count: 0
answer count: 9
has comment: http://stackoverflow.com/comment/36407920
has comment: http://stackoverflow.com/comment/36407751
has comment: http://stackoverflow.com/comment/36407629
has comment: http://stackoverflow.com/comment/36407655
has comment: http://stackoverflow.com/comment/36407741
has comment: http://stackoverflow.com/comment/36407869
has comment: http://stackoverflow.com/comment/36407479
has comment: http://stackoverflow.com/comment/36407793
has comment: http://stackoverflow.com/comment/36407688
has title: Where should I keep the credentials of my database?
has comment: http://stackoverflow.com/comment/36407890
has comment: http://stackoverflow.com/comment/36407730
type: UnansweredQuestion
score: 36
tagged with: mysql
has answer: http://stackoverflow.com/a/23853192
has body: Is it a good idea to keep the username and password of database in a xml file and import it into security file of the spring security ? is there any better option? If I need to encrypt the password how to do it and how to find the encrypted version of password on phpMyAdmin? MySQL login-service.xml <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost/muDB" /> <property name="username" value="jack" /> <property name="password" value="alex123432" /> myproject-security.xml .... <beans:import resource='login-service.xml'/> .... PLEASE NOTE: As all user related passwords are already encrypted, I am only intended to hide the password of the DATABASE itself not table columns. This password would be used by my application to get connected to the database.
linked to: http://stackoverflow.com/q/97984
downvote count: 1
has answer: http://stackoverflow.com/a/23859726
has comment: http://stackoverflow.com/comment/36951842
type: Question
linked to: http://stackoverflow.com/q/4663061
has comment: http://stackoverflow.com/comment/36620927
upvote count: 37
tagged with: java
has answer: http://stackoverflow.com/a/23821923

http://stackoverflow.com/q/23744201
upvote count: 1
type: Question
has body: I'm trying to implement an equivalent to String.intern(), but for other objets. My goal is the following: I've an object A which I will serialize and then deserialize. If there is another reference to A somewhere, I want the result of the deserialization to be the same reference. Here is one example of what I would expect. MyObject A = new MyObject(); A.data1 = 1; A.data2 = 2; byte[] serialized = serialize(A); A.data1 = 3; MyObject B = deserialize(serialized); // B!=A and B.data1=1, B.data2=2 MyObject C = B.intern(); // Here we should have C == A. Consequently C.data1=3 AND C.data2=2 Here is my implementation atm. (the MyObject class extends InternableObject) public abstract class InternableObject { private static final AtomicLong maxObjectId = new AtomicLong(); private static final Map&lt;Long, InternableObject&gt; dataMap = new ConcurrentHashMap&lt;&gt;(); private final long objectId; public InternableObject() { this.objectId = maxObjectId.incrementAndGet(); dataMap.put(this.objectId, this); } @Override protected void finalize() throws Throwable { super.finalize(); dataMap.remove(this.objectId); } public final InternableObject intern() { return intern(this); } public static InternableObject intern(InternableObject o) { InternableObject r = dataMap.get(o.objectId); if (r == null) { throw new IllegalStateException(); } else { return r; } } } My unit test (which fails): private static class MyData extends InternableObject implements Serializable { public int data; public MyData(int data) { this.data = data; } } @Test public void testIntern() throws Exception { MyData data1 = new MyData(7); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(data1); oos.flush(); baos.flush(); oos.close(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); MyData data2 = (MyData) ois.readObject(); Assert.assertTrue(data1 …
has answer: http://stackoverflow.com/a/23745462
tagged with: memory
has answer: http://stackoverflow.com/a/23744427
answer count: 2
possible better answer: http://stackoverflow.com/a/23745462
has comment: http://stackoverflow.com/comment/36503182
downvote count: 0
tagged with: intern
score: 1
favorite count: 0
tagged with: serialization
accepted answer: http://stackoverflow.com/a/23744427
has comment: http://stackoverflow.com/comment/36502813
type: AnsweredQuestion
has title: Implementing an equivalent to String.intern() for other objects
tagged with: java

http://stackoverflow.com/comment/36552545
comment on: http://stackoverflow.com/a/23761971
type: Comment
score: 0
type: AnswerComment
has text: Actually I tried it by modifying the example from the ExtJS 4.2 library and it worked for me. Unfortunately I couldn't set up a working fiddle, since SenchaFiddle/JSFiddle does not include the `Ext.ux.*` classes for the grid filter plugin. Will check tomorrow if I can come up with a working fiddle somehow.

http://stackoverflow.com/comment/36516146
has text: Maybe DC_11? https://github.com/apache/jena/blob/trunk/jena-core/src/main/java/com/hp/hpl/jena/vocabulary/DC_11.java
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23750918
type: Comment

http://stackoverflow.com/a/34629081
type: Answer
answers question: http://stackoverflow.com/q/23688702
score: 6
downvote count: 0
has body: Open .iml file. Look for keyword 'NewModuleRootManager'. Check if attribute 'inherit-compiler-output' is set to true or not. If not set to true. Like this : component name="NewModuleRootManager" inherit-compiler-output="true"&gt; &lt;content url="file://$MODULE_DIR$"&gt; &lt;sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /&gt; &lt;sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" /&gt; &lt;sourceFolder url="file://$MODULE_DIR$/app" isTestSource="false" /&gt;
upvote count: 6

http://stackoverflow.com/comment/36412999
has text: You can use left shift. 1 << 3 (shift 1 3 places to the left) is the same as 2^3
score: 0
comment on: http://stackoverflow.com/q/23697352
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23642692
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7
accepted answer of: http://stackoverflow.com/q/23642670
answers question: http://stackoverflow.com/q/23642670
has body: Spring MVC is a framework built on top of the Servlet API. As such, it requires a Servlet container. Your Servlet container finds the web.xml or uses any other deployment strategy (depends on container), finds the Servlet implementations to instantiate (or through @WebServlet) and instantiates them. One of these Servlet implementations is Spring's DispatcherServlet which, as part of its initialization, generates an ApplicationContext which it then uses to configure its controllers and dispatch requests.
upvote count: 7

doubly-linked-list
tags question: http://stackoverflow.com/q/23690948
tags question: http://stackoverflow.com/q/23623017
type: Tag
tag name: doubly-linked-list
tags question: http://stackoverflow.com/q/23624121

http://stackoverflow.com/q/23697751
type: AnsweredQuestion
has body: I have .bat file with following content for example: mkdir testDir Now I put it to folder C:\temp Then I want to run it using java so I do following: Runtime.getRuntime().exec("cmd /c start C:\\temp\\test.bat"); I expect that folder will be created in C:\temp like when I execute this file manually, but folder is being created in my workspace which is wrong. How can I fix it?
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/6811522
has title: Incorrect *.bat execution from Java
has comment: http://stackoverflow.com/comment/36413538
score: 0
tagged with: batch-file
answer count: 1
linked to: http://stackoverflow.com/q/6811522
has answer: http://stackoverflow.com/a/23697791
accepted answer: http://stackoverflow.com/a/23697791

http://stackoverflow.com/comment/86631293
comment on: http://stackoverflow.com/a/23704226
type: AnswerComment
score: 0
type: Comment
has text: ...which is in turn lifted from a book, Swing Hacks: Tips and Tools for Killer GUIs by Joshua Marinacci & Chris Adamson, page 380

http://stackoverflow.com/q/23716717
type: Question
has answer: http://stackoverflow.com/a/23716885
upvote count: 2
has comment: http://stackoverflow.com/comment/36450278
answer count: 1
downvote count: 1
has body: I am trying to get my application to appear on the center of the second monitor as my main monitor has the code on. I am using window.setLocationRelativeTo(null);, but do not know what I would use to place it on the other monitor. How can I get my application to appear on the second monitor?
has comment: http://stackoverflow.com/comment/36450137
favorite count: 0
linked to: http://stackoverflow.com/q/4627553
tagged with: jframe
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23716885
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36450233
has title: How do I get my application to appear on the center of my second monitor, not my main?

http://stackoverflow.com/comment/36416574
type: QuestionComment
score: 0
has text: Any one of your several ways you tried?
type: Comment
comment on: http://stackoverflow.com/q/23699341

http://stackoverflow.com/q/23622907
upvote count: 0
has comment: http://stackoverflow.com/comment/36269963
score: -1
answer count: 2
has title: What's the relationship between equals and hashCode?
possible better answer: http://stackoverflow.com/a/23622947
favorite count: 0
tagged with: equals
has answer: http://stackoverflow.com/a/23622972
accepted answer: http://stackoverflow.com/a/23622972
type: AnsweredQuestion
tagged with: hashcode
has answer: http://stackoverflow.com/a/23622947
tagged with: java
downvote count: 1
type: Question
has body: Question: if there are two objects o1 and o2 such that o1.equals(o2), what is java's standard convention about the relationship between o1.hashCode() == o2.hashCode()? Answer: o1.hashCode() == o2.hashCode() I don't know why..what i thought was since o1 and o2 are different objects, they shouldn't have the same hashCode. If what the question says were o1 == o2, then I would say they have the same hashCode since both o1 and o2 point to the same object. Can anyone point out what I did wrong?

cursor
tags question: http://stackoverflow.com/q/23716402
type: Tag
tag name: cursor

http://stackoverflow.com/q/23624799
favorite count: 0
tagged with: red5
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23625084
score: -2
accepted answer: http://stackoverflow.com/a/23625084
has body: I am just starting learning red5 server and I am confused what version of red5 should I use? I want to use the android app as a client for red 5.I have the following queries. Is it supported in red5 version 1.0.1. What the the benefits/new features of using red5 version 1.0.2?Is it stable? Are there any cons of using red5 version 1.0.1.(If the answer to my first question is yes)?
downvote count: 2
has title: what are the new features in the red5 1.0.2?what are the pros and cons of using red5 1.0.1 instead?
answer count: 1

http://stackoverflow.com/comment/36296190
type: QuestionComment
has text: `public static void main(String[] args)` Main must have this signature which requires a String, not your custom object (you can change the variable name args to anything however). Also, see the other allowed signature from assylias's answer.
comment on: http://stackoverflow.com/q/23636628
score: 2
type: Comment

http://stackoverflow.com/comment/36543954
has text: Not sure about mac. Never used one. Google it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23765513
type: Comment

http://stackoverflow.com/comment/36392657
has text: Yes; I've added to my answer.
comment on: http://stackoverflow.com/a/23686239
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23739966
has answer: http://stackoverflow.com/a/23740047
tagged with: java
type: Question
downvote count: 4
has answer: http://stackoverflow.com/a/23741360
upvote count: 0
has answer: http://stackoverflow.com/a/23740042
tagged with: arrays
has comment: http://stackoverflow.com/comment/36494431
possible better answer: http://stackoverflow.com/a/23740577
has answer: http://stackoverflow.com/a/23740577
favorite count: 0
has body: I have a list of file names to be used to open images in another class, public String[] getImages(){ for(int i=0;i&lt;50;i++){ fileNames[i]= allData[i][10]; } return fileNames; } then in another class, I have a FlowPane which I'm trying to fill with an array of images: String fileNames[] = new string [50]; fileNames = readAllCards.getFileNames(); Image card[] = new Image[50]; for (int i = 0; i &lt; 50; i++) { card[i] = new Image(fileName[i]); } I know this code is wrong, but it's what I'm trying to do, I'm just struggling with getting an array from another class and then I think my array of images will work after that.
has comment: http://stackoverflow.com/comment/36494387
accepted answer: http://stackoverflow.com/a/23741360
score: -4
has title: get an array from another class in java
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/36386273
comment on: http://stackoverflow.com/a/23670839
type: AnswerComment
type: Comment
has text: I tried your solution but it marks Node with the following error: Incorrect number of arguments for type Node<T,N>; it cannot be parameterized with arguments <T>
score: 0

http://stackoverflow.com/comment/36566300
has text: According to the Java 7 documentation I should be able to use CBC-SHA384, but that is not the case as only SHA1 is available. Running Tomcat with Java 8 is the same.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23763563
type: AnswerComment

http://stackoverflow.com/comment/36302346
has text: But can you tell me about toggle of state. Isn't it the default behavior of check box?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23639422
type: Comment

http://stackoverflow.com/a/23750350
has comment: http://stackoverflow.com/comment/36514625
type: Answer
score: 1
upvote count: 1
has body: There are several problems with your implementation. First: You keep reassigning the ll array! This line: ll = new LinkedList[i][j]; assigns the ll array to a NEW array of size i,j. That's why the first if passes but the second if does not. Replace every instance of ll = new LinkedList[i][j]; with ll[i][j] = new LinkedList(...); Second, these lines: if (ll[i][j] == null) { ll = new LinkedList[i][j]; } else if (ll[j][i] == null) { ll = new LinkedList[j][i]; } else { ll[i][j].add(al.add(s)); } may not do what you think they do. If you're trying to ensure that, no matter what order you use i and j to index the 2D array, you do not get a null pointer error; this won't work. If the first if passes each of the other ifs (and the last else) are skipped. You may want to remove every else if this is a problem. Third you're using a non-generic version of ArrayList and LinkedList. This greatly reduces your type saftey and could produce several hard to track bugs. Fourth, this line: System.out.println(ll.toString()); Is going to cause you problems. ll is an array so you're going to get something like: [[Ljava.util.LinkedList;@5a07e868 To fix this, you need to write your own twoDArrayToString function. Here's a simple implementation: public static String twoDArrToString(Object[][] arr) { System.out.println(arr.length); StringBuilder sb = null; if (arr.length &gt; 0) { sb = new StringBuilder(arr.length * arr[0].length);//Making it a tiny bit more efficient } else { return "";//Doesn't make sense to have a zero length array } for (Object[] objArr : arr) { sb.append("["); for (Object obj : objArr) { sb.append(obj).append(", "); } sb.append("]\n"); } return sb.toString(); } Also, as CyberneticTwerkGuruOrc mentioned, you're adding an ArrayList to a LinkedList. Are you trying to go 4D on us? Hope that helps!
has comment: http://stackoverflow.com/comment/36514697
accepted answer of: http://stackoverflow.com/q/23749962
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23749962

http://stackoverflow.com/comment/88197765
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23665502
has text: As for your second question, either of these would achieve your `times(int)` functionality: `Stream.generate(() -> base).limit(n - 1)` or `Collections.nCopies(n - 1, base).stream()`.
score: 0

http://stackoverflow.com/q/23744064
has comment: http://stackoverflow.com/comment/36502615
has comment: http://stackoverflow.com/comment/36502663
has comment: http://stackoverflow.com/comment/36502647
score: 1
tagged with: java
has body: I'm generating a KML file and at the point where I use the transformer API, I get the NullPointerException exception. Here's the code I'm refering too: TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(kml); StreamResult result = new StreamResult(new File("src/mapa/mapa.kml")); System.out.print("DESPRES DE CREAR RESULT\n"); if(source == null) System.out.print("SOURCE IS NULL"); if(result == null) System.out.print("RESULT IS NULL"); transformer.transform(source, result); System.out.print("AFTER TRASNFORM\n"); It doesn't print any of the NULL System.outs, however it doesn't print the last one either. Why is it giving me NPE? Exception: DESPRES DE CREAR RESULT ERROR: '' javax.xml.transform.TransformerException: java.lang.NullPointerException at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source) at Joc.crearMapa(Joc.java:199) at MastersOfWar.main(MastersOfWar.java:18) Caused by: java.lang.NullPointerException at com.sun.org.apache.xml.internal.serializer.ToUnknownStream.characters(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source) ... 4 more --------- java.lang.NullPointerException at com.sun.org.apache.xml.internal.serializer.ToUnknownSt…
type: Question
linked to: http://stackoverflow.com/q/218384
downvote count: 0
has title: transform returning null pointer exception but the parameters arent null?
tagged with: kml
tagged with: transformer-model
has comment: http://stackoverflow.com/comment/36502754
tagged with: nullpointerexception
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36502582
favorite count: 0
has comment: http://stackoverflow.com/comment/36502602
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23744132
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36502322

http://stackoverflow.com/a/23772808
has comment: http://stackoverflow.com/comment/36629836
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36583699
downvote count: 1
has comment: http://stackoverflow.com/comment/36557945
answers question: http://stackoverflow.com/q/23772738
has body: I would use the split function in the String class which returns an array based on splitting the string on a particular regex input. consider for example the following String String input="hello.world"; // use different delimeters // splitting the input based on a comma String[] test = input.split(","); // test will now have the value test[0] = hello , test[1]= world int length = test.length - 1 // test.length = 2, you need to subtract 2 because the length of the array will always be 1 more than the number of occurences, so if the number of occurances is n the length of the array is n+1. You can similarly split based on other characters.
score: -1

http://stackoverflow.com/comment/36565398
comment on: http://stackoverflow.com/q/23757418
score: 0
has text: Err, now that I look more closely, this is a 4x4 kernel. Why are you doing this lop-sided? I think your loop should actually ***include*** I,j=2 rather than *ending* there. Ideally it would be split into two passes, so just I [-2,2] = 5 fetches per pass.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36270108
has text: JavaScript cannot access session variables. Respond with the required updates the body of the response.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23622672
score: 0

http://stackoverflow.com/a/23745249
answers question: http://stackoverflow.com/q/23745089
score: 0
has body: To remove all the empty strings and those that only contain whitespace from the list: Iterator&lt;String&gt; it = list.iterator(); while (it.hasNext()) { String s = it.next(); if (s.matches("^\\s*$")) { it.remove(); } }
type: Answer

http://stackoverflow.com/comment/36454986
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23719191
has text: Yes, but you'll still need to assign a reference to an implementation of the interface. If you're getting a NullPointerException you've not passed a valid reference to the class constructor

http://stackoverflow.com/q/23653758
tagged with: single-sign-on
answer count: 0
type: UnansweredQuestion
has title: WebView and httpClient
score: 1
has body: In android, I am trying to integrate Single-SignOn(SAML). For athentication webview is used and it prompt the user to enter username and password. After varify it returns the token embedded in html body.Now how can i get that token out of html body If I USE httpClient and making the webview cookie sync so that it work fine on HttpClient.
tagged with: java
type: Question
upvote count: 1
downvote count: 0
tagged with: httpclient
favorite count: 0
tagged with: android

http://stackoverflow.com/q/23659138
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23659391
has comment: http://stackoverflow.com/comment/36340801
type: Question
tagged with: decode
accepted answer: http://stackoverflow.com/a/23659391
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has title: How to get all values from JSONObject created with ArrayList ?
tagged with: android
upvote count: 2
has body: I am trying to get values from a json data with AsyncTask. I am getting only the last value and I don't understand why... I tryed to parse with for each, while but I am doing something wrong : Here is my code : private class DecodeData extends AsyncTask&lt;String, Void, String&gt; { protected ArrayList&lt;HashMap&lt;String, String&gt;&gt; decodedArray; protected HashMap&lt;String, String&gt; decodedMap; protected Iterator&lt;String&gt; it; protected JSONArray m_Array; protected JSONObject object; protected String response; protected String keys; protected String value; @SuppressWarnings("unchecked") @Override protected String doInBackground(String... params) { response = params[0]; keys = ""; value = ""; object = null; decodedArray = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); try { JSONArray arrayResp = new JSONArray(response); for (int i = 0; i &lt; arrayResp.length(); i++) { decodedMap = new HashMap&lt;String, String&gt;(); it = arrayResp.getJSONObject(i).keys(); while (it.hasNext()) { keys = (String)it.next(); value = Base64.DecodeStrToStr((String)arrayResp.getJSONObject(i).get(keys)); decodedMap.put("\""+keys+"\"", "\""+value+"\""); object = new JSONObject(decodedMap.toString()); Log.i("DECODED MAP : ", object.toString()); m_Array = new JSONArray(); m_Array.put(object); Log.i("M_ARRAY", ""+m_Array); } // decodedArray.add(decodedMap); } } catch (JSONException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // array = new JSONArray(decodedArray); return m_Array.toString(); } I am using Volley to get response. After that, I create a JSONArray with this response and I get all keys/values from it. I put all of them in my Hashmap. But when i'm putting keys/values here : m_Array.put(object), it puts only the last value of my json data. Anybody has an idea of what I'm making wrong ?
has comment: http://stackoverflow.com/comment/36340476
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36340727
tagged with: java

http://stackoverflow.com/q/23655201
has comment: http://stackoverflow.com/comment/36332381
has comment: http://stackoverflow.com/comment/36332349
has comment: http://stackoverflow.com/comment/36332569
type: UnansweredQuestion
has title: Symbol not found error
has comment: http://stackoverflow.com/comment/36333211
has body: I am doing a project for school. In that project there were various classes given to me, with the task to complete them. One of my classes Orbita, creates an object from another Graficos. Graficos was given to me completed but as bytecode, not as source. When I try to compile it, it gives me the following error the symbol not found error every time Orbita uses the class Graficos. It gives my an error on every time it has Graficos. (..) C:\Users\user1\Desktop\loll\trabalho (1)&gt;javac -cp ptplot5.8:. *.java Orbita.java:206: error: cannot find symbol Graficos.mostraGrafico(vectorParaGrafico, legendas); ^ symbol: variable Graficos location: class Orbita Orbita.java:230: error: cannot find symbol Graficos.mostraGrafico(vectorParaGrafico, ^ symbol: variable Graficos location: class Orbita Orbita.java:262: error: cannot find symbol Graficos.mostraGrafico(vectorParaGrafico, legendas); ^ symbol: variable Graficos location: class Orbita Orbita.java:283: error: cannot find symbol Graficos.mostraGrafico(vectorParaGrafico, ^ symbol: variable Graficos location: class Orbita 4 errors C:\Users\user1\Desktop\loll\trabalho (1)&gt; My code: public void projecta2D(int coordX, int coordY) { double[][] vectorParaGrafico = new double[iteracoes + 1][2]; for (int k = 0; k &lt;= iteracoes; k++) { vectorParaGrafico[k][0] = registo[k].getCoordenada(coordX); vectorParaGrafico[k][1] = registo[k].getCoordenada(coordY); } Graficos.mostraGrafico(vectorParaGrafico, new String[]{"coordenada 1", "coordenada 2", "orbita"}); } public void serieTemporal(int coordenada, int inicio, int fim, String[] legendas) { if (inicio &lt; 0) inicio = 0; if (fim &gt; iteracoes) fim = iteracoes; double[][] vectorParaGrafico = new double[fim - inicio + 1][2]; for (int k = inicio; k &lt;= fim; k++) { vectorParaGrafico[k][0] = k; vectorParaGrafico[k][1] = registo[k].getCoordenada(coordenada); } Graficos.mostraGrafico(vectorParaGrafico, legendas); }
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36332471
type: Question
has comment: http://stackoverflow.com/comment/36332618
has comment: http://stackoverflow.com/comment/36333488
score: 0

http://stackoverflow.com/q/23626909
type: Question
has comment: http://stackoverflow.com/comment/36523921
has comment: http://stackoverflow.com/comment/36314195
has comment: http://stackoverflow.com/comment/36522038
has title: Obfuscating android jar throws unreferenced android.R$layout error
has comment: http://stackoverflow.com/comment/36372073
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36523783
tagged with: proguard
has comment: http://stackoverflow.com/comment/36476577
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23627131
tagged with: android
has comment: http://stackoverflow.com/comment/36277260
has comment: http://stackoverflow.com/comment/36295385
has comment: http://stackoverflow.com/comment/36290277
has comment: http://stackoverflow.com/comment/36302837
tagged with: java
has comment: http://stackoverflow.com/comment/36298823
has body: I have an Android library project, the jar of which I want to obfuscate before distribution. This library supports view and layouts, hence when I use Proguard to obfuscate the jar file it throws below warnings for all the classes that support UI creation and fails obfuscating. Below is the warning for one such file: Warning:com.event.android.eventui: can't find referenced class com.event.android.R$layout Warning:com.event.android.eventui: can't find referenced class com.event.android.R$id Warning:com.event.android.eventui: can't find referenced class com.event.android.R$string Warning:com.event.android.eventui: can't find referenced class com.event.android.R I have used proguard GUI tool (\android-sdk\tools\proguard\bin). The references and solutions I got for library obfuscation didn't have the ui angle, hence haven't found any solution yet. Below is the proguard configuration file: -outjars 'C:\Projects\event\eventpro.jar' -injars 'C:\Projects\event\event.jar' -libraryjars 'C:\android\android-sdk\platforms\android-19\android.jar' -libraryjars 'C:\android\android-sdk\extras\android\support\v4\android-support-v4.jar' -dontskipnonpubliclibraryclassmembers -dontshrink -dontoptimize -verbose -keep class public class **.R { *; } -keepclassmembers class class **.R$* { public static &lt;fields&gt;; } # Keep - Applications. Keep all application classes, along with their 'main' # methods. -keepclasseswithmembers public class * { public static void main(java.lang.String[]); } # Keep - Library. Keep all public and protected classes, fields, and methods. -keep public class * { public protected &lt;fields&gt;; public protected &lt;methods&gt;; } # Also keep - Enumerations. Keep the special static methods that are required in # enumeration classes. -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # Also keep - Serialization code. Keep all fields and methods that are used for # serialization. -keepclassmembers class * extends j…

http://stackoverflow.com/q/23621419
answer count: 1
has answer: http://stackoverflow.com/a/23622034
has comment: http://stackoverflow.com/comment/36267355
tagged with: service
has title: Starting an application/service on phone startup android (the correct way)
tagged with: boot
tagged with: android
has body: I saw some other posts about how to start your application on phone start but it might be annoying for the user to see the application pop up each time. What I would rather do is start a service and check to see if I should start up and keep the app up or shut it down. My question is how can I accomplish something like this or the "correct" way to do it i.e. is it better to start a service or the app?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36267384
tagged with: java
accepted answer: http://stackoverflow.com/a/23622034
type: Question
has comment: http://stackoverflow.com/comment/36267291
has comment: http://stackoverflow.com/comment/36267333
score: 0

http://stackoverflow.com/comment/36566983
type: Comment
has text: Change that title, seriously.
comment on: http://stackoverflow.com/q/23777914
score: 5
type: QuestionComment

http://stackoverflow.com/q/23632653
has body: I try to generate a Heap Dump when a uncaught exception is fired. I tried using jmap, but because the process is finished when the exception happens this is not possible. Using a UncaughtExceptionHandler is no option either, because I only have the binaries of the programs that is executed. Can anyone help me? EDIT: It is important that the technique is available through a command line or similar, because I need to automated this. Using a GUI is no option
favorite count: 0
answer count: 3
type: UnansweredQuestion
has title: Generate Java Heap Dump on uncaught Exception
has answer: http://stackoverflow.com/a/23632841
has comment: http://stackoverflow.com/comment/36288377
has comment: http://stackoverflow.com/comment/36288359
has answer: http://stackoverflow.com/a/23632723
type: Question
upvote count: 5
tagged with: java
tagged with: heap-dump
linked to: http://stackoverflow.com/q/23561555
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/23640439
tagged with: jvm

http://stackoverflow.com/comment/36287241
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23632077
has text: Yes, only an assignment.
type: Comment

http://stackoverflow.com/comment/77738607
comment on: http://stackoverflow.com/a/25651631
type: Comment
score: 2
type: AnswerComment
has text: @Ankit- If I don't know the size of byte array after decompressing, what will be decompressedLength?

http://stackoverflow.com/comment/36422556
has text: How would the program know where the file is?
comment on: http://stackoverflow.com/a/23702225
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36559940
type: AnswerComment
type: Comment
has text: thanks, I will try to verify that, but it might take sometime to test it for me, therefore, answer vote will be slow
comment on: http://stackoverflow.com/a/23773980
score: 0

http://stackoverflow.com/comment/36471144
has text: @dave it is an array of alphabet 'a' - 'z' The code is written as : `char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23727346

http://stackoverflow.com/q/23688063
downvote count: 0
has body: When using the maven-jar-plugin I would like to add entry to the Manifest.mf So it will contain: Class-Path: . When i add this entry to the Pom: . It will create Class-Path with all dependency Like: Class-Path: . jar1name.jar jar2name.jar etc Instead of just Class-Path: . Is there a way to avoid maven from adding all jar names to the Class-Path? Thanks org.apache.maven.plugins maven-jar-plugin true Me .
accepted answer: http://stackoverflow.com/a/23688819
favorite count: 0
tagged with: maven
type: AnsweredQuestion
upvote count: 19
tagged with: java
score: 19
has comment: http://stackoverflow.com/comment/36396337
type: Question
has answer: http://stackoverflow.com/a/23688819
tagged with: manifest
has comment: http://stackoverflow.com/comment/36397201
has title: How to add Class-Path to the manifest file with maven
answer count: 1

recursion
type: Tag
tags question: http://stackoverflow.com/q/23651180
tags question: http://stackoverflow.com/q/23717543
tag name: recursion
tags question: http://stackoverflow.com/q/23776573
tags question: http://stackoverflow.com/q/23617064
tags question: http://stackoverflow.com/q/23660913
tags question: http://stackoverflow.com/q/23688521
tags question: http://stackoverflow.com/q/23725274
tags question: http://stackoverflow.com/q/23712737
tags question: http://stackoverflow.com/q/23745658
tags question: http://stackoverflow.com/q/23627343
tags question: http://stackoverflow.com/q/23744913
tags question: http://stackoverflow.com/q/23755653

http://stackoverflow.com/q/23631144
answer count: 2
downvote count: 3
upvote count: 1
has title: how to create multiple pdf with jdbc or xml in java
tagged with: http://stackoverflow.com/tag/pdf
has body: I Have some values associated with id i want to print those values with respective id's in pdf format, values can be in database or in some variable , can anyone suggest me which way i should go... i have some ideas either i can save those values in database and can make a single xml file from database of all records and then divide each node with different different pdf or directly get the values from database and generate the pdf so please anyone suggest me ideas and ways also if you can refer some links then most welcome please try to help me here..... public class PDFGenerator extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { try { Connection con = ConnectionManager.getConnection(); Statement st4= con.createStatement(); ResultSet rs1 = st4.executeQuery("select count(*) from salary"); while(rs1.next()) { int p = Integer.parseInt(rs1.getString(1)); System.out.println("saurabh :" +p); for(int q=1;q&lt;=p;q++) { Document document=new Document(); PdfWriter.getInstance(document,new FileOutputStream("c:/temp/salary.pdf")); document.open(); PdfPTable table = new PdfPTable(2); table.addCell("eid"); table.addCell("salary"); Statement st3= con.createStatement(); ResultSet rs = st3.executeQuery("select * from salary where eid ='"+q+"'"); while(rs.next()) { table.addCell(rs.getString("eid")); table.addCell(rs.getString("salary")); } document.add(table); document.close(); } } } catch (Exception e) { System.out.println(e); } }} please anyone help me here....its printing last row only because its dealing with same pdf and again values are getting over written so please anyone help me how to generate pdf with multiple names so i can store in the same folder... with different name ....
favorite count: 0
has comment: http://stackoverflow.com/comment/36458671
possible better answer: http://stackoverflow.com/a/23631637
accepted answer: http://stackoverflow.com/a/23782355
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36338012
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23782355
type: Question
has answer: http://stackoverflow.com/a/23631637
score: -2
has comment: http://stackoverflow.com/comment/36489317
has comment: http://stackoverflow.com/comment/36285537

http://stackoverflow.com/a/23641540
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36343182
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23640579
has body: Check out Backgrounds With Transparency. Maybe you can use the AlphaContainer class. Basically when you want to use a transparent background then you must make your component non-opaque and override the paintComponent() method to do the painting of the background. The AlphaContainer does this for you.
accepted answer of: http://stackoverflow.com/q/23640579

database-cursor
tags question: http://stackoverflow.com/q/23775175
tag name: database-cursor
type: Tag

http://stackoverflow.com/q/23745518
tagged with: hprof
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12314762
has title: Where is the hadoop task's hprof data stored when using oozie workflow - measuring memory usage
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36508121
tagged with: mapreduce
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/23792637
has body: I've followed the instructions in the hadoop definitive guide (also mentioned here How to check memory footprint of Map Task in Hadoop). However, after the task is finished, I can't find any data to look at. In the book it says that the data is moved to where the client is ran from...I'm using oozie workflow, I wonder where is the hprof data moved to in my case?
has comment: http://stackoverflow.com/comment/36509386

http://stackoverflow.com/a/23896698
downvote count: 1
has body: We need only to traverse the Zeros, in order to find the number of total crossings. No need to run extra code for Ones, because the number of crossings for every Zero we check, is equal to the number of crossings we get, when we check all Ones for that particular Zero. public class passingCars { public static void main(String[] args) { int k; int cnt = 0; // Test array int[] A = { 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1 }; for (int i = 0; i &lt; A.length; i++) { if (A[i] == 0) { k = i + 1; while (k &lt; A.length) { if (A[k] == 1) { cnt++; } k++; } } } System.out.println(cnt); } } result: 17
type: Answer
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23774985

http://stackoverflow.com/a/23629876
answers question: http://stackoverflow.com/q/23627340
type: Answer
downvote count: 0
score: 13
has comment: http://stackoverflow.com/comment/36291460
has body: Each FXML file is not necessarily a new Scene. A fxml is just a view file with its root element as any of the Layouts provided by Javafx. It may have multiple Layouts(as a part of the root layout) and controls depending on your requirement. To know more about fxml, you can view Java vs JavaFX Script vs FXML. Which is better way of programming in JavaFX? Tutorial on FXML http://docs.oracle.com/javafx/2/fxml_get_started/jfxpub-fxml_get_started.htm Now, once your FXML is ready, you can load it in different ways : Load as a root of your scene Load as a part of the already loaded LAYOUT Load as the root of the new Scene and assign it to the current stage To help you understand the above points here is an example for each of them. Here, I am demonstrating a LoginController class which is a Controller for loading the FXML. Example - 1 FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("root.fxml")); AnchorPane login = (AnchorPane) loader.load(); Scene scene = new Scene(login); Example - 2 FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("root.fxml")); AnchorPane login = (AnchorPane) loader.load(); BorderPane borderPane = (BorderPane)scene.getRoot(); borderPane.setCenter(login); Example - 3 FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("root.fxml")); AnchorPane login = (AnchorPane) loader.load(); Scene scene = new Scene(login); stage.setScene(scene);//Stage loads the new scene, which has the layout of the fxml N.B. For more details on how to access Stage/Scene on different controllers please go through https://community.oracle.com/message/11251866
has comment: http://stackoverflow.com/comment/36291688
has comment: http://stackoverflow.com/comment/36291185
has comment: http://stackoverflow.com/comment/58307365
upvote count: 13
has comment: http://stackoverflow.com/comment/89634041

http://stackoverflow.com/q/23743370
has body: I am trying to parse JSON using a Notes agent, JSON is fetched using Apache HttpClient. Here is the code that return the JSON import lotus.domino.*; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; Session session = getSession(); AgentContext agentContext = session.getAgentContext(); HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet("http://api.acme.com/customer"); request.addHeader("accept", "application/json"); request.addHeader("Host", "api.acme.com"); request.addHeader("X-Api-Version", "1.0"); request.addHeader("Authorization", "Basic ..."); HttpResponse response = client.execute(request); The JSON Looks like this. [ { "id": 123456, "insertDate": "2014-05-12T16:51:38.343", "read": false, "site": "acme.com", "Email": "john.doe@acme.com", "location": "/customer/1212?v=1.0" } ] I have tried to use JSONObject and JSONArray from JSON.org but could not get it to work I need some example code from the json.org package or other ways to parse the json.
favorite count: 0
score: 8
tagged with: parsing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36501101
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/23743763
has title: Parsing JSON from HttpClient request using JSON.org parser
answer count: 1
downvote count: 0
tagged with: xpages
has comment: http://stackoverflow.com/comment/88378141
accepted answer: http://stackoverflow.com/a/23743763
tagged with: apache-httpclient-4.x
upvote count: 8

http://stackoverflow.com/q/23776364
has comment: http://stackoverflow.com/comment/36566942
tagged with: java
linked to: http://stackoverflow.com/q/1402005
downvote count: 1
has comment: http://stackoverflow.com/comment/36565699
type: Question
has comment: http://stackoverflow.com/comment/36564944
tagged with: c#
tagged with: network-programming
score: -1
has comment: http://stackoverflow.com/comment/36566623
has title: How to detect internet access?
has comment: http://stackoverflow.com/comment/36568494
linked to: http://stackoverflow.com/q/1139547
upvote count: 0
answer count: 1
has body: I need to create a reliable test to see if the current host can reach the public internet using HTTP (port 80) or HTTPS (port 443). This is not a programming language question. I got that part covered. My idea is that I'll test against something on the public internet that Is always alive Can respond to HTTP or HTTPS requests Can respond fast (I'm thinking I'll do a HEAD request to keep the reply small) Will exist also in a forseable future What would that endpoint be? Is there some official server that can make the above promises, e.g. something provided by w3.org ? (I know that people tend to use www.google.com or similar but doesn't sound to me to be a good solution, or?..). Further my thinking is: Not to use something like a ping test because ICMP is blocked by many firewalls. Probably needs to be a true HTTP/HTTPS request in order to go through a potential firewall. A plain socket test might give false result if there's a firewall in-between. So I'll do a true HTTP/HTTPS test. My HTTPS test will ignore certs because that's not what I want to test. No matter what I do I'll also indirectly be testing name resolution (unless I'm testing against an IP address which I find unlikely). This is ok. Name resolution is in any case also part of "internet connectivity". What would be the most reliable way to perform an internet connectivity test (I only care about HTTP and HTTPS) and which endpoint should I use ? I'm assuming that thousands of developers before me have tackled this. But how? UPDATE AND FINAL SOLUTION It seems I will not get anyone answering with an official endpoint to use for this purpose (perhaps there just isn't one?) so what I'll do is to send a HTTP HEAD request to google.com. My request will have HTTP header element cache-control: no-cache hoping to avoid any in-between proxies answering me from their own cache. I'll then repeat exactly the same test for HTTPS. There's no such thing as a perfect test but from my requirements the above is what seems t…
has comment: http://stackoverflow.com/comment/36568873
tagged with: connection
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23776946

http://stackoverflow.com/q/23627511
has body: What is the gain, if there is any, from doing this: for (int i = 0, size = foo.size(); i &lt; size; i++) {} instead of this: for (int i = 0 ; i &lt; foo.size(); i++) {} (foo is a List object)
has answer: http://stackoverflow.com/a/23627887
has answer: http://stackoverflow.com/a/23627559
type: Question
answer count: 2
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/23627887
downvote count: 0
has comment: http://stackoverflow.com/comment/36278637
has comment: http://stackoverflow.com/comment/36278401
accepted answer: http://stackoverflow.com/a/23627559
has comment: http://stackoverflow.com/comment/36278331
favorite count: 0
linked to: http://stackoverflow.com/q/477550
upvote count: 2
has comment: http://stackoverflow.com/comment/36278596
score: 2
has comment: http://stackoverflow.com/comment/36278653
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/36278340
has title: What is the gain from declaring for loop limit before the check?
tagged with: java
has comment: http://stackoverflow.com/comment/36278604

http://stackoverflow.com/q/23707562
downvote count: 0
has answer: http://stackoverflow.com/a/24278518
tagged with: macos
possible better answer: http://stackoverflow.com/a/23949387
favorite count: 0
has comment: http://stackoverflow.com/comment/36432796
has body: I have a Java application made with Swing and I have used one DJ Native Swing Browser. When I tried to use that on OS X its throwing a NoClassDefFoundError all the time even though I have added swt.jar. Can some one please tell me what I am doing wrong ? this is my stack trace. Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/eclipse/swt/SWT at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.initialize_(SWTNativeInterface.java:213) at chrriis.dj.nativeswing.swtimpl.NativeInterface.initialize(NativeInterface.java:71) at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.open_(SWTNativeInterface.java:337) at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:100) at com.verve.visdashboard.AttendanceEntry.OpenBrowser_Pool(AttendanceEntry.java:763) at com.verve.visdashboard.AttendanceEntry.AttendanceEntry_SubmitActionPerformed(AttendanceEntry.java:801) at com.verve.visdashboard.AttendanceEntry.access$300(AttendanceEntry.java:36) at com.verve.visdashboard.AttendanceEntry$9.actionPerformed(AttendanceEntry.java:682) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6414) at javax.swing.JComponent.processMouseEvent(JComponent.java:3275) at java.awt.Component.processEvent(Component.java:6179) at java.awt.Container.processEvent(Container.java:2084) at java.awt.Component.dispatchEventImpl(Component.java:4776) at java.awt.Container.dispatchEventImpl(Container.java:2142) at java.awt.Component.dispatchEvent(Component.java:4604) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618) at java.awt.Lightweig…
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24278518
tagged with: swt
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/8955638
has answer: http://stackoverflow.com/a/23949387
answer count: 2
tagged with: djnativeswing
has title: DJ Native Swing Browser in Java Swing For mac

http://stackoverflow.com/q/23732089
type: Question
has answer: http://stackoverflow.com/a/58371069
linked to: http://stackoverflow.com/q/72588523
has answer: http://stackoverflow.com/a/58700745
score: 76
possible better answer: http://stackoverflow.com/a/50138897
has answer: http://stackoverflow.com/a/50138897
upvote count: 76
linked to: http://stackoverflow.com/q/5273579
has body: In my app I have some async web services. Server accept request, return OK response and start processing request with AsyncTaskExecutor. My question is how to enable request scope here because in this processing I need to get class which is annotated by: @Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) Now I get exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.requestContextImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. because it runs in SimpleAsyncTaskExecutor and not in DispatcherServlet my async processing of request taskExecutor.execute(new Runnable() { @Override public void run() { asyncRequest(request); } }); where taskExecutor is: &lt;bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor" /&gt;
has answer: http://stackoverflow.com/a/57368912
downvote count: 0
answer count: 10
has answer: http://stackoverflow.com/a/65313320
linked to: http://stackoverflow.com/q/14986519
accepted answer: http://stackoverflow.com/a/33337838
linked to: http://stackoverflow.com/q/11675121
favorite count: 0
linked to: http://stackoverflow.com/q/3467918
has answer: http://stackoverflow.com/a/60966764
tagged with: spring
has answer: http://stackoverflow.com/a/26397399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/120014631
has title: How to enable request scope in async task executor
tagged with: java
has answer: http://stackoverflow.com/a/58865927
has answer: http://stackoverflow.com/a/58505857
has answer: http://stackoverflow.com/a/33337838

swing
tags question: http://stackoverflow.com/q/23627365
tags question: http://stackoverflow.com/q/23617127
tags question: http://stackoverflow.com/q/23768759
tags question: http://stackoverflow.com/q/23655348
tags question: http://stackoverflow.com/q/23717382
tags question: http://stackoverflow.com/q/23615996
tags question: http://stackoverflow.com/q/23721908
tags question: http://stackoverflow.com/q/23687897
tags question: http://stackoverflow.com/q/23711776
tags question: http://stackoverflow.com/q/23725554
tags question: http://stackoverflow.com/q/23628746
tags question: http://stackoverflow.com/q/23755630
tags question: http://stackoverflow.com/q/23712809
tags question: http://stackoverflow.com/q/23717475
tags question: http://stackoverflow.com/q/23653739
tags question: http://stackoverflow.com/q/23757183
tags question: http://stackoverflow.com/q/23706064
tags question: http://stackoverflow.com/q/23700460
tags question: http://stackoverflow.com/q/23715057
tags question: http://stackoverflow.com/q/23691474
tags question: http://stackoverflow.com/q/23712290
tags question: http://stackoverflow.com/q/23665784
tags question: http://stackoverflow.com/q/23675209
tags question: http://stackoverflow.com/q/23686660
tags question: http://stackoverflow.com/q/23686904
tags question: http://stackoverflow.com/q/23720248
tags question: http://stackoverflow.com/q/23742187
tags question: http://stackoverflow.com/q/23667478
tags question: http://stackoverflow.com/q/23767449
tags question: http://stackoverflow.com/q/23626339
tags question: http://stackoverflow.com/q/23723945
tags question: http://stackoverflow.com/q/23703787
tags question: http://stackoverflow.com/q/23726935
tags question: http://stackoverflow.com/q/23636984
tags question: http://stackoverflow.com/q/23674458
tags question: http://stackoverflow.com/q/23643600
tags question: http://stackoverflow.com/q/23654026
tags question: http://stackoverflow.com/q/23746167
tags question: http://stackoverflow.com/q/23729029
tags question: http://stackoverflow.com/q/23699767
tags question: http://stackoverflow.com/q/23772701
tags question: http://stackoverflow.com/q/23746804
tags question: http://stackoverflow.com/q/23707748
tags question: http://stackoverflow.com/q/23697944
tags question: http://stackoverflow.com/q/23762034
tags question: http://stackoverflow.com/q/23644698
tags question: http://stackoverflow.com/q/23622400
tags question: http://stackoverflow.com/q/23724401
tags question: http://stackoverflow.com/q/23676560
tags question: http://stackoverflow.com/q/23623577
tags question: http://stackoverflow.com/q/23628914
tags question: http://stackoverflow.com/q/23769423
tags question: http://stackoverflow.com/q/23726474
tags question: http://stackoverflow.com/q/23707808
tags question: http://stackoverflow.com/q/23741794
tags question: http://stackoverflow.com/q/23642001
tags question: http://stackoverflow.com/q/23772951
tags question: http://stackoverflow.com/q/23630495
tags question: http://stackoverflow.com/q/23689880
tags question: http://stackoverflow.com/q/23643146
tags question: http://stackoverflow.com/q/23652017
tags question: http://stackoverflow.com/q/23701365
tags question: http://stackoverflow.com/q/23717665
tags question: http://stackoverflow.com/q/23713392
tags question: http://stackoverflow.com/q/23766475
tags question: http://stackoverflow.com/q/23767232
tags question: http://stackoverflow.com/q/23704024
tags question: http://stackoverflow.com/q/23649810
tags question: http://stackoverflow.com/q/23646297
tags question: http://stackoverflow.com/q/23702158
tags question: http://stackoverflow.com/q/23714810
tags question: http://stackoverflow.com/q/23646561
tags question: http://stackoverflow.com/q/23616037
tags question: http://stackoverflow.com/q/23722081
tags question: http://stackoverflow.com/q/23711664
tags question: http://stackoverflow.com/q/23768368
tags question: http://stackoverflow.com/q/23679321
tags question: http://stackoverflow.com/q/23626951
tags question: http://stackoverflow.com/q/23729845
tags question: http://stackoverflow.com/q/23695985

http://stackoverflow.com/q/23685397
tagged with: bash
possible better answer: http://stackoverflow.com/a/23686591
has body: I would like to occasionally, via a shell script, take java thread dumps and append them to a file while also allowing them to go to catalina.out which is where FD 1 is pointed to for the Java process. I tried kill -3 $(pidof java) |tee -a /dumpfile but ended up with an empty file because Java's STDOUT is not my script's controlling terminal. Is there any way to do this without closing the Java process and reopening it with its output redirected? Linux with bash shell.
has answer: http://stackoverflow.com/a/23686591
has answer: http://stackoverflow.com/a/23704716
has title: Performing redirection on a process not in the controlling terminal
tagged with: io-redirection
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23704716
type: Question
score: 0
answer count: 2

http://stackoverflow.com/q/23642562
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36309482
has answer: http://stackoverflow.com/a/23643183
has body: I'm creating an android app on eclipse. When I start my activity I've made it play music (song1.wav)in the background. However how could I change it so that it plays a list of songs in a random order? Here's my code: public class BCTR extends Activity { protected MediaPlayer song1MediaPlayer; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_bctr); Button homebutton = (Button) findViewById(R.id.homebtn); final AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); int curVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); SeekBar volControl = (SeekBar)findViewById(R.id.volbar); volControl.setMax(maxVolume); volControl.setProgress(curVolume); volControl.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar arg0) { } @Override public void onStartTrackingTouch(SeekBar arg0) { } @Override public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) { audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, arg1, 0); } }); song1MediaPlayer = MediaPlayer.create(BCTR.this, R.raw.song1); song1MediaPlayer.start(); homebutton.setOnClickListener(new OnClickListener() { public void onClick(View v) { song1MediaPlayer.stop(); Intent intent = new Intent(BCTR.this, MainActivity.class); startActivity(intent); } }); // TODO Auto-generated method stub } } So basically I'd have song1 - song10 in my raw folder and I'd want them all to play when the activity starts but in a random order.
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/36308723
has title: Java random MediaPlayer playlist
has comment: http://stackoverflow.com/comment/36308537
answer count: 1
tagged with: media-player
score: 0

http://stackoverflow.com/comment/36501703
has text: You're right, .equals() of two the same Modules returns false. I'll have to override the equals
type: Comment
comment on: http://stackoverflow.com/q/23743162
score: 0
type: QuestionComment

http://stackoverflow.com/q/23712731
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/36442231
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23712765
accepted answer: http://stackoverflow.com/a/23712765
has comment: http://stackoverflow.com/comment/36442202
tagged with: maven
has title: How to stop Maven to mess with my directory layout and its properties?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36442243
has body: I have src directory marked as source root. After adding new dependency in pom.xml Maven marks src as standard/regular directory and then sets java directory as source root (which is located under src folder: src/main/java). It makes all package declarations in my classes to become invalid. How to configure maven to stop doing that?
tagged with: java
has comment: http://stackoverflow.com/comment/36442226

http://stackoverflow.com/comment/36452044
type: QuestionComment
has text: Hoping that it will not disappoint or discourage you too much: There's so much "not right" with the code that it's hard to give an answer that fits on a Q&A site. You may start by creating a `List<Rectangle>` and fill this list with rectangles that correspond to all these `drawRect` calls. This list can then be used to replace the `drawRect` calls (you can just iterate over the list with a loop, and call `drawRect` for each element of the list), and later it can be used for collision detection, using `if (rectangle.intersects(playerRectangle))`. Then, you may write more focussed question.
comment on: http://stackoverflow.com/q/23717475
score: 0
type: Comment

http://stackoverflow.com/a/23624679
answers question: http://stackoverflow.com/q/23624121
has body: I would suggest you to use variable names with some meaning. Your names like k, v are terrible to understand Instead of firstNode =k; should be firstNode.next =k; but it's better to rewrite with proper names. Like this DListNode next=firstNode.next; DListNode newOne=new DListNode(e,next,firstNode); firstNode.next =newOne; next.prev=newOne;
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23624121
downvote count: 0
score: 1

http://stackoverflow.com/q/23772837
has title: How to display the next text lines once user presses the next button?
has comment: http://stackoverflow.com/comment/36557940
favorite count: 0
has comment: http://stackoverflow.com/comment/36558225
has answer: http://stackoverflow.com/a/23772869
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36558760
has comment: http://stackoverflow.com/comment/36571611
tagged with: swing
has comment: http://stackoverflow.com/comment/36558491
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36558140
has comment: http://stackoverflow.com/comment/36557824
type: Question
has comment: http://stackoverflow.com/comment/36558616
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/36558064
has body: I am trying to create a program which allows the user to choose a text file from their directory. That then gets displayed in a JTextArea within the Frame created using Swing. I've created a button with a action command that's supposed to allow the user once pressed to get the next text lines from the file, displayed within the text area until it reaches the end of file. To do that I used the sub-string command to go through the String variable and display it . But it seems to not to do that instead it just displays all the text found within the file. Below you will find the code that allows the program to open the file and display as well as the buttons created to aid in navigating through the text. package reader; public class Viewer extends JFrame{ private static final long serialVersionUID = 1L; private static JFrame Frame; private JPanel Cpanel; JScrollPane scrollPane; String book = ""; int currentChar = 10; static JTextArea textArea; JFileChooser fileChooser; File f; public static void DocViewer() { new Viewer("new document"); } public Viewer(String s) { Frame = new JFrame("Reader"); textArea = new JTextArea(20,60); textArea.setFont(new Font("Calibri", Font.PLAIN, 12)); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setEditable(false); scrollPane = new JScrollPane(textArea); f = new File("C://Program Files//Java//jdk1.6.0//bin//"); fileChooser = new JFileChooser(f); Frame.getContentPane().setBackground(Color.red); Frame.setLayout(new GridLayout(3, 1)); Cpanel = new JPanel(); Cpanel.setLayout(new FlowLayout()); Cpanel.setBackground(Color.RED); JButton StButton = new JButton("open"); JButton QButton = new JButton("back"); JButton TestButton = new JButton("next"); TestButton.setHorizontalTextPosition(SwingConstants.LEFT); StButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String book = ""; // int currentChar=10; int returnVal = fileChooser.showOpenDialog(Viewer.this); try { File file = fileChooser…
has comment: http://stackoverflow.com/comment/36557816
downvote count: 0
has comment: http://stackoverflow.com/comment/36558710
has comment: http://stackoverflow.com/comment/36558666
has comment: http://stackoverflow.com/comment/36559060
tagged with: file-io
has comment: http://stackoverflow.com/comment/36558340
tagged with: io
has comment: http://stackoverflow.com/comment/36558218
answer count: 1

http://stackoverflow.com/comment/36281872
type: Comment
type: QuestionComment
has text: Hey thanks a lot for your prompt replies but i was told that i could access it from a remote computer. I have a username and password but cannot share it on the public forum. I have a database table name but i am not sure how to append it to the url or do i even have to do that?
comment on: http://stackoverflow.com/q/23628761
score: 0

http://stackoverflow.com/q/23772990
downvote count: 0
has comment: http://stackoverflow.com/comment/36559132
favorite count: 0
has comment: http://stackoverflow.com/comment/36559429
has comment: http://stackoverflow.com/comment/36559294
has title: Find point with vector projection
has answer: http://stackoverflow.com/a/23773980
has comment: http://stackoverflow.com/comment/36558243
has answer: http://stackoverflow.com/a/23774532
type: UnansweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/36559273
has comment: http://stackoverflow.com/comment/36559321
score: 3
tagged with: algorithm
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/36558354
type: Question
linked to: http://stackoverflow.com/q/1073336
answer count: 2
has comment: http://stackoverflow.com/comment/36559285
has body: I am trying to work this out in java with LatLng point I was looking at this post here Circle line-segment collision detection algorithm? I have a method to find distance between 2 point. The instruction says Project the vector AC onto AB. The projected vector, AD, gives the new point D. If the distance between D and C is smaller than (or equal to) R we have an intersection. I don't have knowledge about vector, could anyone help me how to find point D here ? Thanks in advance

awt
tags question: http://stackoverflow.com/q/23620009
tags question: http://stackoverflow.com/q/23734695
tags question: http://stackoverflow.com/q/23774735
tags question: http://stackoverflow.com/q/23714267
tags question: http://stackoverflow.com/q/23709070
tags question: http://stackoverflow.com/q/23710181
tags question: http://stackoverflow.com/q/23645265
tag name: awt
tags question: http://stackoverflow.com/q/23656093
tags question: http://stackoverflow.com/q/23639618
tags question: http://stackoverflow.com/q/23696210
tags question: http://stackoverflow.com/q/23766770
tags question: http://stackoverflow.com/q/23641795
tags question: http://stackoverflow.com/q/23691544
tags question: http://stackoverflow.com/q/23667639
tags question: http://stackoverflow.com/q/23683036
tags question: http://stackoverflow.com/q/23739687
tags question: http://stackoverflow.com/q/23727523
type: Tag
tags question: http://stackoverflow.com/q/23702555
tags question: http://stackoverflow.com/q/23642854
tags question: http://stackoverflow.com/q/23652511
tags question: http://stackoverflow.com/q/23755630

http://stackoverflow.com/a/23621391
score: 2
accepted answer of: http://stackoverflow.com/q/23621245
has body: int k=nElems Start at the end. k &gt; j While we haven't reached the target position... a[k] = a[k-1]; Move the current element up one position to the right. k-- And move to the left. So, shift all elements between the target position and the end one position to the right. I thought arrays were immutable once created. The array size is fixed once created - the element at any index can be modified or reassigned however you see fit. What was probably done here - a larger array was created and nElems was used to indicate the number of populated values - the remaining indices would just be null. Wikipedia's article on dynamic arrays briefly mentions this - the concept of capacity versus size - the capacity would be a.length, the size would be nElems. This is identical to how an ArrayList works.
has comment: http://stackoverflow.com/comment/36267001
type: AcceptedAnswer
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23621245
type: Answer

http://stackoverflow.com/comment/36479327
score: 0
type: AnswerComment
has text: updated the main post, you've been a great help so far :) thanks a lot
comment on: http://stackoverflow.com/a/23723999
type: Comment

http://stackoverflow.com/a/23700482
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23700264
downvote count: 0
has comment: http://stackoverflow.com/comment/36425606
answers question: http://stackoverflow.com/q/23700264
has comment: http://stackoverflow.com/comment/36418895
type: Answer
has comment: http://stackoverflow.com/comment/36421449
has comment: http://stackoverflow.com/comment/36419422
score: 2
upvote count: 2
has body: You should take care with character classes ([]) as some chars inside are treated literally (as if they were escaped). Try this regex (demo here): ^((?:(?!\s\s).)+)(?:\s){4,}((?:(?!\s\s).)+)(?:\s){4,}((?:.(?!\s\s))+)$ I switched the (.*?) with ((?:(?!\s\s).)+) which will match everything up to a sequence of two spaces. I added a $ at the end, so it wouldn't match the lines with more than two columns. I also added some ?: so the groups would become non-matching groups. Finally, I removed the character class from the end of the regex and added a negative look-ahead. Columns not ending with spaces This one will not accept lines where the second column ends with spaces (demo here): ^((?:(?!\s\s).)+)(?:\s){4,}((?:(?!\s\s).)+)(?:\s){4,}((?:.(?!\s\s)(?!\s$))+)$ Notice the addition of a second negative look-ahead in the last group: (?!\s$).
has comment: http://stackoverflow.com/comment/36425512

http://stackoverflow.com/comment/36403777
score: 1
has text: @planker1010: Did you read that "How to debug small programs" link? I can help you debug, but *teaching* you how to debug is probably more valuable. There are half a dozen things wrong with this code -- you'll need to break it down into pieces and fix each one.
comment on: http://stackoverflow.com/q/23691732
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36432538
comment on: http://stackoverflow.com/a/23705722
score: 0
type: AnswerComment
has text: @raffian Exact test works fine for me. [Run this script](http://groovyconsole.appspot.com/script/3225001).
type: Comment

http://stackoverflow.com/a/23733812
score: 3
has body: The short answer is: "No, there is no way to manually add constraint violations". To elaborate a little bit. As you say, all classes involved are interfaces. If you really think you want to do it, you could implement your custom ConstraintViolationImpl. However, I am wondering what your actual use case is? Why do you want to add a constraint violation without validation? As the answer https://stackoverflow.com/a/23727169/115835 suggest, you could always go via a class level custom constraint. As part of isValid in your custom ConstraintValidator implementation, you get an ConstraintValidatorContext which will allow you to add additional constraint violations.
has comment: http://stackoverflow.com/comment/36491941
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/104737897
answers question: http://stackoverflow.com/q/23725707
type: Answer
accepted answer of: http://stackoverflow.com/q/23725707
upvote count: 3

http://stackoverflow.com/q/23748233
has title: java.lang.IllegalStateException Target host must not be null connecting to database
has answer: http://stackoverflow.com/a/23748712
tagged with: database
accepted answer: http://stackoverflow.com/a/23748712
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36511035
tagged with: android
tagged with: php
type: AnsweredQuestion
tagged with: java
has body: I am trying to connect to localhost/myfile.php on my computer. The PHP file converts database data into JSON which I want to parse after connecting. When I try to connect, I get Target host must not be null, or set in parameters. scheme=null, host=null, path=10.0.0.9/myfile.php Any ideas? public void getData(){ String result = ""; InputStream isr = null; try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("10.0.0.9/myfile.php"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); } catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); resultView.setText("Couldnt connect to database" + e);
tagged with: mysql
type: Question

http://stackoverflow.com/a/23719494
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36476901
has comment: http://stackoverflow.com/comment/36455848
has comment: http://stackoverflow.com/comment/36458456
has body: Yes, the parts of the implementation that you show are indeed safe. The supervisor strategy is invoked just like onReceive in the course of processing a message (namely the failure of the child actor) and therefore you can access the actor’s state from within its implementation, including reads and writes. Update (in response to question update): The supervisor strategy can only be invoked after the actor has created child actors. Since the actor is free to not create child actors until it has received the needed numRetries message, it can ensure that everything is properly set up before the first failure can occur. It should be noted that the supervisorStrategy method is used every time when a child signals a failure, which means that it is usually beneficial to cache the strategy in an instance variable. Upon reception of a new numRetries value the strategy could be replaced with a new one that is in effect from then on.
accepted answer of: http://stackoverflow.com/q/23713415
answers question: http://stackoverflow.com/q/23713415
downvote count: 0
has comment: http://stackoverflow.com/comment/36482043
score: 2
has comment: http://stackoverflow.com/comment/36469729
type: AcceptedAnswer

http://stackoverflow.com/q/23646793
tagged with: android-applicationinfo
tagged with: java
has comment: http://stackoverflow.com/comment/36316111
has comment: http://stackoverflow.com/comment/36317031
has answer: http://stackoverflow.com/a/23647377
possible better answer: http://stackoverflow.com/a/23647284
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23647284
accepted answer: http://stackoverflow.com/a/23647377
favorite count: 0
type: Question
has title: Unfortunately the application stopped working
tagged with: android
has body: I'm a beginner in android development.I have been looking for a week now. Followed all the tutorials word by word. Whenever I start my android emulator it first shows ProcessSystem isn't responding. Wait or Exit? Second the application loads but as soon as I click on the Register or Login button after filling out the form, after a few seconds of showing process dialog box, "Unfortunately the app has stopped working" is shown and it exits. My Login.java file is public class Login extends Activity implements OnClickListener{ private EditText user, pass; private Button mSubmit, mRegister; // Progress Dialog private ProgressDialog pDialog; // JSON parser class JSONParser jsonParser = new JSONParser(); private static final String LOGIN_URL = "http://localhost/webservice/login.php"; //JSON element ids from repsonse of php script: private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); //setup input fields user = (EditText)findViewById(R.id.username); pass = (EditText)findViewById(R.id.password); //setup buttons mSubmit = (Button)findViewById(R.id.login); mRegister = (Button)findViewById(R.id.register); //register listeners mSubmit.setOnClickListener(this); mRegister.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.login: new AttemptLogin().execute(); break; case R.id.register: Intent i = new Intent(this, Register.class); startActivity(i); break; default: break; } } class AttemptLogin extends AsyncTask&lt;String, String, String&gt; { boolean failure = false; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Login.this); pDialog.setMessage("Attempting login..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show…
has comment: http://stackoverflow.com/comment/36316133
score: -1
upvote count: 2
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/36317388

http://stackoverflow.com/comment/36544928
has text: Thank you! I feared as much; oh well, I guess I'm gonna be busy tonight.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23765376

http://stackoverflow.com/q/23732444
has comment: http://stackoverflow.com/comment/36490108
answer count: 2
possible better answer: http://stackoverflow.com/a/23732680
has comment: http://stackoverflow.com/comment/36519090
has comment: http://stackoverflow.com/comment/36480619
has answer: http://stackoverflow.com/a/23732680
has comment: http://stackoverflow.com/comment/36480888
has comment: http://stackoverflow.com/comment/36480616
score: 0
has comment: http://stackoverflow.com/comment/36480655
accepted answer: http://stackoverflow.com/a/23732521
has comment: http://stackoverflow.com/comment/36490751
has comment: http://stackoverflow.com/comment/36480749
linked to: http://stackoverflow.com/q/23361957
has comment: http://stackoverflow.com/comment/36480662
has comment: http://stackoverflow.com/comment/36480656
has title: the code doesn't stop running, in Java
has body: I'm solving problem 10 in project Euler in Java, which is "The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million." and my code is package projecteuler_1; import java.math.BigInteger; import java.util.Scanner; public class ProjectEuler_1 { public static void main(String[] args) { int sum = 0, i = 2; while (i &lt;= 2000000) { if (isPrime(i)) { sum += i; } i++; } System.out.println(sum); } public static boolean isPrime(int n) { int i, res; boolean flag = true; for (i = 2; i &lt;= n / 2; i++) { res = n % i; if (res == 0) { flag = false; break; } } return flag; } } but the code doesn't give me any results, it doesn't stop running. Why?
tagged with: primes
has comment: http://stackoverflow.com/comment/36480674
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36490583
has comment: http://stackoverflow.com/comment/36480704
has comment: http://stackoverflow.com/comment/36480686
has answer: http://stackoverflow.com/a/23732521
type: Question

http://stackoverflow.com/a/23639071
downvote count: 0
has comment: http://stackoverflow.com/comment/36301311
answers question: http://stackoverflow.com/q/23638880
type: Answer
score: 2
upvote count: 2
has body: Here is an example: String s = "Myserver/client/caseID/Title of Email here"; int i = s.lastIndexOf('/'); if (i != -1) System.out.println(s.substring(i)); else System.out.println("no slashes");
has comment: http://stackoverflow.com/comment/36301278

http://stackoverflow.com/a/23711487
accepted answer of: http://stackoverflow.com/q/23711430
answers question: http://stackoverflow.com/q/23711430
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/64614465
type: AcceptedAnswer
downvote count: 0
has body: You've forgotten to store the holder to the view. A null is returned when attempting to retrieve the holder when convertView is given for recycling. Add convertView.setTag(holder); to the block where you instantiate the holder.
has comment: http://stackoverflow.com/comment/64614761

http://stackoverflow.com/comment/36435212
has text: Why do you use `File`? Are you stuck with Java 6?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23708705

http://stackoverflow.com/comment/36435088
score: 0
comment on: http://stackoverflow.com/q/23708178
type: Comment
type: QuestionComment
has text: Ok, I'll test it but i do not need to resize buttons.

junit
tags question: http://stackoverflow.com/q/23676719
tags question: http://stackoverflow.com/q/23679069
type: Tag
tags question: http://stackoverflow.com/q/23674006
tags question: http://stackoverflow.com/q/23761091
tags question: http://stackoverflow.com/q/23750846
tags question: http://stackoverflow.com/q/23645428
tags question: http://stackoverflow.com/q/23624186
tags question: http://stackoverflow.com/q/23759690
tags question: http://stackoverflow.com/q/23643985
tags question: http://stackoverflow.com/q/23736123
tags question: http://stackoverflow.com/q/23734185
tags question: http://stackoverflow.com/q/23618509
tags question: http://stackoverflow.com/q/23752048
tags question: http://stackoverflow.com/q/23655573
tags question: http://stackoverflow.com/q/23774996
tags question: http://stackoverflow.com/q/23736328
tags question: http://stackoverflow.com/q/23630259
tags question: http://stackoverflow.com/q/23753456
tags question: http://stackoverflow.com/q/23652496
tags question: http://stackoverflow.com/q/23722736
tags question: http://stackoverflow.com/q/23683849
tags question: http://stackoverflow.com/q/23697622
tag name: junit
tags question: http://stackoverflow.com/q/23747060
tags question: http://stackoverflow.com/q/23773340
tags question: http://stackoverflow.com/q/23652663
tags question: http://stackoverflow.com/q/23662997
tags question: http://stackoverflow.com/q/23702506
tags question: http://stackoverflow.com/q/23663726
tags question: http://stackoverflow.com/q/23707983
tags question: http://stackoverflow.com/q/23685035
tags question: http://stackoverflow.com/q/23685431
tags question: http://stackoverflow.com/q/23658799
tags question: http://stackoverflow.com/q/23655076
tags question: http://stackoverflow.com/q/23653875
tags question: http://stackoverflow.com/q/23681501
tags question: http://stackoverflow.com/q/23635208
tags question: http://stackoverflow.com/q/23651907
tags question: http://stackoverflow.com/q/23756185
tags question: http://stackoverflow.com/q/23686948
tags question: http://stackoverflow.com/q/23756276
tags question: http://stackoverflow.com/q/23625279
tags question: http://stackoverflow.com/q/23751744
tags question: http://stackoverflow.com/q/23702431

http://stackoverflow.com/q/23628001
duplicate of: http://stackoverflow.com/q/19968861
has comment: http://stackoverflow.com/comment/36279500
score: 9
has answer: http://stackoverflow.com/a/23628203
answer count: 3
accepted answer: http://stackoverflow.com/a/23628221
downvote count: 0
favorite count: 0
has body: I am curious, I read in the documentation : The capacity is the number of buckets in the hash table ... The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets. Is there a way to know the capacity (number of buckets) of the hashmap at an instant t?
possible better answer: http://stackoverflow.com/a/23628110
has answer: http://stackoverflow.com/a/23628110
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23628221
type: Question
linked to: http://stackoverflow.com/q/19968861
tagged with: hashmap
has title: How to know/get the capacity of hashmap?
upvote count: 9

http://stackoverflow.com/comment/36318541
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23647892
has text: I pretty sure that's due to your love of not adding brackets (`{}`) around your `if` and `else` statements and your refusal to use `if...else if...else` so that your cases fall through. Correct this and see if it fixes it.
score: 0

http://stackoverflow.com/a/23708257
has comment: http://stackoverflow.com/comment/36434117
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23708094
has body: Firstly, restart your window$ system to be safe. Secondly, you need to check if the jdk folder in your variable is set correctly. Run cmd as admin and type cd %JAVA_HOME%. If that gets you into the jdk directory, then your settings work. Now, the main cmd still won't work because your jdk folder path has spaces - Program Files...So, put any path inside double quotes to fix that. Now, run your cmd as follows - "%JAVA_HOME%\bin"keytool....blah...blah Great success !
upvote count: 1

http://stackoverflow.com/a/23749414
upvote count: 1
has body: I don't know which errors you got, and therefore it's a bit hard to help you. But here are some of the errors in your code. They're marked with //&lt;---- import java.util.ArrayList; public class Inventory extends Book { private ArrayList&lt;Book&gt; allBooks = new ArrayList&lt;Book&gt;; //&lt;---- Should be new ArrayList&lt;Book&gt;(); that is, with parentheses. private String customerName; public Inventory() { super(); //&lt;---- I'm rusty on inheritance, but this line** might fuck up some stuff } //@param double price, int copies, String bookTitle, String Author, String isbnNumber public void addBooks() { allBooks.add(new Book(4.99, 6, "A Tale of Two Cities", "Charles Dickens", "9781783220731")); } public boolean isAvailable() { for(Book myBook : allBooks) { if(myBook.copiesLeft() == 0) return false; else return true; } //&lt;---- You need a second return statement, in case the for-loop and if statement is never accessed. The method always needs to return something when you've told it to. } public Book getBookByTitle(String titleSearch) { for (Book myBook : allBooks) { if (titleSearch.equals(myBook.getTitle())); //&lt;---- Semicolon return myBook; } //&lt;---- You need a second return statement, in case the for-loop and if statement is never accessed. The method always needs to return something when you've told it to. } } It would be easier to help if you could post the main method and the specific errors you get. Also, as pointed out by Elliott; I'm not sure why you've extended class Inventory with Book. ** I might be in the wrong here; When calling super(), which in this case is constructor in Books(?), there might spawn errors since you're lacking parameters. This method call should probably not be in this class, since Inventory probably shouldn't extend Book.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23748912

http://stackoverflow.com/a/23728730
upvote count: 1
downvote count: 1
has body: Build the dictionary into a trie and traverse the file. O(n) time in size of file (I believe O(file size * trie depth) in worst case) and O(1) memory (fixing the size of the dictionary and assuming small largest word). This is also streamable and is very RAM-efficient, so would scale to, say, a terabyte of data with only a gigabyte of RAM.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23728424

http://stackoverflow.com/a/23751536
answers question: http://stackoverflow.com/q/23751411
has body: I found the answer. Thanks for all who support me. long l = Long.parseLong("083752"); String date1 = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date(l * 1000)); System.out.println(date1);
score: 0
has comment: http://stackoverflow.com/comment/36516639
type: Answer

http://stackoverflow.com/a/23650512
has body: The lambda expression is a red-herring. When you change the method signature in class B, it's no longer overriding the void meth(X x) method in class A.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23650393
score: 3
has comment: http://stackoverflow.com/comment/36955022
has comment: http://stackoverflow.com/comment/36331795
downvote count: 0

http://stackoverflow.com/a/23681665
upvote count: 1
answers question: http://stackoverflow.com/q/23681465
type: Answer
has body: What about this? public AppUsage(String activityName, String formattedTime, String usageType) { mActivityName = activityName; mFormattedTime = formattedTime; for(UsageType type : UsageType.values()) { if(type.getAsText().equals(usageType)) mUsageType = type; } }
downvote count: 0
score: 1

http://stackoverflow.com/comment/36503241
type: Comment
has text: *a pointer to a pointer to a float (well, a 2D array of floats)* This is misleading. A pointer to pointer to float is definitely not a 2D array.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23744366

http://stackoverflow.com/q/23716735
tagged with: object
has body: I want that a server sends an object to a client, then the client answer the server with another message and so on. I have following code but I get exception message. I think I did not understand the logic of sending and receiving object over socket. Server code: public class Server implements Runnable { int MAX_NUM_CLIENT = 5; int clientNum = 0; boolean isStart = false; // if ranking algorithm starts it is true Socket csocket; Server(Socket csocket) { this.csocket = csocket; } BufferedReader reader = new BufferedReader(new InputStreamReader (getClass().getClassLoader().getResourceAsStream("questions.txt"))); ArrayList&lt;String&gt; questions = new ArrayList&lt;String&gt;(); public static void main(String args[]) throws Exception { ServerSocket ssock = new ServerSocket(9654); System.out.println("Listening"); //wait connection while (true) { Socket sock = ssock.accept(); System.out.println("Connected"); new Thread(new Server(sock)).start(); } } public void run() { try { if(questions.isEmpty()){ String line = null; while((line = reader.readLine()) != null){ questions.add(line); } } ObjectOutputStream objectOutput = new ObjectOutputStream(csocket.getOutputStream()); ObjectInputStream objectInput = new ObjectInputStream(csocket.getInputStream()); //InetAddress host = InetAddress.getLocalHost(); objectOutput.writeObject(questions); P0Computation comp = new P0Computation(); //some calculations P0Sending send1 = comp.P1Calculation1(); //some calculations objectOutput.writeObject(send1); int [] pjans = new int[2]; pjans[0] = objectInput.readInt(); // read client's answer pjans[1] = objectInput.readInt(); // read client's answer objectOutput.writeInt(comp.P0Calculation2(pjans)); csocket.close(); } catch (IOException e) { System.err.println("Client left...");; } } } Client code: public class Client { public static void main(String args[]) throws UnknownHostException, IOException, ClassNotFoundException { Socket ssocket = null; ssocket = new Socket("192.7.1.6", 9654); ObjectOu…
tagged with: java
score: 0
tagged with: client-server
has title: Server and Client are sending multiple objects
has comment: http://stackoverflow.com/comment/36450113
answer count: 1
has answer: http://stackoverflow.com/a/23721560
type: UnansweredQuestion
tagged with: sockets
linked to: http://stackoverflow.com/q/62929
has comment: http://stackoverflow.com/comment/36451343
duplicate of: http://stackoverflow.com/q/62929
has comment: http://stackoverflow.com/comment/36450158
type: Question
has comment: http://stackoverflow.com/comment/36456687

http://stackoverflow.com/comment/36468402
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23725944
has text: Any solution for this would qualify as a security flaw. Apps are not supposed to get control at uninstall time, so they do not attempt to do anything to interfere with the uninstall process.

http://stackoverflow.com/comment/36416908
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23699452
score: 1
has text: @JonK it is not *that* simple.

http://stackoverflow.com/comment/36385065
comment on: http://stackoverflow.com/q/23677842
has text: My theory regarding your second (working) example is that "something" (either the sequence generator or your `printAll` method) flushes the context and thus creates the entity in the database. Breakpoint the code before the `createNamedQuery` call and check if the value appears in the database.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/54527603
type: Answer
answers question: http://stackoverflow.com/q/23650193
score: 0
has body: Use Apple Script Editor to open Terminal and run your code. For Example : String action1 = jsonDriver.readApplicationDetails("OFF"); Runtime runtime = Runtime.getRuntime(); String applescriptCommand = "tell application \"Terminal\"\n" + "activate\n" + "delay 1\n" + "tell application \"System Events\"\n" + "keystroke \"" + action1 + "\"\n" + "end tell\n" + "end tell"; String[] args1 = { "osascript", "-e", applescriptCommand }; Process process = runtime.exec(args1); Thread.sleep(5000);

http://stackoverflow.com/q/23720850
score: 0
has body: I have to make a Web Browser, displaying the web pages from a DOM tree. I have the DOM tree done using jsoup library, but I don't know how to display the web page on a JEditorPane. I have this: Document domTree = BackEnd.getInstance().getDOM(linkBar.getText(), "GET", null); which makes a Document (domTree), as a HTML document, that has the DOM tree of the web site entered in the link bar. How can I use this document to display the web page on that JEditorPane? Or do I have to use a different thing than JEditorPane?
answer count: 1
has answer: http://stackoverflow.com/a/23721331
accepted answer: http://stackoverflow.com/a/23721331
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: jsoup
has title: How to display a web page in a frame from a jsoup document in Java?

http://stackoverflow.com/comment/36556056
has text: Have you considered using the stencil or depth buffer to reject the parts of the cross that overlap? I wrote an [answer to a somewhat similar question a while back](http://stackoverflow.com/questions/20508259/draw-a-curved-line-from-an-arc-edge/20532002#20532002)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23771592
score: 0

http://stackoverflow.com/q/23695439
has answer: http://stackoverflow.com/a/56897051
possible better answer: http://stackoverflow.com/a/23695775
type: Question
linked to: http://stackoverflow.com/q/7229226
has answer: http://stackoverflow.com/a/23695775
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36410077
has comment: http://stackoverflow.com/comment/36480927
linked to: http://stackoverflow.com/q/4768817
downvote count: 4
linked to: http://stackoverflow.com/q/10003962
upvote count: 0
accepted answer: http://stackoverflow.com/a/24076821
tagged with: macos
favorite count: 0
has answer: http://stackoverflow.com/a/23696719
linked to: http://stackoverflow.com/q/10871489
answer count: 5
has answer: http://stackoverflow.com/a/23696180
has comment: http://stackoverflow.com/comment/36480991
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36488876
has title: JFrame does not show up in Eclipse
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/36477852
tagged with: swing
has body: I tried to execute the following code within Eclipse (OSX): public static void main(String[] args) { JFrame frame = new JFrame("Test"); frame.setSize(new Dimension(400, 30)); frame.add(new JButton("hello")); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } The frame does not show up but I get the following console messages: 2014-05-16 14:45:35.230 java[8685:903] [Java CocoaComponent compatibility mode]: Enabled 2014-05-16 14:45:35.232 java[8685:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000 2014-05-16 14:45:35.546 java[8685:903] *** __NSAutoreleaseNoPool(): Object 0x100612800 of class NSConcreteMapTableValueEnumerator autoreleased with no pool in place - just leaking 2014-05-16 14:45:35.547 java[8685:903] *** __NSAutoreleaseNoPool(): Object 0x100613f40 of class __NSCFDate autoreleased with no pool in place - just leaking 2014-05-16 14:45:35.547 java[8685:903] *** __NSAutoreleaseNoPool(): Object 0x100616e60 of class NSCFTimer autoreleased with no pool in place - just leaking 2014-05-16 14:45:35.550 java[8685:903] *** __NSAutoreleaseNoPool(): Object 0x10061d7c0 of class __NSCFDate autoreleased with no pool in place - just leaking 2014-05-16 14:45:35.550 java[8685:903] *** __NSAutoreleaseNoPool(): Object 0x10061e610 of class NSCFTimer autoreleased with no pool in place - just leaking While, if I put the code into a java file outside of my Eclipse project and compile and run it via command line, everything is fine and the frame shows up. Can anybody help me troubleshooting? UPDATE the code now looks like this: import javax.swing.*; public class TestFrame { public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } private void createAndShowGUI() { JFrame frame = new JFrame("Test"); System.out.println(SwingUtilities.isEventDispatchThread()); frame.getContentPane().add(new JButton("hello")); frame.setDefaultCloseOperation(JFram…
has answer: http://stackoverflow.com/a/24076821

http://stackoverflow.com/q/23679564
has title: Spring MVC web application: No default constructor found
has comment: http://stackoverflow.com/comment/36379982
tagged with: spring
has answer: http://stackoverflow.com/a/23685096
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23685441
score: 7
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/23680364
type: Question
has comment: http://stackoverflow.com/comment/36379906
has body: Project ZIP: http://goo.gl/ddhLg5 Spring web app cannot be executed giving HTTP Status 500 error. It also writes out that No default constructor found for DSLR but in fact there is a default constructor. Maybe it has to do with application context or the way my beans declared? What is the reason my application cannot start? DSLR: package main.java.com.springapp.mvc.model; public class DSLR { public DSLR() { } public void init() {} private int dslrId; private String model; private int price; private String description; public int getDslrId() { return dslrId; } public void setDslrId(int dslrId) { this.dslrId = dslrId; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public String toString() { return "DSLR [dslr=" + dslrId + ", model=" + model + ", price=" + price+ ", description=" + description+"]"; } } web.xml Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / DSLRServletController-servlet.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="main.java.com.springapp.mvc" > <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <property name="prefix" value="/WEB-INF/pages/" /> <property name="suffix" value=".jsp" /> <property name="dslrDAO" ref="d…
has answer: http://stackoverflow.com/a/66251434
has comment: http://stackoverflow.com/comment/36387191
has comment: http://stackoverflow.com/comment/36380610
possible better answer: http://stackoverflow.com/a/23685096
has comment: http://stackoverflow.com/comment/36382977
has answer: http://stackoverflow.com/a/53005639
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23685441
answer count: 5

http://stackoverflow.com/a/40131385
type: Answer
has comment: http://stackoverflow.com/comment/69908075
has body: Extending Stuart Marks's answer, this can be done in a shorter way and without a concurrent map (if you don't need parallel streams): public static &lt;T&gt; Predicate&lt;T&gt; distinctByKey(Function&lt;? super T, ?&gt; keyExtractor) { final Set&lt;Object&gt; seen = new HashSet&lt;&gt;(); return t -&gt; seen.add(keyExtractor.apply(t)); } Then call: persons.stream().filter(distinctByKey(p -&gt; p.getName());
upvote count: 12
has comment: http://stackoverflow.com/comment/69891708
score: 10
answers question: http://stackoverflow.com/q/23699371
downvote count: 2
has comment: http://stackoverflow.com/comment/77688560

http://stackoverflow.com/q/23746075
has body: I learnt that I can override a method if it has the same signature. However the return type of overridden method in the derived class can be the sub-typed of super class method return type. Can anyone tell me what is wrong with this code if the statement provided above is correct? class Base{ public int getValue(){ return 222; } //1 } class Sub extends Base{ public byte getValue(){ return 10; } //2 public static void main(String[] args){ Base b = new Sub(); System.out.println(b.getValue()); } }
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36506652
type: Question
accepted answer: http://stackoverflow.com/a/23746450
has title: Overriding Methods with the subtype
has comment: http://stackoverflow.com/comment/36507402
tagged with: overriding
has comment: http://stackoverflow.com/comment/36506613
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23746450
has comment: http://stackoverflow.com/comment/61214646

http://stackoverflow.com/q/23675452
linked to: http://stackoverflow.com/q/1736730
answer count: 5
has title: Annotation are only available for java 1.5 and greater when generating Google App Engine Backend(JDK 1.8, new ADT installed)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27105479
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/23675515
score: 7
tagged with: java
tagged with: eclipse
downvote count: 0
favorite count: 0
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/30762229
tagged with: android
has body: I installed fresh ADT: http://developer.android.com/sdk/index.html?hl=sk Then I installed: When I got into the Eclipse readme directory there is: Eclipse Project Release Notes Release 4.3.0 Last revised May 29th, 2013 I created fresh Android application then right clicked on it->Google->Generate Google App Engine Backend and this is what I got: Description Resource Path Location Type The import android.os.Build is never used MainActivity.java /A/src/com/uniquebullshit/a line 12 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater MessageData.java /A-AppEngine/src/com/uniquebullshit/a line 22 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater DeviceInfoEndpoint.java /A-AppEngine/src/com/uniquebullshit/a line 21 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater MessageData.java /A-AppEngine/src/com/uniquebullshit/a line 28 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater DeviceInfoEndpoint.java /A-AppEngine/src/com/uniquebullshit/a line 21 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater MessageData.java /A-AppEngine/src/com/uniquebullshit/a line 29 Java Problem The import android.support.v7.app.ActionBar is never used MainActivity.java /A/src/com/uniquebullshit/a line 4 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater DeviceInfo.java /A-AppEngine/src/com/uniquebullshit/a line 25 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater DeviceInfo.java /A-AppEngine/src/com/uniquebullshit/a line 33 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater MessageEndpoint.java /A-AppEngine/src/com/uniquebullshit/a line 46 Java Problem Syntax error, annotations are only available if source level is 1.5 or greater MessageEndpoint.java /A-AppEngine/src/com/uni…
has answer: http://stackoverflow.com/a/26375764
has answer: http://stackoverflow.com/a/28034860

http://stackoverflow.com/q/23683591
has body: I have registered an OnErrorListener with my MediaPlayer and to test it I simply turn off the WiFi. There is no other Internet connection available than WiFi so the playback stops, but the event handler is not fired. Isn't that supposed to happen or how would I deal with these problems? MediaPlayer mp = new MediaPlayer(); mp.setDataSource(uri); mp.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mediaPlayer, int what, int extra) { // logging stuff return false; } }); mp.prepare(); mp.start();
score: 3
tagged with: android
tagged with: asynchronous
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36414850
type: Question
has answer: http://stackoverflow.com/a/23683901
tagged with: android-mediaplayer
tagged with: java
has title: No error event when WiFi connection is lost for MediaPlayer
has comment: http://stackoverflow.com/comment/36387692
answer count: 1
downvote count: 0
favorite count: 0
tagged with: media-player

http://stackoverflow.com/comment/36409040
has text: @MattJohnson, you seem to be true. But the code is shamelessly copied from decompiled mscorelib.dll source. Blame MS for that.
comment on: http://stackoverflow.com/a/23673012
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23632274
type: Question
has comment: http://stackoverflow.com/comment/36287476
accepted answer: http://stackoverflow.com/a/23632362
has comment: http://stackoverflow.com/comment/36287546
score: 0
has answer: http://stackoverflow.com/a/23632564
has answer: http://stackoverflow.com/a/23632397
has answer: http://stackoverflow.com/a/23632362
tagged with: regex
has body: I am totally confused right now. What is a word that matches: ^.*(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&amp;]).*$ I tried at Regex 101 this 1Test@!. However that does not work. I really appreciate your input!
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: Word that matches ^.*(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&]).*$
possible better answer: http://stackoverflow.com/a/23632331
has answer: http://stackoverflow.com/a/23632331

http://stackoverflow.com/a/23764087
answers question: http://stackoverflow.com/q/23763819
score: 0
has comment: http://stackoverflow.com/comment/36540878
type: Answer
has comment: http://stackoverflow.com/comment/36541156
has comment: http://stackoverflow.com/comment/36540488
has body: I have just tested your layout. It works. I might be a bug from formatting. Try auto formatting. Do you know how it works? Do you have a end tag for your LinearLayout? <TextView android:id="@+id/SSB_Tv" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginTop="130dp" android:gravity="center_horizontal" android:text="abc" android:textSize="25sp" /> If that does not help, please post your manifest. Best regards Vince EDIT: Try to use this in your manifest instead. This will start your second Activity at first. There is nothing wrong with your layout. Your question belongs to another problem. <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has comment: http://stackoverflow.com/comment/36541054

http://stackoverflow.com/a/23688877
has comment: http://stackoverflow.com/comment/36397931
upvote count: 5
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23688854
type: Answer
answers question: http://stackoverflow.com/q/23688854
has comment: http://stackoverflow.com/comment/36397974
score: 5
has body: Use capital MM for month; mm is minutes. SimpleDateFormat javadocs has all the symbols

http://stackoverflow.com/comment/36554748
type: QuestionComment
has text: Well, now the problem is that the details of the algorithm is hidden inside the classes you use... You really can only calculate time complexity if you have access to the full algorithm, whether that is in code or if you know what implementation is used by the classes you use.
type: Comment
comment on: http://stackoverflow.com/q/23770814
score: 0

http://stackoverflow.com/a/23753087
has comment: http://stackoverflow.com/comment/36576121
answers question: http://stackoverflow.com/q/23753025
has comment: http://stackoverflow.com/comment/36577284
has comment: http://stackoverflow.com/comment/36576316
has comment: http://stackoverflow.com/comment/36535268
type: Answer
has comment: http://stackoverflow.com/comment/36576968
has comment: http://stackoverflow.com/comment/36576388
has comment: http://stackoverflow.com/comment/36576807
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36577331
has body: Is it a good idea to use SOAP ? It's based on your requirement, WSO2 ESB supports SOAP 1.1, SOAP 1.2 message formats. What other options I can look for ? WSO2 ESB features connecting anything to anything. Following are the formats and protocols. For more details, check the introduction page Features Connecting Anything to Anything Transports: HTTP, HTTPS, POP, IMAP, SMTP, JMS, AMQP, FIX, TCP, UDP, FTPS, SFTP, CIFS, MLLP, SMS Formats &amp; protocols: JSON, XML, SOAP 1.1, SOAP 1.2, WS-*, HTML, EDI, HL7, OAGIS, Hessian, Text, JPEG, MP4, All binary formats, CORBA/IIOP Adapters to COTS systems: SAP BAPI &amp; IDoc, PeopleSoft, MS Navision, IBM WebSphere MQ, Oracle AQ, MSMQ Adapters to cloud services: Salesforce, Paypal, LinkedIn, Twitter, JIRA
score: 0
accepted answer of: http://stackoverflow.com/q/23753025
has comment: http://stackoverflow.com/comment/36555531
has comment: http://stackoverflow.com/comment/36576187
type: AcceptedAnswer

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/23710181
tags question: http://stackoverflow.com/q/23619447
tags question: http://stackoverflow.com/q/23635263
tags question: http://stackoverflow.com/q/23739314
tags question: http://stackoverflow.com/q/23734280
tags question: http://stackoverflow.com/q/23671241
tags question: http://stackoverflow.com/q/23746816
tags question: http://stackoverflow.com/q/23618641
tags question: http://stackoverflow.com/q/23707342
tags question: http://stackoverflow.com/q/23768872
tags question: http://stackoverflow.com/q/23620472
tags question: http://stackoverflow.com/q/23678342
tags question: http://stackoverflow.com/q/23708522
tags question: http://stackoverflow.com/q/23645729
type: Tag
tags question: http://stackoverflow.com/q/23762417
tags question: http://stackoverflow.com/q/23764770
tags question: http://stackoverflow.com/q/23623159
tags question: http://stackoverflow.com/q/23714245
tags question: http://stackoverflow.com/q/23717634
tags question: http://stackoverflow.com/q/23640579
tags question: http://stackoverflow.com/q/23638066
tags question: http://stackoverflow.com/q/23723993
tags question: http://stackoverflow.com/q/23712232
tags question: http://stackoverflow.com/q/23690691
tags question: http://stackoverflow.com/q/23773379
tags question: http://stackoverflow.com/q/23767696
tags question: http://stackoverflow.com/q/23683239
tags question: http://stackoverflow.com/q/23709827
tags question: http://stackoverflow.com/q/23733955

http://stackoverflow.com/q/23624038
tagged with: java
has comment: http://stackoverflow.com/comment/36272071
tagged with: eclipse
score: 15
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23625575
accepted answer: http://stackoverflow.com/a/23625575
has body: First of all, I'd like to point out that I am aware that this question has been asked countless times and I am aware of the usual solution. However, it doesn't seem to work for me. When the error Exception in thread "main" java.lang.UnsupportedClassVersionError: org/telegram/mtproto/state/ConnectionInfo : Unsupported major.minor version 52.0 occurs, it is generally caused by compiling with an incompatible JDK-JRE combination. However, as shown by the images below, my setup seems to be in order: Fig. 1. JDK Compliance Fig. 2. JRE Setting Fig. 3. Java Home What seems to be the problem? What am I missing? I'm using Eclipse Luna, trying to run some Telegram API Layer 11 code (the code works I reckon, as it was used by others).
has comment: http://stackoverflow.com/comment/36271947
has comment: http://stackoverflow.com/comment/36272008
favorite count: 0
has answer: http://stackoverflow.com/a/28626206
upvote count: 15
has comment: http://stackoverflow.com/comment/36272026
has comment: http://stackoverflow.com/comment/36272056
downvote count: 0
tagged with: telegram
possible better answer: http://stackoverflow.com/a/28626206
has comment: http://stackoverflow.com/comment/36271976
has comment: http://stackoverflow.com/comment/36272018
has title: Peculiar Eclipse java.lang.UnsupportedClassVersionError, Unsupported major.minor version 52.0
has comment: http://stackoverflow.com/comment/36271933
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/54736686

http://stackoverflow.com/q/23703961
has title: Java: Connect to Active Directory via serverless binding?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
has body: I have to write some code in Java (technically Groovy, but Java is more common) that will connect to Active Directory and find which groups a user belongs to. I've been looking at various LDAP libraries to accomplish this, however, I'm getting stuck right at the beginning. How can I connect to Active Directory in Java using serverless binding? The serverless binding part is where I'm getting stuck. It seems all the libraries I've tried so far require an actual server hostname and port number. I'd like to avoid having to code these and instead take advantage of the whole serverless binding feature of Active Directory. Is this possible? If so, any pointers to how to do this will be highly appreciated.
answer count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: active-directory
tagged with: binding

http://stackoverflow.com/comment/36532902
score: 0
type: AnswerComment
has text: Ive tried now with the EventQueue.invokeLater. It worked in a way. The only problem is that the file processing() are not been done when a new file is put in the directory...
type: Comment
comment on: http://stackoverflow.com/a/23760001

http://stackoverflow.com/q/23702950
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23703090
has answer: http://stackoverflow.com/a/23703148
has answer: http://stackoverflow.com/a/23703090
has body: Double.isInfinite(1.0 / 0.0); returns true. Double.isInfinite(1.0 / 3.0); but this doesnt, and to my understanding this would be an infinite number as this returns 0.33333_ to infinity. why?
type: Question
has title: why doesnt Double.infinite return true for infinite fractions?
score: 4
has comment: http://stackoverflow.com/comment/36471217
has answer: http://stackoverflow.com/a/23702969
accepted answer: http://stackoverflow.com/a/23702969
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/36424428
tagged with: double
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/36443512
has text: Are those JBoss server parameters or System(Windows) parameters?
comment on: http://stackoverflow.com/q/23713281
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36268999
has text: i would.not advice a beginer to start TEXT MINING as a 1st java project . **if its your project then, make a project to get used to file i/o (make a swing form,accept username and email ,store to file : list all button to give a complete list)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23622425

http://stackoverflow.com/comment/36318528
type: AnswerComment
comment on: http://stackoverflow.com/a/23632741
has text: Which version of Firefox are you using? Older versions of firefox have websocket disabled.
type: Comment
score: 0

http://stackoverflow.com/comment/36377014
comment on: http://stackoverflow.com/a/23677938
score: 0
type: Comment
has text: My bad, somehow i've overseen it - but afaik this is the only way of interacting with the SWT-UI in a multithreaded environment.
type: AnswerComment

http://stackoverflow.com/comment/36522388
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23744108
has text: The error returned is null

http://stackoverflow.com/q/23702476
score: 0
has title: Running and debugging Eclipse RCP as a Maven project
has body: Is it still possible to run and debug Eclipse RCP projects inside Eclipse after they were converted to a Maven project (for example with the help of Maven Tycho plugin). Does the conversion to a Maven project impact the Eclipse RCP project in this matter in any way? I would like to run the RCP application inside Eclipse without having to build it with Maven every time (it takes too much time). I am familiar with Maven, but I don't know what impact it has to an Eclipse RCP application. Thank you for the answer.
has answer: http://stackoverflow.com/a/23733569
type: UnansweredQuestion
tagged with: maven
type: Question
tagged with: tycho
tagged with: java
tagged with: rcp
tagged with: eclipse
answer count: 1

http://stackoverflow.com/comment/36444720
score: 0
type: Comment
has text: Matt - that was only one example that can be scanned in. Others can have multiple things on one line. To be more precise about my problem, the ; isn't being scanned by s.next()
type: QuestionComment
comment on: http://stackoverflow.com/q/23714018

http://stackoverflow.com/comment/36382330
type: AnswerComment
score: 0
has text: Thanks, I changed them
type: Comment
comment on: http://stackoverflow.com/a/23670681

http://stackoverflow.com/a/23639338
has comment: http://stackoverflow.com/comment/36302175
has comment: http://stackoverflow.com/comment/36302275
answers question: http://stackoverflow.com/q/23638664
has comment: http://stackoverflow.com/comment/36302535
has body: You are using getListeAnnees where you intend to call a method of your private object called anneeMetier, which is not initialized yet. You initialize that object through your setAnneeMetier method, which is never initialized in your code, therefore it is null. You can solve your problem by doing one of the following: You initialize anneeMetier by calling the setAnneeMetier before you use getListeAnnees You implement a constructor for your AnneeBean class where you initialize anneeMetier You modify your getter (getListeAnnees) to be such as follows: public List getListeAnnees() { if (anneeMetier == null) { return new ArrayList&lt;Annee&gt;(); } listeAnnees = anneeMetier.getAllAnnees(); return listeAnnees; } EDIT: pL4GU33's comment might be useful, so I add his comment's idea to the answer: public List getListeAnnees() { if (anneeMetier == null) { return Collections.emptyList(); } listeAnnees = anneeMetier.getAllAnnees(); return listeAnnees; } His solution is more type-agnostic, so I upvote his comment.
has comment: http://stackoverflow.com/comment/36302429
upvote count: 2
has comment: http://stackoverflow.com/comment/36302231
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36301747

http://stackoverflow.com/q/23648613
tagged with: java
tagged with: collections
type: Question
has title: java collection backed up by multiple collections
has body: I have two collections: coll1 and coll2. I need a collection coll which is the union of the two, but I don't want to allocate a new collection. I simply what coll to represent a view of the two collection, and to forward calls to them. Is there a library which offer this?
accepted answer: http://stackoverflow.com/a/23649274
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36320621
has comment: http://stackoverflow.com/comment/36319732
has answer: http://stackoverflow.com/a/23649274
type: AnsweredQuestion

http://stackoverflow.com/a/73659048
answers question: http://stackoverflow.com/q/23701943
has body: To sort ArrayList of String in n descending order just refer to this type And if You are looking for ascending then replace a1 with a2. Collections.sort(ArrayListName,(a1,a2)-&gt;a2.compareTo(a1));
score: 0
type: Answer

http://stackoverflow.com/comment/36353721
comment on: http://stackoverflow.com/q/23664639
type: Comment
type: QuestionComment
has text: hi. I just would like to point to a previews similar question with my answer: http://stackoverflow.com/questions/21457794/securely-storing-credentials/21458465#21458465
score: 0

http://stackoverflow.com/q/23726146
has comment: http://stackoverflow.com/comment/36468570
tagged with: java
possible better answer: http://stackoverflow.com/a/23726173
has comment: http://stackoverflow.com/comment/36468648
type: Question
answer count: 2
upvote count: 0
tagged with: string
duplicate of: http://stackoverflow.com/q/17411747
favorite count: 0
has comment: http://stackoverflow.com/comment/36468624
linked to: http://stackoverflow.com/q/17411747
accepted answer: http://stackoverflow.com/a/23726163
has answer: http://stackoverflow.com/a/23726173
has body: I found many questions already answer like this one, I, however, either didn't comprehend the answers or they were no what i needed. I appreciate any help. Thank you. I need to take a string entered by a user and separate the characters with in that string. To clarify I will give the next example: if the user enters a1, b1, or c1 (which are the only choices) I need to take the string entered (lets say a1) and separate a from 1. This is so that i can use them individually at a later time.
downvote count: 2
has answer: http://stackoverflow.com/a/23726163
has title: How to split each character on a String from user input?
type: AnsweredQuestion
tagged with: split
has comment: http://stackoverflow.com/comment/36468722
score: -2

javascript
tags question: http://stackoverflow.com/q/23687127
tags question: http://stackoverflow.com/q/23726690
tags question: http://stackoverflow.com/q/23616161
tags question: http://stackoverflow.com/q/23709433
tags question: http://stackoverflow.com/q/23624308
tags question: http://stackoverflow.com/q/23724260
tags question: http://stackoverflow.com/q/23622842
tags question: http://stackoverflow.com/q/23655271
tags question: http://stackoverflow.com/q/23724856
tags question: http://stackoverflow.com/q/23777270
tags question: http://stackoverflow.com/q/23660416
tag name: javascript
tags question: http://stackoverflow.com/q/23649868
tags question: http://stackoverflow.com/q/23649083
tags question: http://stackoverflow.com/q/23755490
tags question: http://stackoverflow.com/q/23759718
tags question: http://stackoverflow.com/q/23775503
tags question: http://stackoverflow.com/q/23623594
tags question: http://stackoverflow.com/q/23764791
tags question: http://stackoverflow.com/q/23752505
tags question: http://stackoverflow.com/q/23766702
type: Tag
tags question: http://stackoverflow.com/q/23674157
tags question: http://stackoverflow.com/q/23672716
tags question: http://stackoverflow.com/q/23697172
tags question: http://stackoverflow.com/q/23688555
tags question: http://stackoverflow.com/q/23656788
tags question: http://stackoverflow.com/q/23654187
tags question: http://stackoverflow.com/q/23683730
tags question: http://stackoverflow.com/q/23747910
tags question: http://stackoverflow.com/q/23637076
tags question: http://stackoverflow.com/q/23761937
tags question: http://stackoverflow.com/q/23680808
tags question: http://stackoverflow.com/q/23632227
tags question: http://stackoverflow.com/q/23723620
tags question: http://stackoverflow.com/q/23621122
tags question: http://stackoverflow.com/q/23724827
tags question: http://stackoverflow.com/q/23759002
tags question: http://stackoverflow.com/q/23651688
tags question: http://stackoverflow.com/q/23760809
tags question: http://stackoverflow.com/q/23698636
tags question: http://stackoverflow.com/q/23755741
tags question: http://stackoverflow.com/q/23677000
tags question: http://stackoverflow.com/q/23699784
tags question: http://stackoverflow.com/q/23661317
tags question: http://stackoverflow.com/q/23673596
tags question: http://stackoverflow.com/q/23743425
tags question: http://stackoverflow.com/q/23743587
tags question: http://stackoverflow.com/q/23692573
tags question: http://stackoverflow.com/q/23763752
tags question: http://stackoverflow.com/q/23730722
tags question: http://stackoverflow.com/q/23656615
tags question: http://stackoverflow.com/q/23653961
tags question: http://stackoverflow.com/q/23679387
tags question: http://stackoverflow.com/q/23710977
tags question: http://stackoverflow.com/q/23646457

http://stackoverflow.com/q/23689605
tagged with: java
has comment: http://stackoverflow.com/comment/36401758
tagged with: erlang
has comment: http://stackoverflow.com/comment/36403181
upvote count: 2
has title: What is the best practice on storing lots of sockets?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36401850
tagged with: redis
tagged with: sockets
has body: For testing purposes I want to create a socket server which will contain 10+ million concurrent socket connections spread over X number of ec2 instance on AWS (still deciding on either node.js with JXCore, Java, or Erlang). These sockets will be sending messages randomly to one other socket every 10 seconds. I am just having trouble understanding how I can store and read these sockets effectively. The two options I can see are to store the socket objects in something like a map in the application itself, or store the sockets in a fast database such as Redis. The problem with having sockets stored in a data structure inside of the application is will it be able to scale, be robust, and how will the read performance be when millions of sockets need to find one another. And If I store them in something like a database such as redis there must be a network call every time because Socket A needs to know where Socket B is located to send the message. This I fear will bring down performance considerably. I was wondering what the best practices are for scalable socket servers as I can't find anything on the internet which answer this question. Every socket server I find online simple broadcasts to every other socket instead of having specific sockets and only contain something like 10 sockets.
has answer: http://stackoverflow.com/a/23690801
tagged with: node.js
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36401351
type: Question

http://stackoverflow.com/comment/36310781
type: Comment
has text: i've updated the question as requested @Luiggi Mendoza
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23639890

http://stackoverflow.com/comment/36377828
score: 1
has text: It ensures that the new X instance has an independent copy of the passed-in byte array as its instance member as opposed to a reference to the passed object.
type: AnswerComment
comment on: http://stackoverflow.com/a/23645447
type: Comment

http://stackoverflow.com/comment/36455960
comment on: http://stackoverflow.com/q/23716644
type: Comment
type: QuestionComment
has text: towards addressing my problem helped this page https://forums.adobe.com/message/6280632?tstart=0
score: 0

http://stackoverflow.com/q/23734695
tagged with: keyevent
score: 0
tagged with: java
has title: Java How to get ascii char from key code
type: UnansweredQuestion
tagged with: awt
type: Question
has answer: http://stackoverflow.com/a/23735624
answer count: 2
has answer: http://stackoverflow.com/a/23735389
has comment: http://stackoverflow.com/comment/36484773
has body: I want to get ascii char from each key that user inputs into JComponent. &lt;JComponentName&gt;.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { char ch = getAsciiCharFromKeyCode(e.getKeyCode()); } }); private char getAsciiCharFromKeyCode(int keyCode) { // this implementation is what I'm interested in } When I press 'e' (English 'e') and 'у' (Cyrillic 'u'), I get the same key code (0x45 or KeyEvent.VK_E). Is there some way to implement getAsciiCharFromKeyCode function without writing my own hash map like this: HashMap&lt;Integer, Character&gt; keyCodeToChar = new HashMap&lt;Integer, Character&gt;(); keyCodeToChar.put(KeyEvent.VK_E, 'e'); ?

http://stackoverflow.com/q/23777482
has comment: http://stackoverflow.com/comment/36568192
type: Question
has title: GWT cron job not running
has comment: http://stackoverflow.com/comment/36589240
tagged with: cron
tagged with: google-app-engine
has body: I'm creating a small web app. I have a cron job to sent out periodic emails from data stored in the database. However I don't think the cron job is running at all. The files are here. cron.xml <?xml version="1.0" encoding="UTF-8"?> /cron/MailingServlet Put your Cron Job description here every 1 minutes web.xml mailingService com.peter.from.cron.MailingServlet mailingService /cron/MailingServlet and the MailingServlet.java @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { _logger.info("CRON EXECUTED"); List<Note> notes = new ArrayList<Note>(); PersistenceManager pm = PMF.getPersistenceManager(); long now = System.currentTimeMillis(); Query q = pm.newQuery(Note.class); q.setFilter("currentTime >= scheduledTime"); q.declareParameters("long currentTime"); try{ notes = (List<Note>) q.execute(now); for(Note n: notes){ this.mail(n.getEmail(), n.getMessage()); pm.deletePersistent(n); } }catch(Exception e){ _logger.info(e.getLocalizedMessage()); } } any help is appreciated, thanks.
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/36599774
tagged with: gwt
tagged with: java

http://stackoverflow.com/q/23652041
favorite count: 0
has body: I'm starting to build an app (in java) and I am having some problems.I'm pretty new with all that and I'm getting a little lost. I am trying to export some info to an excel template. I have no problem with that, but the template has some excel formulas. When I open the template all the info is there, but in order to see the results of the formulas i have to copy/paste all the values given by the app. I've found a sentence to update all the formulas workbookInfDef.getCreationHelper().createFormulaEvaluator().evaluateAll(); But it doesn't work. An error stop happens with it and the app collapses... I would be really greatfull if anyone could help me!
accepted answer: http://stackoverflow.com/a/23652497
tagged with: excel
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23652497
type: Question
tagged with: formula
upvote count: 1
answer count: 1
has title: Update a formula in excel using Java

http://stackoverflow.com/q/23776131
type: Question
has comment: http://stackoverflow.com/comment/36565574
has comment: http://stackoverflow.com/comment/36566275
has title: Access Denied - LDAP
tagged with: spring-security
has comment: http://stackoverflow.com/comment/36566081
tagged with: ldap
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has body: i using ldap and trying to make scheme like this : I try login into " Web Application Dashboard ", using existing username in the database server (in this case using sql server) this is Spring-security.xml code : &lt;beans:beans&gt; &lt;beans:bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"&gt; &lt;beans:constructor-arg value="intra.anabatictech.com" /&gt; &lt;beans:constructor-arg value="ldap://10.8.8.11:389/" /&gt; &lt;beans:property name="authoritiesMapper" ref="userDetailsService" /&gt; &lt;/beans:bean&gt; &lt;authentication-manager alias="authenticationManager"&gt; &lt;authentication-provider ref="ldapAuthProvider"&gt;&lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;beans:bean id="userDetailsService" class="com.anabatic.alc.service.impl.ldap.LdapUserService" /&gt; &lt;/beans:beans&gt; this is LdapUserService.ldap code: package com.anabatic.alc.service.impl.ldap; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.EnumSet; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.security.core.authority.SimpleGrantedAuthority; import com.anabatic.alc.bean.UserDetailAlc; import com.anabatic.alc.dao.admin.auth.UserDao; import com.anabatic.alc.entity.admin.auth.User; import com.anabatic.alc.entity.admin.auth.RoleMapping; import com.anabatic.alc.enums.RolesEnum; @Service @Transactional(readOnly=true) publ…

http://stackoverflow.com/comment/36296973
has text: Where do you think you are instantiating an object `Display` that would make use of the `paintComponent` (i.e. that it's being shown in the GUI)?
score: 1
comment on: http://stackoverflow.com/q/23636984
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36499653
score: 0
comment on: http://stackoverflow.com/a/23741728
type: AnswerComment
type: Comment
has text: @user3580294 You'd have to open up the JDK's `langtools` and step through `javac` to see why. I suspect the variables *are* being flagged as [`EFFECTIVELY_FINAL`](http://code.google.com/p/jsr308-langtools/source/browse/src/share/classes/com/sun/tools/javac/code/Flags.java?spec=svn7fcf0d8ebac08a5cf353267db0e2f664953be6e1&r=7fcf0d8ebac08a5cf353267db0e2f664953be6e1#232), but the optimization is probably coded to require a true `FINAL` flag.

http://stackoverflow.com/comment/36340906
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23659391
has text: It's funny how you (@Fcps) said you tried Anton's solution and it didn't work, and yet this is exactly what he said to do...
type: AnswerComment

http://stackoverflow.com/comment/36292785
has text: @Sanjeev No. Do NOT remove the pack(). The pack() is required to display components at their preferred size. The problem is that the text field is NOT displayed at its preferred size.
type: QuestionComment
comment on: http://stackoverflow.com/q/23634360
score: 1
type: Comment

http://stackoverflow.com/a/23620488
score: 3
answers question: http://stackoverflow.com/q/23620247
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23620247
type: Answer
upvote count: 3
has body: How can I get that last example to match on the first line? Regex: ^(.+?)\byo\b(?:(?!cut me:|yo).)*cut me: requires one or more characters before by because of + in (.+?). Consider changing it to (.*?).

http://stackoverflow.com/comment/36422229
type: QuestionComment
type: Comment
has text: @user3535778 I do, but I have different run configurations for them
score: 0
comment on: http://stackoverflow.com/q/23701365

http://stackoverflow.com/comment/36528509
type: Comment
has text: add `tr` in style as well `table,tr, th, td { border: 1px solid black }` for content1 if it's not working.
comment on: http://stackoverflow.com/a/23757679
score: 0
type: AnswerComment

http://stackoverflow.com/q/23745304
has comment: http://stackoverflow.com/comment/36505333
score: 0
has comment: http://stackoverflow.com/comment/36506022
has comment: http://stackoverflow.com/comment/36507393
answer count: 1
has title: Getting the info from the password protected http. Java
has comment: http://stackoverflow.com/comment/36505577
has comment: http://stackoverflow.com/comment/36506792
tagged with: windows-server-2003
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36505446
has body: I'm trying to get the file from the http in a simple java program. I tried to use both domain username and a local one. We are using Windows Server 2003. I found 2 solutions to it. The first one is: public class HttpTest { public static void main(String[] args) { try { URL url = new URL("http://corp.domain.com/name/info.html"); String userPassword = "user:password"; String encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes()); CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); URLConnection connection = url.openConnection(); connection.setRequestProperty("Authorization", "Basic " + encoding); InputStreamReader isr = new InputStreamReader(connection.getInputStream()); BufferedReader in = new BufferedReader(isr); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } catch (Exception e) { e.printStackTrace(); } } } The other way I found is: public class HttpTest { public static void main(String[] args) { try { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { String prompt = getRequestingPrompt(); String host = getRequestingHost(); InetAddress addressIP = getRequestingSite(); int port = getRequestingPort(); String username = "user"; String password = "password"; return new PasswordAuthentication(username, password.toCharArray()); } }); URL url = new URL("http://corp.domain.com/name/info.html"); CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); URLConnection connection = url.openConnection(); InputStreamReader isr = new InputStreamReader(connection.getInputStream()); BufferedReader in = new BufferedReader(isr); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } catch (Exception e) { e.printStackTrace(); } } } The first one throws the following exception: java.io.IOException: Server returned HTTP response code: 401 for URL: http://corp.domain.com/name/info.html at …
tagged with: java
has comment: http://stackoverflow.com/comment/36508109
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/23746871
tagged with: windows-server
has comment: http://stackoverflow.com/comment/36507345
linked to: http://stackoverflow.com/q/1168526

http://stackoverflow.com/q/23677835
has comment: http://stackoverflow.com/comment/36396941
tagged with: linked-list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36376536
has comment: http://stackoverflow.com/comment/36377487
tagged with: 2d
has body: I would like to sort 2D nodes (points) in two dimensions (x and y) and also to allow fast addition and deletion. I would say that this can be done by two linked lists, but found, that Java's LinkedList hides linkage from user. I.e. if I found some node and delete it from one list, I am unable to delete it fast from another. Is this solveable or I need to write my own class supporting two dimensions of linkage?
has comment: http://stackoverflow.com/comment/36415723
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23679416
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23678353
has comment: http://stackoverflow.com/comment/36377565
has title: Java: the same set of objects in two linked lists

http://stackoverflow.com/a/23704711
has body: when Activity get destroyed check the checkbox state if true , and add the checkbox state in shared Preference @Override public void onDestroy() { if(CheckboxData.checked){ SharedPreferences prefs = getSharedPreferences("private preference", Context.MODE_PRIVATE); prefs.edit() .putBoolean("CheckboxData",true) .commit(); } super. onDestroy(); } And when Activity is launched back, In onCreate check for the checkbox state in preference and if true enable the checkbox SharedPreferences prefs = getSharedPreferences("private preference", Context.MODE_PRIVATE); boolean isChecked = prefs.getBoolean("CheckboxData",false); if(isChecked) checkBoxView.setChecked(true)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36427783
type: Answer
has comment: http://stackoverflow.com/comment/53180959
accepted answer of: http://stackoverflow.com/q/23704505
answers question: http://stackoverflow.com/q/23704505
upvote count: 1
has comment: http://stackoverflow.com/comment/36427990
score: 1

http://stackoverflow.com/comment/36446806
type: Comment
score: 0
has text: Nothing wrong with the possible alternatives you mentioned, I was curious to know if there was any way to do that with a shutdown-hook. Thanks for your answer man.
type: QuestionComment
comment on: http://stackoverflow.com/q/23713886

http://stackoverflow.com/q/23660327
answer count: 2
has body: I am using the Oracle Jersey Client, and am trying to cancel a long running get or put operation. The Client is constructed as: JacksonJsonProvider provider = new JacksonJsonProvider(new ObjectMapper()); ClientConfig clientConfig = new DefaultClientConfig(); clientConfig.getSingletons().add(provider); Client client = Client.create(clientConfig); The following code is executed on a worker thread: File bigZipFile = new File("/home/me/everything.zip"); WebResource resource = client.resource("https://putfileshere.com"); Builder builder = resource.getRequestBuilder(); builder.type("application/zip").put(bigZipFile); //This will take a while! I want to cancel this long-running put. When I try to interrupt the worker thread, the put operation continues to run. From what I can see, the Jersey Client makes no attempt to check for Thread.interrupted(). I see the same behavior when using an AsyncWebResource instead of WebResource and using Future.cancel(true) on the Builder.put(..) call. So far, the only solution I have come up with to interrupt this is throwing a RuntimeException in a ContainerListener: client.addFilter(new ConnectionListenerFilter( new OnStartConnectionListener(){ public ContainerListener onStart(ClientRequest cr) { return new ContainerListener(){ public void onSent(long delta, long bytes) { //If the thread has been interrupted, stop the operation if (Thread.interrupted()) { throw new RuntimeException("Upload or Download canceled"); } //Report progress otherwise } }... I am wondering if there is a better solution (perhaps when creating the Client) that correctly handles interruptible I/O without using a RuntimeException.
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/136785040
has title: Interrupt a long running Jersey Client operation
has answer: http://stackoverflow.com/a/32553163
has comment: http://stackoverflow.com/comment/36344955
has comment: http://stackoverflow.com/comment/136784865
has comment: http://stackoverflow.com/comment/136785078
downvote count: 0
has comment: http://stackoverflow.com/comment/36344432
tagged with: java
tagged with: httpconnection
type: Question
score: 5
tagged with: jersey
tagged with: cancellation
has comment: http://stackoverflow.com/comment/47264435
has answer: http://stackoverflow.com/a/73830639

http://stackoverflow.com/comment/36534195
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23760851
has text: But what if I declare `public String x="abc` in java.
score: 1

http://stackoverflow.com/a/23650879
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23648667
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23648667
type: Answer
has body: I found the issue. I am building with Maven. The spring-boot-starter-parent has resource filtering on by default for application.properties: src/main/resources true **/application.yml **/application.properties src/main/resources **/application.yml **/application.properties It seems that ${user.dir} is also something that Maven will replace. If I looked at the application.properties in my target/classes, it was indeed replaced. To fix, I needed to do the following: First tell Maven that you want escape filtering: org.apache.maven.plugins maven-resources-plugin 2.6 \ Then change the application.properties file to: installationDirectory=\${user.dir}/install After this, everything works fine.
score: 3

http://stackoverflow.com/q/23627866
answer count: 2
accepted answer: http://stackoverflow.com/a/23628958
tagged with: bootstrapping
downvote count: 0
favorite count: 0
tagged with: cdi
has body: Is there a simple way to execute code just after CDI has bootstrapped ? Actually I've got an @ApplicationScopped bean which I want to be instanciated just after CDI has bootstrapped, is there a simple way to do that ?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23628958
tagged with: java
has title: Execute code at CDI startup
possible better answer: http://stackoverflow.com/a/57180641
type: Question
has answer: http://stackoverflow.com/a/57180641
score: 4
upvote count: 4

http://stackoverflow.com/comment/36407323
has text: A `Class` object isn't the name of a class. It's much, much more than that. Why would you call it `className`?
comment on: http://stackoverflow.com/q/23693717
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23628160
has answer: http://stackoverflow.com/a/23628498
answer count: 1
has body: How to retrieve node element's value based on attribute name using dom & xml parsing k,l,m a,b,h s,t,r ... r,st,t ... ... Fragment of implementation tried: NodeList nodeList = <xmlDoc>.getElementsByTagName("aa"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; System.out.println(element.getTextContent()); // ? getNodeValue() // ? how to get by passing attribute name as matching criteria, // f.e : how to get a,b,h printed for node aa with attribute name as pqr
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
tagged with: dom
type: Question
has title: Retrieve node element's value based on attribute
score: 0
tagged with: xml-parsing

http://stackoverflow.com/q/23676783
type: Question
has body: So I'm following along with a Lynda.com Tutorial on using Google Maps V2 to build mobile Apps and I was going along with a part that has you creating a map app that is finding the location programatically rather than relying on the setMyLocationEnabled(true) method. So I've followed along with the code and each time I go to run the app it crashes and give me the following error in the logcat: 05-15 12:18:35.139: E/AndroidRuntime(22270): FATAL EXCEPTION: main 05-15 12:18:35.139: E/AndroidRuntime(22270): Process: com.example.gmapsapp, PID: 22270 05-15 12:18:35.139: E/AndroidRuntime(22270): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmapsapp/com.example.gmapsapp.MainActivity}: java.lang.ClassCastException: com.example.gmapsapp.MainActivity cannot be cast to com.google.android.gms.common.GooglePlayServicesClient$ConnectionCallbacks 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.app.ActivityThread.access$900(ActivityThread.java:161) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.os.Handler.dispatchMessage(Handler.java:102) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.os.Looper.loop(Looper.java:157) 05-15 12:18:35.139: E/AndroidRuntime(22270): at android.app.ActivityThread.main(ActivityThread.java:5356) 05-15 12:18:35.139: E/AndroidRuntime(22270): at java.lang.reflect.Method.invokeNative(Native Method) 05-15 12:18:35.139: E/AndroidRuntime(22270): at java.lang.reflect.Method.invoke(Method.java:515) 05-15 12:18:35.139: E/AndroidRuntime(22270): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 05-15 12:18:35.139: E/Android…
answer count: 2
tagged with: google-maps
downvote count: 0
has answer: http://stackoverflow.com/a/23676905
tagged with: google-maps-api-2
possible better answer: http://stackoverflow.com/a/23677087
score: 1
has answer: http://stackoverflow.com/a/23677087
has title: The constructor LocationClient(MainActivity, MainActivity, MainActivity) is undefined
favorite count: 0
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/23676905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36374342
tagged with: java

http://stackoverflow.com/comment/36539152
type: AnswerComment
type: Comment
has text: Append the stack trace (error message) to the end of your question. That will help determine what could be causing the problem.
comment on: http://stackoverflow.com/a/23739132
score: 0

http://stackoverflow.com/q/23617085
has comment: http://stackoverflow.com/comment/36272679
tagged with: deployment
has comment: http://stackoverflow.com/comment/37417862
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to deploy a .war to Tomcat7 without automatically starting it
has body: We've got a custom application that we are deploying to Tomcat7 using Jenkins. The application requires properties files within the war containing configuration options (servers, database passwords, etc) that change depending on what environment we deploy it to. To make these changes we are currently using this procedure: Deploy .war file from nexus server to tomcat server using jenkins (act of deploying unpacks war and starts app, the app will throw errors because config in default properties files are incorrect). We then look for properties file inside the webapps/MyApp dir of tomcat, perform the appropriate search/replace transforms on the files to give correct config. We then issue a restart to the app to re-read the correct config in properties file. This process is very ugly but we're not sure how else to do it. We're stuck with these requirements: The developers would prefer not to rely on properties files outside of the war/webapps dir (or via JDNI) context for configuration and they don't want separate versions of the app in Nexus/SCM, each with a different config. They only want one place in SCM from which to handle these files. We cannot store passwords in SCM and must rely on our deployment tool to do transforms on properties files. We have tried editing the server.xml of tomcat7 and set autoDeploy="false", but even with this set, when we deploy the app, the app still starts up automatically after deploy. What we want is a way to deploy the app to tomcat but NOT autostart such that we can do the edits on the parameters and then manually send a startup command to the app. We cannot shut down all of tomcat as there are multiple other apps running on this tomcat instance. We would also like for the app to still autostart on startup of tomcat (in case of unintended reboot), we just don't want it to autostart immediately after deploy. Is this possible? Are there other better ways of handling properties files that have variable configs?
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: jenkins
type: UnansweredQuestion

http://stackoverflow.com/a/23766215
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: I have found it. Generate a new ModuleInstall class, under the New->Other->Module Development->Installer/Activator menu. It will register that class to be run during startup (specifically the Restored() method). Put your LookAndFeel altering code in that method and you are good to go. NOTE: This was done with Netbeans 7.4
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23765550
accepted answer of: http://stackoverflow.com/q/23765550

http://stackoverflow.com/comment/36563197
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23775664
type: QuestionComment
has text: There is no such a thing as a "static class". There are static inner classes, but that's a different thing. What are you trying to do?

http://stackoverflow.com/q/23696170
linked to: http://stackoverflow.com/q/14332154
has answer: http://stackoverflow.com/a/23699826
linked to: http://stackoverflow.com/q/10422603
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has title: RMI Client- Server: java.rmi.ConnectIOException: error during JRMP connection establishment
has comment: http://stackoverflow.com/comment/81210309
upvote count: 2
score: 1
tagged with: rmi
tagged with: tcp
tagged with: java
downvote count: 1
type: Question
has body: I'm trying to establish RMI Client Server connectivity where Client and Server are behind different NAT/Firewall using TCP Hole punching mechanism. Currently, I could get the connectivity between client and Server using their Public Ip and port "80". After TCP connection is established I could retrieve the Stub info of RMIServer. Also, I could netstat and see the connection established. But When trying read the remote object I'm getting following exception java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.net.SocketTimeoutException: Read timed out at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:293) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:190) On monitoring the connectivity with netstat, I could see the TCP connection gets terminated immediately and its not stable. It would be helpful If I could get any hints on how to maintain or get a stable TCP connection. Thanks.

http://stackoverflow.com/comment/36374491
type: Comment
type: AnswerComment
has text: Thanks I'll try this as well and let you's know how it goes! :)
score: 0
comment on: http://stackoverflow.com/a/23676905

http://stackoverflow.com/comment/36312996
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23644947
has text: @TazMan Is it that hard to look up the implementations yourself then?
score: 0

http://stackoverflow.com/comment/36281292
type: QuestionComment
comment on: http://stackoverflow.com/q/23628761
has text: Include the exception in your question. And your problem is you are trying to access the database with the root user from a remote computer which is not allowed for security reasons.
score: 0
type: Comment

http://stackoverflow.com/comment/36286598
type: AnswerComment
type: Comment
score: 1
has text: @Tinus: Don't forget that your trying to work around [known problems with multiple frames](http://stackoverflow.com/q/9554636/230513). It may help if you explain the goal.
comment on: http://stackoverflow.com/a/23630460

http://stackoverflow.com/comment/36324084
type: QuestionComment
has text: why not you show as you doing it in case of input.
comment on: http://stackoverflow.com/q/23650824
score: 0
type: Comment

http://stackoverflow.com/comment/36378031
has text: Yeah I just updated my program, what I did is that when the user clicks I ran a function that had your code in it. Is that what I was supposed to do? I just tried it but it still freezes.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23678227

http://stackoverflow.com/comment/36546020
has text: @user3580294 You're right, although it won't reproduce as often as the presented code.
type: Comment
comment on: http://stackoverflow.com/q/23766615
score: 0
type: QuestionComment

http://stackoverflow.com/q/23749786
has title: "uses unchecked or unsafe operations"
type: Question
has answer: http://stackoverflow.com/a/55293234
downvote count: 0
favorite count: 0
has body: Why am I getting "uses unchecked or unsafe operations" error everytime i compile? What's wrong with the code? I copied the exact same code from this tutorial http://www.mkyong.com/java/json-simple-example-read-and-write-json/ import java.io.FileWriter; import java.io.IOException; import org.json.JSONArray; import org.json.JSONObject; public class JsonSimpleExample { public static void main(String[] args) { JSONObject obj = new JSONObject(); obj.put("name", "mkyong.com"); obj.put("age", new Integer(100)); JSONArray list = new JSONArray(); list.add("msg 1"); list.add("msg 2"); list.add("msg 3"); obj.put("messages", list); try { FileWriter file = new FileWriter("c:\\test.json"); file.write(obj.toJSONString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } System.out.print(obj); } }
answer count: 3
linked to: http://stackoverflow.com/q/197986
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/197986
upvote count: 24
has answer: http://stackoverflow.com/a/23749904
has comment: http://stackoverflow.com/comment/36513579
has comment: http://stackoverflow.com/comment/36514745
tagged with: java
score: 24
has answer: http://stackoverflow.com/a/49832115

http://stackoverflow.com/a/23623074
accepted answer of: http://stackoverflow.com/q/23622640
has comment: http://stackoverflow.com/comment/36270739
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23622640
has body: You can use multibindings for this: Multibinder&lt;AbstractTransformer&gt; multibinder = Multibinder.newSetBinder(binder(), AbstractTransformer.class); multibinder.addBinding().to(FirstTransformer.class); multibinder.addBinding().to(SecondTransformer.class); multibinder.addBinding().to(ThirdsTransformer.class); Then you can inject Set&lt;AbstractTransformer&gt;: @Inject CombinedTransformer(Set&lt;AbstractTransformer&gt; transformers) { // do whatever you want with the set } But you can't do it without using multibindings directly. If you really need to get a list of objects using statically known list of classes, you can write a wrapper around an injector and use it: public class ListInjectorWrapper { private final Injector injector; @Inject ListInjectorWrapper(Injector injector) { this.injector = injector; } @SafeVarargs public final &lt;T&gt; List&lt;T&gt; getList(Class&lt;? extends T&gt;... classes) { return Arrays.stream(classes).map(clazz -&gt; injector.getInstance(clazz)) .collect(Collectors.toList()); } } Then inject it and use it to get your transformers: @Inject CombinedTransformer(ListInjectorWrapper injectorWrapper) { transformers = injectorWrapper.getList( FirstTransformer.class, SecondTransformer.class, ThirdTransformer.class ); }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/36517664
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23752045
score: 0
has text: @SimplePlan what do you mean by this?

http://stackoverflow.com/q/23676152
has answer: http://stackoverflow.com/a/23676849
accepted answer: http://stackoverflow.com/a/23676849
upvote count: 1
answer count: 1
favorite count: 0
tagged with: datatable
type: AnsweredQuestion
has body: I have a problem: Here it is my TesztBean.java : import java.io.Serializable; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.bean.ViewScoped; import org.primefaces.event.RowEditEvent; import org.primefaces.model.LazyDataModel; @ManagedBean @SessionScoped public class TesztBean implements Serializable{ String URL = "jdbc:mysql://localhost:3306/osszesito?useUnicode=yes&characterEncoding=UTF-8"; String USER = "USER"; String PASSWORD = "PASSWD"; String DRIVER = "com.mysql.jdbc.Driver"; private List<TesztSetGet> filteredOsszesito; private List<TesztSetGet> values; private TesztSetGet select; public TesztSetGet getSelect() { return select; } public void setSelect(TesztSetGet select) { this.select = select; } @PostConstruct public void init() { try { values = selectTesztTable(); } catch (SQLException e) { e.printStackTrace(); } } public Connection getDBConnection() { Connection dbConnection = null; try { Class.forName(DRIVER); dbConnection= DriverManager.getConnection(URL, USER, PASSWORD); System.out.println("Connection completed."); } catch (SQLException e) { System.out.println(e.getMessage()); }catch(ClassNotFoundException cnfe){ cnfe.printStackTrace(); System.out.println(cnfe.getMessage()); System.exit(-1); } return dbConnection; } public List<TesztSetGet> selectTesztTable() throws SQLException{ ResultSet rs = null; PreparedStatement pst = null; Connection con = getDBConnection(); String stm = "select * from teszt order by age"; List<TesztSetGet> records = new ArrayList<TesztSetGet>(); try { pst = con.prepareStatement(stm); pst.execute(); rs = pst.getResultSet(); while(rs.next()){ TesztSetGet objectMeghiv = new TesztSetGet(); objectMeghiv.setId(rs.getInt(1)); objectMeghiv.setName(rs.get…
downvote count: 0
tagged with: dialog
score: 1
tagged with: java
has title: Datatable show dialog
type: Question
tagged with: primefaces

http://stackoverflow.com/a/23722289
downvote count: 0
has comment: http://stackoverflow.com/comment/36464428
has comment: http://stackoverflow.com/comment/36464117
type: Answer
has comment: http://stackoverflow.com/comment/36464007
has comment: http://stackoverflow.com/comment/36464450
has comment: http://stackoverflow.com/comment/36464261
upvote count: 1
answers question: http://stackoverflow.com/q/23722260
has body: You can write a .bat file to accomplish this. @javaw -jar path/to/jar/your.jar arguments (if your jar is an command prompt app, use @java) and then put this .bat file in startup directory. where is startup directory: In windows, you can click the Start button Picture of the Start button , click All Programs, right-click the Startup folder, and then click Open.
score: 1
has comment: http://stackoverflow.com/comment/36464143
has comment: http://stackoverflow.com/comment/36464091
has comment: http://stackoverflow.com/comment/36462357

http://stackoverflow.com/comment/36306198
type: AnswerComment
comment on: http://stackoverflow.com/a/23640681
score: 0
has text: Still... maven is not the answer when the question is "How do I use this IDE?"
type: Comment

mongodb-java
tags question: http://stackoverflow.com/q/23748868
tag name: mongodb-java
type: Tag
tags question: http://stackoverflow.com/q/23713038

http://stackoverflow.com/q/23641296
has comment: http://stackoverflow.com/comment/36306155
score: 0
has comment: http://stackoverflow.com/comment/36401603
type: UnansweredQuestion
tagged with: android
has body: private String[] navMenuTitles; private TypedArray navMenuIcons; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; private NavDrawerListAdapter adapter; navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons); navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;(); navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, 0))); Logcat shows that the problem is with the last line i.e. navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, 0)));
answer count: 0
has comment: http://stackoverflow.com/comment/36305692
tagged with: java
has title: getting error in setting navigation drawer
tagged with: navigation-drawer
type: Question

http://stackoverflow.com/a/23650965
accepted answer of: http://stackoverflow.com/q/23650768
has comment: http://stackoverflow.com/comment/36324142
score: 1
upvote count: 1
has body: Could you just create a super interface e.g. IBankData and have your Bank and BankArchive both implementing that interface and pass in the interface? If you really have some specific logic as per Bank/BankArchive, you can do public class MyClass&lt;T extends IBankData&gt; { public void copyData(T instance) { T.getFieldXXX() // this would work because T extends IBankData if (T instanceof Bank) { ((Bank) T).getBankSpecificField(); } } } BTW - just my 2 cents - in a well designed structure, you normally don't have to do instanceof unless at the logical facade / dispatching class.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23650768
downvote count: 0
has comment: http://stackoverflow.com/comment/36324255
has comment: http://stackoverflow.com/comment/36324383
has comment: http://stackoverflow.com/comment/36348354
type: Answer

http://stackoverflow.com/comment/36420220
comment on: http://stackoverflow.com/q/23700951
score: 2
has text: Btw, have you read [this topic](http://meta.stackoverflow.com/questions/251758/why-is-stack-overflow-so-negative-of-late)?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23698281
has comment: http://stackoverflow.com/comment/36427567
has comment: http://stackoverflow.com/comment/36414587
type: Answer
has comment: http://stackoverflow.com/comment/36429002
has body: When you say (DataBaseConfig) is not working properly : Do you have somes Exceptions and a StackTrace returned by the Spring Container. Try To launch your app in debug/trace mode to see what happen exactly.
answers question: http://stackoverflow.com/q/23697818
score: 0

http://stackoverflow.com/comment/36316509
score: 0
comment on: http://stackoverflow.com/q/23646745
type: QuestionComment
has text: @SachinG it should not work because why to use implement then, if its of no use then why?
type: Comment

http://stackoverflow.com/a/23749904
has body: The uses unsafe or unchecked operations warning is displayed when you execute code which the Java compiler considers to be lacking in error-checking, or potentially unsafe in some way. However, it's a warning, not an error, and will not stop your code from compiling -- large projects will often churn out warning after warning, and you're free to determine whether they're worth taking action on or not. If you want to dig deeper into what's causing the warning to trigger, you can recompile your .java file with the syntax javac -Xlint:unchecked yourfilename.java, and the compiler will give you more verbose information as to what exactly is causing the error. In my experience, this warning can often be caused by using something like an ArrayList without specifying the type which it should expect to hold (i.e. using ArrayList a = new ArrayList() rather than ArrayList&lt;String&gt; a = new ArrayList&lt;String&gt;()). The compiler is, in my example case, warning you that your code isn't going to do any checking for you that the values you add to it are any particular type. In a production application, it would likely be good to specify types, but in a test app, you're free to ignore the warnings if you're not concerned about them.
downvote count: 0
upvote count: 64
has comment: http://stackoverflow.com/comment/133381157
score: 64
answers question: http://stackoverflow.com/q/23749786
type: Answer

http://stackoverflow.com/comment/115962219
type: Comment
comment on: http://stackoverflow.com/a/51387785
score: 0
type: AnswerComment
has text: don't think that pair is the best solution. you could create some POJO for this reason. With Java 15 it could use records.

http://stackoverflow.com/comment/36493633
comment on: http://stackoverflow.com/a/23739407
type: Comment
has text: @Vishrant : Yes, Answer updated. Compiler can't choose, if there are multiple hierarchies.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36423903
type: QuestionComment
comment on: http://stackoverflow.com/q/23702926
score: 2
has text: What is your expected output? 23 and 20 aren't printable characters, 34 is `"`, 65 is `A`, 88 is `X`, and 95 is `_`.
type: Comment

http://stackoverflow.com/q/23752029
downvote count: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/23752300
favorite count: 0
accepted answer: http://stackoverflow.com/a/23752300
has answer: http://stackoverflow.com/a/23755863
has title: What is the equivalent of the method attribute of <intercept-url> in JavaConfig?
upvote count: 1
tagged with: spring
type: Question
has body: I'm trying to secure certain parts of a REST service using Spring Security 3.2 using JavaConfig and no XML. In particular I would like to limit access to an end point to be anonymous for a POST operation, and for all other operations to default to the rest of my configuration. I've checked the Spring Security API docs and their reference documentation, however, I'm not seeing anything that does the equivalent of restricting an access check based on the HTTP method. For example, in XML you can do something like: &lt;intercept-url pattern="/users/**" method='POST' /&gt; But I see nothing similar in the JavaConfig builders. Is it possible to do this without XML? Thanks! Edited 5/20/2014: Changing sample XML to only show the HTTP method.
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23755863
tagged with: spring-java-config
answer count: 2

http://stackoverflow.com/comment/36388196
type: Comment
comment on: http://stackoverflow.com/a/23683901
type: AnswerComment
has text: Unfortunately, none of the other events is called, too.
score: 0

http://stackoverflow.com/comment/36484098
type: QuestionComment
has text: Even if I did integrate everything in rev(), into add(), it would not change the time complexity much. However, calling rev() once instead of twice would eliminate repetitive processing, and optimize the code. At the end of the day, it boils down to a few things: personal style; code readability; design pattern(s) and; portability.
comment on: http://stackoverflow.com/q/23729406
score: 0
type: Comment

http://stackoverflow.com/comment/36592609
has text: Thank you. Knowing this limitation led me to use spring @Scheduled annotation with a cron expression to launch that job on all cluster nodes. This hybrid approach is working pretty well.
comment on: http://stackoverflow.com/a/23673652
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/comment/36427772
comment on: http://stackoverflow.com/q/23690466
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Unfortunately MyApp has stopped. How can I solve this?](http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this)

http://stackoverflow.com/comment/36375150
type: Comment
comment on: http://stackoverflow.com/a/23676659
has text: I understand, but setUndecorated() should solve that. As seen in the screenie it does actually cover the entire screen.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36466062
comment on: http://stackoverflow.com/a/23723692
type: AnswerComment
has text: @user3649285 Glad I could help! Anyway, you have to get confortable with creating multiple classes, it's not something difficult to do rather it makes your code more clear and scalable.
score: 0
type: Comment

http://stackoverflow.com/comment/36450141
type: QuestionComment
has text: You basically need to use session attributes, in one way or another. Or persist and retrieve the object.
comment on: http://stackoverflow.com/q/23716732
score: 0
type: Comment

http://stackoverflow.com/a/23787901
upvote count: 2
score: 2
has body: Finally i got a solution for my problem, I just added out.flush() after out.println(line);So its flushing output to browser each time in while loop and its looks like unix terminal . Below code did the magic. pb = new ProcessBuilder("/bin/sh",script); pb.directory(new File(filePath)); p = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = reader.readLine()) != null){ System.out.println(line); out.println(line); out.flush(); } p.waitFor(); System.out.println ("exit: " + p.exitValue()); out.println("exit: " + p.exitValue()); p.destroy(); out.println("Script Executed");
answers question: http://stackoverflow.com/q/23679898
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23679898
type: Answer

http://stackoverflow.com/a/23696203
downvote count: 0
score: 1
has body: You can try like this String[] vals = "Hello??Man?HowAreYou????".split("\\?+"); System.out.println(vals[0]+vals[1]+vals[2]); OUTPUT HelloManHowAreYou But as aname=????? you want to get you can replace the ????? Five Question Marks with Other Symbol and replace back to ????? after split String processed="Hello????Good? ? ....???".replace("????","*"); OUTPUT Hello*Good? ? ....??? And than use split for ?
answers question: http://stackoverflow.com/q/23695951
has comment: http://stackoverflow.com/comment/36414012
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36411963

http://stackoverflow.com/q/23637300
has comment: http://stackoverflow.com/comment/36314106
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/36300219
has body: I am new to EJB and trying to create a EJB Application..But when I deploy my project after creating entity class and session class, I am getting the following error... Initial deploying contact to F:\JavaAptech\contact\dist\gfdeploy\contact Completed initial distribution of contact GlassFish Server 4, deploy, null, false F:\JavaAptech\contact\nbproject\build-impl.xml:307: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 1 second) Can anyone help me ??
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36298787
has title: The module has not been Deployed [Glassfish 4.0]
answer count: 0
tagged with: java
tagged with: glassfish-4
tagged with: web-applications
upvote count: 1

http://stackoverflow.com/a/23633722
type: Answer
has body: I think this occurs when you have a android:onClick attribute in yout layout which references an Activity method that does not exist. The system has to use reflection to look for the method, which can be dangerous. I suggest that you never use this attribute in your views and always set a View.OnClickListener to you clickable views by code.
score: 1
has comment: http://stackoverflow.com/comment/36292261
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36294098
answers question: http://stackoverflow.com/q/23632831
has comment: http://stackoverflow.com/comment/36293288
has comment: http://stackoverflow.com/comment/36291520

http://stackoverflow.com/comment/36413855
type: Comment
comment on: http://stackoverflow.com/a/23697168
type: AnswerComment
score: 0
has text: all options in Eclipse and Workbench are default!

http://stackoverflow.com/q/23664728
downvote count: 0
has comment: http://stackoverflow.com/comment/64463640
favorite count: 0
has body: I'm trying to connect my web application using Spring MVC and Hibernate to a CloudBees - MySQL database using the parameters they provide. The URL to connect to the MySQL database should have the following syntax: jdbc:mysql://[xxx-xxx-xxx-xxx].compute-1.amazonaws.com:3306/MyDatabase When I'm trying to connect to my database using MySQL Workbench I can query to the database without problems. However, when I'm starting my web application on Eclipse I have the following error message: java.sql.SQLException: Connections could not be acquired from the underlying database! This is the error log I'm getting: [ERROR] [localhost-startStop-1 03:03:24] (JDBCExceptionReporter.java:logExceptions:101) Connections could not be acquired from the underlying database! [ERROR] [localhost-startStop-1 03:03:32] (JDBCExceptionReporter.java:logExceptions:101) Connections could not be acquired from the underlying database! [ERROR] [localhost-startStop-1 03:03:32] (SchemaValidator.java:validate:135) could not get database metadata java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:130) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at …
has comment: http://stackoverflow.com/comment/36403999
has comment: http://stackoverflow.com/comment/36358659
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36352751
tagged with: spring-mvc
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/36392483
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/36384995
upvote count: 1
type: Question
tagged with: cloudbees
has title: Spring MVC and CloudBees MySQL database: Connections could not be acquired from the underlying database error

http://stackoverflow.com/comment/36272216
has text: You don't have to update the db with the replaced string. You can replace strings read from the db and just ignore it after comparison.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23624188

http://stackoverflow.com/comment/36505445
has text: James is there an example that traverses all text nodes so i can modify them. It needs to be dynamic, I am not looking for a specific tag.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23743417

http://stackoverflow.com/a/23655604
downvote count: 0
has comment: http://stackoverflow.com/comment/36348462
has comment: http://stackoverflow.com/comment/36364888
type: Answer
answers question: http://stackoverflow.com/q/23655064
score: 3
has comment: http://stackoverflow.com/comment/36338247
has comment: http://stackoverflow.com/comment/36352100
has body: Triple DES is by definition 168 bits (although dependent on the selected option, the key (excluding parity bits) may actually only be 56 or 112 bits instead of 168 bits). There is no way to extend the key length. If you need a longer key length, then you should use an encryption algorithm that supports that key length. There is no need to "prove" this as you ask, as it is described in the standard documents. Also note that by today standards, DES is considered very weak and Triple DES is considered relatively weak (especially with keying option 2 and 3). I'd suggest you go for a more modern and stronger algorithm like AES.
upvote count: 3

http://stackoverflow.com/a/23632269
has body: According to Finds Bug Description. Method ignores exceptional return value Method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23631922
upvote count: 2

http://stackoverflow.com/comment/36460209
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23721942
has text: May be `index.jsp` is outside the WEB-INF folder directly under the wepapp (war).
score: 0

http://stackoverflow.com/comment/36378902
comment on: http://stackoverflow.com/a/23679150
score: 0
type: Comment
has text: specifically out of curiosity: Do TLD names like 'ninja' or 'berlin' apply to the rule?
type: AnswerComment

http://stackoverflow.com/a/23643812
type: Answer
accepted answer of: http://stackoverflow.com/q/23642567
upvote count: 6
has body: First of all, the ultimate guide for calling into Frege from Java is this wiki page. It explains, among others, how frege data declarations appear in Java code. The only special thing about lists is that there is no explicit Frege declaration of it anywhere, but we can assume that it looks like: data List a = List | Cons a (List a) Note that the identifier List after the equal sign is the constructor for empty lists, usually called Nil. The reason that it is called List (the same as the type) is because the routine for mangling frege names into valid java names translates [] into List. And in Frege source code we use [] as the type name and the constructor name as well. Here is the outline of the Java code corresponding to the above: public interface TList extends frege.runtime.Value, frege.runtime.Lazy { public TList.DCons _Cons() ; public TList.DList _List() ; final public static class DCons extends frege.runtime.Algebraic implements TList { private DCons(final java.lang.Object arg$1, final frege.runtime.Lazy arg$2) { mem1 = arg$1; mem2 = arg$2; } final public static TList mk(final java.lang.Object arg$1, final frege.runtime.Lazy arg$2) { return new DCons(arg$1, arg$2); } final public DCons _Cons() { return this; } final public TList.DList _List() { return null; } final public java.lang.Object mem1 ; final public frege.runtime.Lazy mem2 ; } final public static class DList extends frege.runtime.Algebraic implements TList { private DList() {} final public static TList mk() { return it; } final public static DList it = new DList(); final public DList _List() { return this;} final public TList.DCons _Cons() { return null; } } } As you see, the overall type is an interface TList. The only thing you can do with a list is to check the variant, for this we have the methods _List() and _Cons(). As you correctly observed, _Cons() returns null for the empty list, and a TLIst.DCons instance for a non-empty list. From there you can extract the head (mem1) and the tail (mem2). …
answers question: http://stackoverflow.com/q/23642567
type: AcceptedAnswer
downvote count: 0
score: 6

splash-screen
tags question: http://stackoverflow.com/q/23724857
type: Tag
tag name: splash-screen
tags question: http://stackoverflow.com/q/23710221
tags question: http://stackoverflow.com/q/23703150

http://stackoverflow.com/comment/108511213
score: 3
comment on: http://stackoverflow.com/a/24067116
type: AnswerComment
has text: Nice solution, but you should count "black" pixels instead of white, because if you will found 1% of black pixels, it will mean that page "is not blank" instead of scan all page for searhing 99% of white pixels.
type: Comment

http://stackoverflow.com/comment/36479077
comment on: http://stackoverflow.com/q/23731605
score: 0
type: Comment
type: QuestionComment
has text: Why occurs `IllegalMonitorStateException`?

http://stackoverflow.com/comment/36524924
type: AnswerComment
type: Comment
has text: '@ManyToMany' is right option, cause different users can have the same group. Adding cascade=CascadeType.ALL to '@ManyToMany' didnt help, exception still occurs.
score: 0
comment on: http://stackoverflow.com/a/23753697

http://stackoverflow.com/q/23652098
tagged with: java
linked to: http://stackoverflow.com/q/5673059
downvote count: 1
type: Question
has body: I have a maven web application in which I use JSF and spring. I want to parse a csv uploaded file with fileUploadListener. The file is uploaded, but I don't know how to get data from it and store it in database: <h:outputLabel value="Choose your file : *" /> <p:fileUpload mode="advanced" fileUploadListener="#{campagneMB.handleFileUpload}" update="growl" sizeLimit="4000000" allowTypes="/(\.|\/)(csv)$/"/> my file has this form: xxxx#xxxxx#xxxxx
has answer: http://stackoverflow.com/a/23653333
has title: parsing uploaded csv file with JSF ManagedBean
tagged with: jsf-2
upvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv
tagged with: maven
score: -1
tagged with: jsf
type: UnansweredQuestion

http://stackoverflow.com/a/23703090
has body: The type double can only represent certain fractions. The expression 1.0/3.0 yields doesn't yield the fraction "one third", but rather selects the closest fraction which double is capable of representing. Among the roughly 18,000,000,000,000,000,000 fractions double can represent, the one closest to one third is 6004799503160661/18014398509481984, and so the expression 1.0/3.0 yields that precise value. While the actual fraction "one third" would be infinitely long when expressed in decimal or binary format, the closest double is not "infinite" in any sense of the word; even writing it out in decimal format would only require 54 digits to the right of the decimal point.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23702950
upvote count: 2
type: Answer

http://stackoverflow.com/q/23760537
has answer: http://stackoverflow.com/a/23760637
has comment: http://stackoverflow.com/comment/36533572
tagged with: java
has body: I am getting two errors in this code Constructor call must be the first statement in a constructor. Implicit super constructor Parent() is undefined. Must explicitly invoke another constructor. So please help me to resolve these issues. class Parent { public Parent(int x, int y,int z) { System.out.println("Created Parent"); } } public class Child extends Parent { Child(int x)// error 2 { } Child(int x, int y)// error 2 { } Child(int x, int y, int z) { this(x); super(x,y,z);// error 2 System.out.println("Creating child"); this(x,y);// error 1 } public static void main(String [] args) { Child c=new Child(1,2,3); } }
type: Question
has title: "Constructor call must be the first statement in a constructor" getting error in Java code?
has answer: http://stackoverflow.com/a/23761007
tagged with: inheritance
score: 0
has answer: http://stackoverflow.com/a/23760626
has answer: http://stackoverflow.com/a/23760621
tagged with: constructor
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23760807

http://stackoverflow.com/q/23646069
has comment: http://stackoverflow.com/comment/36314726
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23646170
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36316925
type: Question
has comment: http://stackoverflow.com/comment/36314756
accepted answer: http://stackoverflow.com/a/23648051
has answer: http://stackoverflow.com/a/23646101
has answer: http://stackoverflow.com/a/23646155
has body: File contents: -- file.txt -- First Line Second Line Desired new file contents: Second Line First Line How can I invert the file contents as shown above per the following code? String text = "First Line.\nSecond Line."; System.out.println(text); text = StringUtils.reverse(text); // scan line by line and reverse each line individually? System.out.println(text); I understand the logic behind the solution to reverse the string then then scan each line and reverse each line individually but I'm not very good with java. Can I use StringBuffer, BufferReader? Also, is it possible to use a util that does the second part for me (scan each line and reverse the contents) as opposed to iterating line by line? There could also be unicode and or special characters so I'm afraid that too much custom trickery code will break the original contents. NOTE: This is a very simple example. The file/input could get up to 10K-20K in size. After inverting file contents I need to fit the contents in a string, which I already do (when it first comes into my method) in order to run some regex's on it. So, I need the entire buffer available for that requirement not just doing operations line by line or printing out the file contents.
possible better answer: http://stackoverflow.com/a/23646101
downvote count: 0
favorite count: 0
has title: Inverting file contents?
has answer: http://stackoverflow.com/a/23648051
upvote count: 1
answer count: 4

http://stackoverflow.com/comment/36329002
score: 1
comment on: http://stackoverflow.com/q/23648397
type: Comment
has text: Were you doing `track` and `follow` at the same time? (I see that `track` is currently commented out).
type: QuestionComment

http://stackoverflow.com/q/23639654
linked to: http://stackoverflow.com/q/7298731
possible better answer: http://stackoverflow.com/a/23639774
has body: The logcat complains about something with the alertDialog.show(). when i comment out the below posted method, the app works, otherwise, it crashes. Please let me know where the error is. Java Code: private void takePictureOrDoNot() { // TODO Auto-generated method stub AlertDialog.Builder mAlertDialogBuilder = new AlertDialog.Builder(getApplicationContext()); mAlertDialogBuilder.setTitle("Picture For Your Location."); mAlertDialogBuilder .setMessage("Do You Want To Take a Picture Of Your Location?") .setCancelable(true) .setPositiveButton("YES", mDialogAlertPositiveButtonSetListener) .setNegativeButton("NO", mDialogAlertNegativeButtonSetListener); AlertDialog mAlertDialog = mAlertDialogBuilder.create(); mAlertDialog.show(); } Logcat: 05-13 22:05:32.766: E/AndroidRuntime(26463): FATAL EXCEPTION: main 05-13 22:05:32.766: E/AndroidRuntime(26463): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.ViewRootImpl.setView(ViewRootImpl.java:802) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:288) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:73) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.app.Dialog.show(Dialog.java:287) 05-13 22:05:32.766: E/AndroidRuntime(26463): at com.example.meetingpointlocator_03.AddNewLocationActivity$3.takePictureOrDoNot(AddNewLocationActivity.java:185) 05-13 22:05:32.766: E/AndroidRuntime(26463): at com.example.meetingpointlocator_03.AddNewLocationActivity$3.onKey(AddNewLocationActivity.java:150) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.View.dispatchKeyEvent(View.java:7672) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1485) 05-13 22:05:32.766: E/AndroidRuntime(26463): at android.view.ViewGroup.dispatchKeyEvent(ViewGrou…
accepted answer: http://stackoverflow.com/a/23639698
has answer: http://stackoverflow.com/a/23639774
score: 0
answer count: 2
has title: AlertDialog Builder throws an error
tagged with: android
has answer: http://stackoverflow.com/a/23639698
tagged with: android-alertdialog
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36302301

http://stackoverflow.com/comment/36520010
type: Comment
comment on: http://stackoverflow.com/a/23748266
score: 1
type: AnswerComment
has text: That said, I am seeing some weird results with JMH - probably due to the short runtime that does not allow for the extra garbage to become an issue...

http://stackoverflow.com/comment/36522902
type: Comment
has text: I'm not going to ask why in Gods name you are composing the `User` object into itself, and just roll with it. I've updated my answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23753697

http://stackoverflow.com/q/23656615
has answer: http://stackoverflow.com/a/23656664
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/36341177
has comment: http://stackoverflow.com/comment/36335573
type: Question
score: 0
answer count: 2
tagged with: jsp
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/36336758
has comment: http://stackoverflow.com/comment/36339996
has title: What can I do if I insist want to load image from local C drive to my IE9 browser?
has comment: http://stackoverflow.com/comment/36340494
has body: Like most of the people has asked the similar question. But so far, I didn't found a solution yet. var img = [ C:/a/b/1.png, C:/a/b/2.png ]; $j.each(img, function(){ $j('#imagesList').append('&lt;li&gt;&lt;img src=file:///"' + this + '" /&gt;&lt;/li&gt;'); });
has comment: http://stackoverflow.com/comment/36384920
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23656688
has comment: http://stackoverflow.com/comment/36343659

http://stackoverflow.com/a/23646565
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23630094
has body: If you rely on the ClientResource class, you can add a MediaType parameter to your put call, such as put(myPojo, MediaType.APPLICATION_JSON); UPDATE Actually, the extra media type parameter defines the accepted result type expected from the remote resource, but doesn't apply to the sent entity. The control on the media type of the entity/POJO sent is based on the ConverterService default settings, which depends on the extensions available on your classpath and their respective order. You can have full control by directly invoking the ClientResource cr = new ClientResource("http://targetDomain/path"); cr.put(cr.toRepresentation(myPojo, new Variant(MediaType.APPLICATION_JSON)); You also need to add the org.restlet.ext.jackson extension on your classpath and its dependencies. The XStream extension is another option.
answers question: http://stackoverflow.com/q/23630094
has comment: http://stackoverflow.com/comment/36350005
has comment: http://stackoverflow.com/comment/46658160
has comment: http://stackoverflow.com/comment/36316774
upvote count: 1
has comment: http://stackoverflow.com/comment/36484404
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23773244
type: AnsweredQuestion
has title: Beginner in java game development
tagged with: opengl
accepted answer: http://stackoverflow.com/a/23773352
tagged with: java
type: Question
has body: I want to get into game development with Java, and would like to export the game to mobile devices in the future (both android and IOs). I have some background in Java, and wants to make simple game with it first for practice. Game tutorials that I have came across with java tutorial uses JFrame, JPanel, and canvas to draw the game. I, also, ran across tutorial started off using teaching GraphicsDevice api in java.awt library. I am confused. From the description of the GraphicsDevice api, I think it allows the game to be full screen; however, isn't that achievable with JFrame already? Can anyone tell me whats the difference with and without GraphicsDevice api? Also, I came across some posts suggesting OpenGL EU. If I understand correctly, it allows game graphics performance to be boosted. Is it encouraged to use OpenGL for every game? Is it something similar to GraphicsDevice api? If yes, I would assume it can not co-exist in the same game with GraphicsDevices api; otherwise, I would assume they can co-exist and the game can take advantage of both api. Correct me if I am wrong...I am really not understanding much so far.
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36558584
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/23773352
downvote count: 1

http://stackoverflow.com/q/23696711
upvote count: 5
downvote count: 0
tagged with: surfaceview
tagged with: main-activity
tagged with: android
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/51409000
has comment: http://stackoverflow.com/comment/57755325
tagged with: video
answer count: 0
tagged with: java
has body: I have a problem with my SurfaceView, i need it for display video, i put transparent background to don't see a black screen in background when video is on load, and don't see black lines when scrolling while video is playing. My application display videos, like instagram (same style). The problem is, the surfaceview/video is displayed over the anctionbar, and i don't want this. I know the problem is "setZOrderOnTop" but if i remove it, i'll get back the black background and scrolling problem. So, any idea ? That's my code: //Video Video.setZOrderOnTop(true); final SurfaceHolder surfaceHolder = Video.getHolder(); surfaceHolder.setFixedSize(taillePreview, taillePreview); surfaceHolder.setFormat(PixelFormat.TRANSPARENT); surfaceHolder.addCallback(MainActivity.this); Thank's for helping.
type: Question
has title: SurfaceView over actionBar because of setZOrderOnTop
score: 5

http://stackoverflow.com/q/23714596
has comment: http://stackoverflow.com/comment/36445760
tagged with: null-layout-manager
tagged with: java
has comment: http://stackoverflow.com/comment/36445818
type: Question
tagged with: layout
downvote count: 0
has title: How to add few the same image in one program by using JLabel?
linked to: http://stackoverflow.com/q/7180198
has comment: http://stackoverflow.com/comment/36445812
answer count: 3
has answer: http://stackoverflow.com/a/23714921
has body: I'm using Swing and I'm trying to add some picture in program. field = new JFormattedTextField(formatter); ImageIcon icon = new ImageIcon("background.png"), icon1 = new ImageIcon("1.png"); JLabel background = new JLabel(icon); JLabel firstIcon = new JLabel(icon1); JPanel center = new JPanel(new GridLayout(0, 1)); public void initComponents() { this.getContentPane().add(center, BorderLayout.CENTER); center.add(background); field.setBounds(50,50); background.add(field); background.add(fristIcon); } With this code is everything working, but when I try to add the same picture "background.add(fristIcon);" again I don't see image added first. Every new image is deleting last icon.
possible better answer: http://stackoverflow.com/a/23714647
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/23714647
upvote count: 2
has answer: http://stackoverflow.com/a/23715364
linked to: http://stackoverflow.com/q/10055005
accepted answer: http://stackoverflow.com/a/23714921
tagged with: swing
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/49159960
score: 0
comment on: http://stackoverflow.com/a/23764927
type: Comment
has text: This is necessary to do after switching JDK. However, there is no indication anywhere in Android Studio of what the actual problem is. The build just fails silently.
type: AnswerComment

http://stackoverflow.com/a/23641992
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23641872
score: 0
answers question: http://stackoverflow.com/q/23641872
type: Answer
has body: Logic similar to this should work. You want to save the user input to a String variable, and then compare it to an n sized array. for(int i=0; i&lt;arrayName.length();i++) { if(userinputString.equalsIgnorCase(arrayName[i]) { System.out.println("HUrray!"); }//end if }//end for Ok so you are somehow producing a random number, and then need to compare the input to the String in the capital Array for that random number/ Im assuming the arrays are ordered such that capitals[10] gives you the capital for states[10]. If so, just save the index to a variable. int ranNum=RandomNumFunction(); Then just see if if(capitals[ranNum].equalsIgnoreCase(userInput)) //do something

http://stackoverflow.com/a/23686376
type: AcceptedAnswer
downvote count: 0
score: 17
answers question: http://stackoverflow.com/q/23686281
has body: you must use attribute name of your class instead of column name when you are using entity manager. ("select a from " + Account.class.getName() +" a where a.ACCOUNT_NO LIKE :searchKeyword ", Account.class) to ("select a from " + Account.class.getName() +" a where a.accountNo LIKE :searchKeyword ", Account.class)
type: Answer
accepted answer of: http://stackoverflow.com/q/23686281
upvote count: 17

http://stackoverflow.com/comment/36559098
type: QuestionComment
has text: What is wrong with what you've got...?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23773490

http://stackoverflow.com/q/23714726
has answer: http://stackoverflow.com/a/23714816
has title: What is wrong with the way I'm setting up my listview?
possible better answer: http://stackoverflow.com/a/23714816
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23714745
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36446085
has body: Here's my main activity: package com.dannytsegai.worldgeography; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends ListActivity { private ListView listview; private String[] mContinents; private ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listview = (ListView) findViewById(R.id.list); mContinents = getResources().getStringArray(R.array.continents_array); adapter = new ArrayAdapter<String>(this, R.layout.simple_list_item, mContinents); listview.setAdapter(adapter); } } Here's my main layout: <?xml version="1.0" encoding="utf-8"?> I've gone through the code, but I can't figure out what's wrong with it for the life of me. Can someone please help me?
has comment: http://stackoverflow.com/comment/36446107
has answer: http://stackoverflow.com/a/23717701
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23714745
has comment: http://stackoverflow.com/comment/36445986

http://stackoverflow.com/q/23688955
favorite count: 0
has body: I need to use a nested for loop in Java to make a triangle like this ******** ******* ****** ***** **** *** ** * Heres my code: for (int i=8; i&gt;0; i--) { for (int j=0; j&lt;i; j++) { System.out.print('#'); } System.out.println(""); } I get a triangle but not the one i want. Instead, my triangle looks like this: ******** ******* ****** ***** **** *** ** *
has answer: http://stackoverflow.com/a/23689461
has comment: http://stackoverflow.com/comment/36399723
has answer: http://stackoverflow.com/a/23689237
type: UnansweredQuestion
tagged with: loops
downvote count: 7
has title: How to make a triangle with a nested for
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24016560
tagged with: for-loop
answer count: 3
upvote count: 0
tagged with: nested
has comment: http://stackoverflow.com/comment/36398076
score: -7
has comment: http://stackoverflow.com/comment/36399822

http://stackoverflow.com/comment/36278777
type: Comment
has text: The problem can arise when your `BigDecimal` doesn't fit in the `NUMERIC(10, 0)`.
comment on: http://stackoverflow.com/q/23627476
score: 0
type: QuestionComment

http://stackoverflow.com/a/23749737
type: AcceptedAnswer
has body: Try passing this argument: -J-Duser.language=en. See this post: Passing "-J-Duser.language" into javac through ant to ensure compilation errors are reported in the correct language
downvote count: 0
has comment: http://stackoverflow.com/comment/139205976
accepted answer of: http://stackoverflow.com/q/23749714
type: Answer
answers question: http://stackoverflow.com/q/23749714
has comment: http://stackoverflow.com/comment/94747694
has comment: http://stackoverflow.com/comment/36516647
has comment: http://stackoverflow.com/comment/36516773
score: 15
upvote count: 15

playframework-1.x
tags question: http://stackoverflow.com/q/23672149
type: Tag
tags question: http://stackoverflow.com/q/23619009
tag name: playframework-1.x

http://stackoverflow.com/q/23662835
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23662968
tagged with: java
has comment: http://stackoverflow.com/comment/36347827
has comment: http://stackoverflow.com/comment/36349013
answer count: 2
has answer: http://stackoverflow.com/a/23663427
has body: My friend and me are making a multiplayer game for mobile devices . We have trouble calculating the approximate waiting time for the games. Every game needs 6 players to join. We know how many people are playing (1 game takes 2-3 minutes). We also know how many players are online and how many are looking for games already( &lt; 6). Can I calculate the time based on these info?
score: 0
has comment: http://stackoverflow.com/comment/36347932
accepted answer: http://stackoverflow.com/a/23663427
has answer: http://stackoverflow.com/a/23662968
has comment: http://stackoverflow.com/comment/36348041
has title: Approximate waiting time
has comment: http://stackoverflow.com/comment/36348618

http://stackoverflow.com/q/23650021
tagged with: weblogic
has comment: http://stackoverflow.com/comment/36328494
has comment: http://stackoverflow.com/comment/36323804
has body: I have encountered a problem when setting up a Data Source in Oracle WebLogic Server that is an AS400. When setting it up and testing the connection I get the error message: "The application requester cannot establish the connection" When checking on IBMs website I found the following: What does "The application requester cannot establish the connection" mean? The Toolbox JDBC driver uses the system name, user ID, and password provided in the call to DriverManager.getConnection() to establish a connection to the IBM i database. If any of these are not provided, the Toolbox JDBC driver will display a sign-on prompt. If the Toolbox JDBC driver can not sign on to the system for any reason, it will throw an SQLException with the message "The application requester cannot establish the connection". Here is a list of potential causes for this exception: The system name is incorrect. One way to verify this is to use ping with the specified system name. If ping fails, then there is a TCP/IP configuration problem between your client and the system. The user ID or password is incorrect. The IBM i database host server is not started. You can start this by running STRHOSTSVR *DATABASE on the IBM i command line. You can verify if the IBM i database host server is running using the utilities.JPing application. (http://www-03.ibm.com/systems/power/software/i/toolbox/faq/jdbc.html#faqC6) When I ping the server, it fails - which also makes sense. However, when I use just a plain java file that opens a connection, fires an sql and closes the connection like connection1 = DriverManager.getConnection("server", "user", "password") Statement statement1 = connection1.createStatement(); ResultSet result1 = statement1.executeQuery("SQLquery") i get a perfect connection and correct result. How is this possible? How can I connect via WebLogic and ODI? PS: I already installed the AS400 driver according to this manual
has comment: http://stackoverflow.com/comment/36328847
has comment: http://stackoverflow.com/comment/36328988
score: 0
has comment: http://stackoverflow.com/comment/36329920
has comment: http://stackoverflow.com/comment/36333076
has comment: http://stackoverflow.com/comment/36328109
has comment: http://stackoverflow.com/comment/36328425
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36323607
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36329642
has comment: http://stackoverflow.com/comment/36322659
has title: Connecting to AS400/iSeries using Oracle WebLogic Server
answer count: 0
tagged with: java
tagged with: ibm-midrange
type: Question

http://stackoverflow.com/comment/36304752
comment on: http://stackoverflow.com/q/23640809
has text: [Look at this.](http://www.skylit.com/javamethods/faqs/createjar.html) A simple google search would have saved some time :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23624374
score: 1
tagged with: java
tagged with: servlets
type: Question
answer count: 1
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23624573
favorite count: 0
has body: I have global static boolean variable defined in struts-action class. How do i change its value from other Action class. public class MyAction extends Action{ public static boolean existsFlag = false; public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { int a=10; if(a==10){ existsFlag = true; // is this ok to use } return mapping.findForward("successDisplayForm"); } } Also I have another Action class, where i want to set this value to 'false' when transaction gets completed. Please help. Note : Using Struts-1.3
upvote count: 1
tagged with: struts-1
has title: How to change the static global variale declared in struts action class
has answer: http://stackoverflow.com/a/23624573
type: AnsweredQuestion

http://stackoverflow.com/comment/36308536
type: Comment
has text: Secondly, Your question prompted me in the right direction. Initially I thought as stated "I close the application (I do this by simply closing the browser)". In hindsight, and reviewing the first point, that is not correct. The application finishes when I stop the server. And low and behold when I stop the server the message "Context Destroyed" is displayed.
comment on: http://stackoverflow.com/a/23624362
type: AnswerComment
score: 0

http://stackoverflow.com/q/23721722
has answer: http://stackoverflow.com/a/23721883
type: Question
favorite count: 0
has comment: http://stackoverflow.com/comment/36459820
answer count: 1
has title: Solution(strategy) for n size Tic-Tac-Toe map
has comment: http://stackoverflow.com/comment/36459897
has comment: http://stackoverflow.com/comment/36460185
upvote count: 2
type: UnansweredQuestion
score: -4
has body: As I know TicTacToe is a solved game. I want to create a strategy for computer player on which basis he will decide where(on which) put cross. In my game the game board is: Field[][] fields; //which has size n x n, definition on fields is at the bottom: The n could be 3,4,5. I found some strategies only for 3x3 version. What strategy should computer use to win? Field can have state: EMPTY, CROSS or CIRCLE. import java.awt.BasicStroke; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JButton; public class Field extends JButton { public final static int PREFERRED_SIZE = 100; public final static int EMPTY = 1, CROSS = 2, CIRCLE = 4; private int state; public Field() { state = EMPTY; } public void setState(int state) { if(state != EMPTY) { this.state = state; setEnabled(false); } } public void getState(){return state;} public Dimension getPreferredSize() { return new Dimension(PREFERRED_SIZE, PREFERRED_SIZE); } public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(4)); int shorterEdge = (int) (Math.min(getWidth(), getHeight())); int startXY = (int) (1d / 5d * shorterEdge); if(state == CIRCLE) { int ovalSize = (int) (3d / 5d * shorterEdge); g2d.drawOval(startXY, startXY, ovalSize, ovalSize); System.out.println(getWidth() + " x " + getHeight()); } else if(state == CROSS) { g2d.drawLine(startXY, startXY, shorterEdge - startXY, shorterEdge - startXY); g2d.drawLine(shorterEdge - startXY, startXY, startXY, shorterEdge - startXY); } } }
tagged with: strategy-pattern
tagged with: tic-tac-toe
downvote count: 6
tagged with: java

http://stackoverflow.com/comment/36532307
score: 0
type: AnswerComment
has text: Yes, just came to know today about Java Lambda Expressions : http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
type: Comment
comment on: http://stackoverflow.com/a/23742699

http://stackoverflow.com/a/23717529
has body: You can have more than one class, but the class defined first has to have the main method implementation. Normally when run as a script, the script is executed in run() method. In case you have a class defined, then the name of the class is used as the name of the script. In case there are more than one public class, then the runnable implementation has to be part of the first defined class. Below should work: class Dog { static void main(String[] args) { println "hello" } } class Cat {} You can get a clear picture when you inspect AST in groovy console.
downvote count: 0
score: 24
upvote count: 24
answers question: http://stackoverflow.com/q/23717406
type: Answer

http://stackoverflow.com/comment/36441959
has text: Added an interesting link in Edit3
type: AnswerComment
comment on: http://stackoverflow.com/a/23712372
score: 0
type: Comment

http://stackoverflow.com/a/24261482
type: Answer
has body: Change the code &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/gridView1" ads:adUnitId="MY ID NUMBER" ads:adSize="BANNER"/&gt; to &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adUnitId="ca-app-pub-8510605212168324/8634800090" ads:adSize="BANNER" android:layout_alignParentBottom="true" &gt; &lt;/com.google.android.gms.ads.AdView&gt;
answers question: http://stackoverflow.com/q/23700356
score: 0

http://stackoverflow.com/comment/36475401
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23691593
score: 1
has text: ok I have put the stack trace in the question ...any ideas what s going on? ...

http://stackoverflow.com/q/23714530
tagged with: beancreationexception
possible better answer: http://stackoverflow.com/a/35259832
has answer: http://stackoverflow.com/a/23715195
has answer: http://stackoverflow.com/a/77986239
has answer: http://stackoverflow.com/a/35259832
has answer: http://stackoverflow.com/a/55590779
has answer: http://stackoverflow.com/a/75013714
downvote count: 0
accepted answer: http://stackoverflow.com/a/23715377
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/25738818
has answer: http://stackoverflow.com/a/76940153
has title: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyController':
tagged with: spring
score: 46
has answer: http://stackoverflow.com/a/23715377
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 46
has answer: http://stackoverflow.com/a/23714556
tagged with: java
tagged with: hibernate
has body: I am doing spring + hibernate application. When I run the application on tomcat server I am getting some exceptions. INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Sat May 17 19:51:03 CEST 2014]; parent: Root WebApplicationContext INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml] INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/inscription],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.gestEtu.project.controller.CompteController.hello(java.lang.String,java.lang.String,java.lang.String,org.springframework.ui.Model) INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.gestEtu.project.controller.HomeController.home(java.util.Locale,org.springframework.ui.Model) INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0' ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compteController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.gestE…

bytecode
tags question: http://stackoverflow.com/q/23732236
type: Tag
tags question: http://stackoverflow.com/q/23769208
tags question: http://stackoverflow.com/q/23697161
tag name: bytecode

http://stackoverflow.com/comment/36353311
type: Comment
has text: The first one remove second element actually. i is not index, i is element which is autoboxed.
comment on: http://stackoverflow.com/a/23665546
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36578850
comment on: http://stackoverflow.com/a/23768775
type: Comment
score: 0
has text: Great doc - thanks. I am currently using the @Transactional annotation, so that should be the same. I also am changing the configuration now to use the WebLogicJtaTransactionManager, as well as configuring a JNDI datasource in the web server. I'm going to update my question with some code as I work it out. Maybe if I need help, it'd give an easy opportunity for that - otherwise, it might give others a place to start later in the future.
type: AnswerComment

http://stackoverflow.com/a/28226246
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23744185
has body: Yes, Spring controllers are singletons, there is just one instance of each controller per web application. The @Repository, @Service and @Controller are all by default singletons as they don’t have their own state but every thread accessing them perform certain thread specific operation thus these beans remains unaffected by it’s own concurrent access because it doesn’t have it’s own state.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23744185

http://stackoverflow.com/comment/36300916
score: 0
type: QuestionComment
type: Comment
has text: I'm assuming that actually using JSON or YAML is not an option?
comment on: http://stackoverflow.com/q/23638836

http://stackoverflow.com/comment/36279572
comment on: http://stackoverflow.com/a/23627831
type: Comment
score: 1
type: AnswerComment
has text: Use the `parseByte` method of the `Byte` class.

http://stackoverflow.com/q/23745957
tagged with: jpa
has title: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: orm
has body: I am trying to execute this query through hibernate. String queryStr = "from MPRSummaryBean where projId = :projectId and str_to_date(CONCAT('01','-',month, '-',year),'%d-%M-%Y') " + "in (select max(str_to_date(CONCAT('01','-',month, '-',year),'%d-%M-%Y')) " + "from MPRSummaryBean where projId = :projectId_1 group by projId)"; I am getting the following exception. java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode \-[METHOD_CALL] MethodNode: '(' +-[METHOD_NAME] IdentNode: 'CAST' {originalText=CAST} \-[EXPR_LIST] SqlNode: 'exprList' +-[AGGREGATE] AggregateNode: 'max' | \-[METHOD_CALL] MethodNode: '(' | +-[METHOD_NAME] IdentNode: 'str_to_date' {originalText=str_to_date} | \-[EXPR_LIST] SqlNode: 'exprList' | +-[METHOD_CALL] MethodNode: '(' | | +-[METHOD_NAME] IdentNode: 'CONCAT' {originalText=CONCAT} | | \-[EXPR_LIST] SqlNode: 'exprList' | | +-[QUOTED_STRING] LiteralNode: ''01'' | | +-[QUOTED_STRING] LiteralNode: ''-'' | | +-[DOT] DotNode: 'mprsummary1_.SUM_MONTH' {propertyName=month,dereferenceType=4,propertyPath=month,path={synthetic-alias}.month,tableAlias=mprsummary1_,className=com.elecnor.mpr.beans.MPRSummaryBean,classAlias=null} | | | +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}} | | | \-[IDENT] IdentNode: 'month' {originalText=month} | | +-[QUOTED_STRING] LiteralNode: ''-'' | | \-[DOT] DotNode: 'mprsummary1_.SUM_YEAR' {propertyName=year,dereferenceType=4,propertyPath=year,path={synthetic-alias}.year,tableAlias=mprsummary1_,className=com.elecnor.mpr.beans.MPRSummaryBean,classAlias=null} | | +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}} | | \-[IDENT] IdentNode: 'year' {originalText=year} | \-[QUOTED_STRING] LiteralNode: ''%d-%M-%Y'' \-[IDENT] IdentNode: 'DATE' {originalText=DATE} I tried to cast AS DATE, but it didnt work, Can someone please explain me why this is not working and steps to make this work.
tagged with: hql
type: Question

http://stackoverflow.com/a/23724838
has comment: http://stackoverflow.com/comment/36466761
answers question: http://stackoverflow.com/q/23724749
score: 3
has comment: http://stackoverflow.com/comment/36466612
has comment: http://stackoverflow.com/comment/36466529
upvote count: 3
has body: Use MM that represents Month instead of mm that represents minutes. Use LocalDate.parse() instead of new LocalDate() to construct the LocalDate object. DateTimeFormatter format = org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd"); LocalDate lDate = org.joda.time.LocalDate.parse("20140518", format); System.out.println(lDate); output: 2014-05-18 org.joda.time.LocalDate#toString() be default uses yyyy-MM-dd pattern. You don't need to use todayDate.toString("yyyy-MM-dd").
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36466971
has comment: http://stackoverflow.com/comment/36466600
has comment: http://stackoverflow.com/comment/36466429

http://stackoverflow.com/q/23763219
answer count: 1
has answer: http://stackoverflow.com/a/24930104
has body: I'm sending and receiving good SOAP requests/responses, but the response comes back with a signature token that I want to ignore. The underlying XML is good and could be serialized into the respective Java objects, but without validating the response token it always throws: org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized Is there a way to configure Axi2 or Rampart, for instance in policy.xml or the RampartConfig, to ignore the security token in the response header and just serialize the XML into the Java objects? EDIT: I do have the cert to validate on the client side, but for the sake of argument assume that I can't. That's another question if there's no good way to simply ignore response validation. EDIT: I got past my issue without having to answer this. The trick was to set the truststore value correctly in the properties of the CryptoConfig, as well as the keystore properties. I'll leave this question up though, as I'm still curious as to whether this is possible.
type: UnansweredQuestion
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
tagged with: rampart
tagged with: java
type: Question
has title: In Axis2/Rampart, how do I ignore the SignatureToken on the recipient/response side?
tagged with: apache-axis
score: 0

http://stackoverflow.com/comment/65633052
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23659178
has text: See http://stackoverflow.com/questions/26041117/growing-resident-memory-usage-rss-of-java-process
score: 0

http://stackoverflow.com/q/23695075
has answer: http://stackoverflow.com/a/23695182
has comment: http://stackoverflow.com/comment/36409046
score: 10
has body: I have a class which has 1600 public static members. I must found and delete the unused ones. Is there a way to do it in Eclipse.
answer count: 2
has answer: http://stackoverflow.com/a/23695159
favorite count: 0
has title: Find unused public members in Eclipse
accepted answer: http://stackoverflow.com/a/23695159
has comment: http://stackoverflow.com/comment/36409201
has comment: http://stackoverflow.com/comment/36408970
upvote count: 11
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23695182
tagged with: eclipse
downvote count: 1
type: Question

http://stackoverflow.com/q/23662527
has comment: http://stackoverflow.com/comment/36347285
has comment: http://stackoverflow.com/comment/36348385
type: Question
upvote count: 15
downvote count: 5
has comment: http://stackoverflow.com/comment/36347773
has answer: http://stackoverflow.com/a/73495833
answer count: 3
accepted answer: http://stackoverflow.com/a/23662578
has comment: http://stackoverflow.com/comment/36348296
has comment: http://stackoverflow.com/comment/36347251
has answer: http://stackoverflow.com/a/33966611
score: 10
possible better answer: http://stackoverflow.com/a/73495833
favorite count: 0
has comment: http://stackoverflow.com/comment/36347937
has comment: http://stackoverflow.com/comment/36347472
has title: Replace capital letter with underscore + lowercase letter in Java?
has comment: http://stackoverflow.com/comment/36347733
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36347994
tagged with: java
has body: Is there a way to use RegEx in Java to replace all capital letters with an underscore and the same letter only lowercase? Example: getSpecialString -> get_special_string
has answer: http://stackoverflow.com/a/23662578

http://stackoverflow.com/comment/36399264
type: AnswerComment
comment on: http://stackoverflow.com/a/23689148
score: 0
type: Comment
has text: I did it and its working but i still dont understand how it works. Why should i use try catch? http://pastebin.com/Ac2Z9yqr

http://stackoverflow.com/comment/36553801
type: QuestionComment
has text: Point to a new type of object or object of the same type? Sounds like you want to cast `Object 1` into `Object 2`
comment on: http://stackoverflow.com/q/23770590
score: 0
type: Comment

http://stackoverflow.com/a/23635341
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23635108
has body: It totally depends on how you want to use the saved data and what is the amount of data you want to store. 1. Sqlite: a. Can be used to store large quantities of data and data can be retrived using the query when required and can be used as per your requirement b. Here stored data can be retrieved till the time the data exists in database.. if application is active but data not exists in database then you can't retrieve the data. 2. Shared Preferences a. Normally used to store small quantities of data. b. No need to query database hence data retrieve is fast and data exists till the application is active on device.
answers question: http://stackoverflow.com/q/23635108
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36379964
type: AnswerComment
score: 0
type: Comment
has text: Activity's file is under the res->layout folder
comment on: http://stackoverflow.com/a/23668968

http://stackoverflow.com/comment/36303589
type: QuestionComment
has text: @Nivas: and what JARs would those be? The `import`s only refer to standard Java SE classes.
comment on: http://stackoverflow.com/q/23640196
score: 0
type: Comment

http://stackoverflow.com/comment/36472247
comment on: http://stackoverflow.com/a/23706953
has text: I thought that the localhost version started up zookeeper on it's own?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36387502
has text: Each thread (Job) uses its own instance of `BankAccount` so I cannot see any way to create a race condition here.
comment on: http://stackoverflow.com/q/23683419
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23679963
type: Question
tagged with: filenotfoundexception
tagged with: java-7
linked to: http://stackoverflow.com/q/15830532
tagged with: jar
has title: java returning null when trying to retrieve file from jar file
has comment: http://stackoverflow.com/comment/36380929
score: 0
tagged with: nullpointerexception
has body: The jar files are generated during build time and contain xml files that need to be read during run time. I am using Java webstart which downloads these jar file to a local folder. the local path to where the jar is stored is: C:\Users\username\Desktop\Project\jars This folder contains multiple jar files. What i am trying to achieve is for the code to locate a particular jar based on a filename it contains and read an xml file contained in the jar. The xml file is located in a folder called xmlfiles in the jar but this is returning null. Note: this used to work with previous versions of Java 3-5 but after our migration to Java 7, this method returns null. This is the portion of the method throwing the exception private InputStream Jar(String _filename) throws IOException { String path = "xmlfiles/" + _filename; InputStream content = Thread.currentThread().getContextClassLoader().getResourceAsStream(path) System.out.println("loaded xml); } I have also tried getting the URL and printing out the string, but get a fileNotfound Exception URL path = Thread.currentThread().getContextClassLoader().getResource(url); I have tried various solutions with similar question on here but none of the solution can locate the file (returnin null or file not found) InputStream from jar-File returns always null Parse XML File within Jar Accessing a file inside a .jar file
linked to: http://stackoverflow.com/q/8258244
has comment: http://stackoverflow.com/comment/36380449
has comment: http://stackoverflow.com/comment/36383257
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15535153
has comment: http://stackoverflow.com/comment/36384351
tagged with: java
has comment: http://stackoverflow.com/comment/36380488

http://stackoverflow.com/q/23683345
tagged with: driver
has answer: http://stackoverflow.com/a/23688659
type: UnansweredQuestion
tagged with: java
tagged with: webdriver
type: Question
tagged with: shutdown
answer count: 1
has body: I'm wondering for a while now what the best way was to do a proper clean-up after an expection has been thrown or the testcase has finished. As a reminder: An .exe process driver process according to the implementation, conhost.exe, the browser and Java application are launched. Using driver.quit(), we can kill the driver process, conhost and browser after finishing the testcase. WebDriver driver = new SomethingDriver(); // do stuff driver.quit(); // Proper cleaning However, if an exception may be thrown, we need to do this: try{ WebDriver driver = new SomethingDriver(); // do stuff } catch(Exception e){ e.printStackTrace(); } finally{ driver.quit(); // Proper cleaning } What about shutting down the driver process and conhost, but leaving the browser alive? Executing a shell script is bad since it kills all the processes with these names (therefore prevents concurrent usage) and it is Windows only (I think): TASKKILL /F /IM chromedriver.exe TASKKILL /F /IM conhost.exe Let's say we kill the Java process randomly (in Eclipse or task manager). How can we make sure that above mentioned cleaning takes place? Is there a code solution which covers all these issues nicely?
score: 0
has title: WebDriver Proper Shutdown

http://stackoverflow.com/comment/36405830
type: Comment
type: QuestionComment
score: 0
has text: @user3643373 Not really, because it'll be quite difficult for a program to tell that `"QA"` is a position and not a name, without a list of positions (unless you're going by all capital letters)
comment on: http://stackoverflow.com/q/23692887

http://stackoverflow.com/comment/36450830
comment on: http://stackoverflow.com/a/23717075
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the reply. Can you tell me a way to be able to save numbers greater than 255?

2d
tags question: http://stackoverflow.com/q/23638066
tags question: http://stackoverflow.com/q/23728525
tags question: http://stackoverflow.com/q/23754325
tags question: http://stackoverflow.com/q/23663613
tags question: http://stackoverflow.com/q/23677835
tags question: http://stackoverflow.com/q/23775584
tags question: http://stackoverflow.com/q/23738078
tag name: 2d
type: Tag
tags question: http://stackoverflow.com/q/23639100
tags question: http://stackoverflow.com/q/23678342

http://stackoverflow.com/q/23685719
has comment: http://stackoverflow.com/comment/36392041
tagged with: eclipse-memory-analyzer
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36391972
has title: Using Eclipse MAT Not able to find Memory leak created by Array Object
type: Question
has answer: http://stackoverflow.com/a/23687684
has comment: http://stackoverflow.com/comment/36393131
has body: I am debugging a OutOfMemory issue using MAT( Analyzing Heap Dump ) in old java application. MAT shows a RMI Thread has created Array(BO[150K+]) of My Business Object(BO) which has 150k+ instances, it is consuming around 358 MB ( Xmx is 512 MB). It is a memory leak situation. One more interesting part I noticed in all the dumps ( created after server crash ) number of instances in Array Object is same. I am not able to understand how can I find out this Array Object , in which class this array object is created. is there any such direct/indirect feature available in MAT ? please suggest if any such option available in visualVM or some other tool. Or Some memory analyzer which i can run over codebase.
has answer: http://stackoverflow.com/a/23687575
has comment: http://stackoverflow.com/comment/36392286
has answer: http://stackoverflow.com/a/25942055
answer count: 3
score: 2
downvote count: 0
favorite count: 0
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/36392102
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/36392734

http://stackoverflow.com/a/23642855
answers question: http://stackoverflow.com/q/23642816
has comment: http://stackoverflow.com/comment/36308949
has comment: http://stackoverflow.com/comment/36310478
type: Answer
has body: You've broken the paint chain. Failing to call super.paint is preventing the applet from preparing the Graphics context for painting, by removing anything that might have been painted to it before. There's no need to override update, as you're not doing anything with it. Typically, you should avoid overriding paint of top level containers, as they aren't double buffered and will flicker as they are repainted You should avoid using Applet and instead use a combination of JApplet a (for example) JPanel as your drawing surface . In fact, if you're just learning. It would be better to use JFrame as applets have a lot of additional management Painting by its very nature is destructive. You need to maintain a list of things that you want to draw. In this, I would recommend a List of Points, which can be used to paint lines, where the last point is the current drag point Also take a look at Painting in AWT and Swing for details about how painting works
has comment: http://stackoverflow.com/comment/40543438
accepted answer of: http://stackoverflow.com/q/23642816
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23737989
answers question: http://stackoverflow.com/q/23728514
upvote count: 1
type: Answer
downvote count: 2
has body: You didn't really ask a question... but your implied question is: "How do I get started with Geb?" I have an example Geb project on GitHub and a few screencasts on how to get started with Geb on my blog: Geb Automation Quick Start (Geb basics) Geb Examples Project Overview (runs you through my example project) Creating Your First Test In Geb
has comment: http://stackoverflow.com/comment/36717181
score: -1

http://stackoverflow.com/q/23633229
has comment: http://stackoverflow.com/comment/36290627
score: -1
has title: How to make GUI do the math while inputing variable in JTextField? and How to make a JTextField pop out when I click(select) a JCheckBox
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36335730
upvote count: 0
has comment: http://stackoverflow.com/comment/36290049
tagged with: java
has body: new code: import java.awt.*; import java.util.*; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JCheckBox; import javax.swing.JPasswordField; import javax.swing.JOptionPane; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.FocusListener; import java.awt.event.FocusEvent; public class Gui extends JFrame { static JTextField text; static JTextField text2; static JTextField text3; static JCheckBox tsp; static JCheckBox tbsp; static JCheckBox cup; static JCheckBox pint; static JCheckBox quart; static JCheckBox liter; static JCheckBox gallon; static JCheckBox oz; static String unit; static int conv; public Gui(){ super("My title"); setLayout(new FlowLayout()); final JTextField text0 = new JTextField("Enter the unit you are using at the moment (Tsp, Tbsp, Cup, Pint, Quart, Liter, Gallon, Ounce)"); text0.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e){ text0.setText(""); } }); add(text0); unit = text0.getText(); ///////////////////////////UNIT\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ final JTextField text = new JTextField("Enter the amount you have ( Must be a number.)",20); text.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e){ text.setText(""); } }); add(text); String str = text.getText(); try { conv = Integer.parseInt(str); //////////////////////////////////AMOUNT TO CONVERT\\\\\\\\\\\\\\\\\\\\\\\\\ } catch(NumberFormatException e){ } text2=new JTextField("Which unit do you want to use:",20); text2.setEditable(false); add(text2); //text3=new JTextField("You need "+conv+"",20); // text3.setEditable(false); // add(text3); tsp = new JCheckBox("Tsp"); tbsp = new JCheckBox("Tbsp"); cup = new JCheckBox("Cup"); pint = new JCheckBox("Pint"); quart = new JCheckBox("Quart"); liter = new JCheckBox…
tagged with: jtextfield
has answer: http://stackoverflow.com/a/23633974
type: Question
has comment: http://stackoverflow.com/comment/36290547

http://stackoverflow.com/comment/36361872
has text: Yeah Apache CXF is a great tools for this programming problem. Good suggestion.
comment on: http://stackoverflow.com/a/23669821
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36552617
comment on: http://stackoverflow.com/a/23769639
has text: @user3144349 If you can change the command line, you can do anything. If you can't change the command line, you are limited to what your framework allows you to do. That is the whole point of having a SecurityManager. ;)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36558759
comment on: http://stackoverflow.com/a/23773355
score: 0
type: Comment
has text: which second loop? which culprit ?
type: AnswerComment

http://stackoverflow.com/q/23698640
tagged with: java
type: Question
answer count: 1
has body: With JavaFX2 I have this code: FXMLLoader loader = new FXMLLoader(App.class.getResource("App.fxml")); TabPane tabPane = (TabPane) loader.getNamespace().get("tabPane"); Tab tab = (Tab) loader.getNamespace().get("closeAllTab"); Now I'm looking to disable tab when tabPane has less than 3 tabs (tabs can be closed). I need a binding like this: tab.disableProperty().bind(tabPane.disableProperty()); but, of course, I need to evaluate tabPane.getTabs().size(). How to do this ?
score: 0
tagged with: binding
has answer: http://stackoverflow.com/a/23698801
accepted answer: http://stackoverflow.com/a/23698801
tagged with: javafx-2
has title: Bind to an expression to evaluate
type: AnsweredQuestion

http://stackoverflow.com/comment/36265174
type: QuestionComment
has text: Why would it be a problem?
type: Comment
comment on: http://stackoverflow.com/q/23620313
score: 0

http://stackoverflow.com/comment/36459850
has text: Thanks Susheel but adding braces to single line braces will not cause any difference. There was a logical problem in my code and I figured it out. Thanks everyone for their time.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23721210

http://stackoverflow.com/a/23639667
has body: First and foremost, you should not so much care about performance in GUI event handling code. If you'll encounter performance problems they will most probably not emerge in user input validation code. So, when writing an application your focus should be on maintainability and readability. You'll best achieve that when you use built-in framework functionality. So, assuming that with 'check that entered text only contains alphanumeric characters' you mean 'validate that...' you can use Vaadin's validators, and more specifically the RegexpValidator. Your code would then look like searchTxt = new TextField(); // match at least one or more alphanumeric characters searchTxt.addValidator(new RegexpValidator("\\w+", true, "Error msg: not valid...")); public void buttonClick(ClickEvent event) { final Button button = event.getButton(); if (button == search) { if (searchTxt.isValid()) { // logic } } } With that, the logic will only be executed if the user has entered at least one alphanumeric character.
upvote count: 1
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23630943

http://stackoverflow.com/q/23762473
has comment: http://stackoverflow.com/comment/36538062
downvote count: 0
accepted answer: http://stackoverflow.com/a/23762901
favorite count: 0
has comment: http://stackoverflow.com/comment/36537756
has comment: http://stackoverflow.com/comment/36538083
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/23762901
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23762846
score: 1
has body: I have this in my app POM: org.jboss.errai errai-cdi-jetty ${errai.version} org.mortbay.jetty jetty-plus org.mortbay.jetty jetty-naming However, I can still see jetty-plus, and jetty-naming in the WEB-INF\lib folder (i.e after mvn clean install). What are the ways to identify how to fix this issue. Update: However mvn dependency:tree shows: [INFO] +- org.jboss.errai:errai-cdi-jetty:jar:3.0-SNAPSHOT:compile [INFO] +- org.eclipse.jetty:jetty-server:jar:9.2.0.RC0:compile [INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile [INFO] | +- org.eclipse.jetty:jetty-http:jar:9.2.0.RC0:compile [INFO] | \- org.eclipse.jetty:jetty-io:jar:9.2.0.RC0:compile [INFO] +- org.eclipse.jetty:jetty-plus:jar:9.2.0.RC0:compile [INFO] | \- org.eclipse.jetty:jetty-webapp:jar:9.2.0.RC0:compile [INFO] | +- org.eclipse.jetty:jetty-xml:jar:9.2.0.RC0:compile [INFO] | \- org.eclipse.jetty:jetty-servlet:jar:9.2.0.RC0:compile [INFO] | \- org.eclipse.jetty:jetty-security:jar:9.2.0.RC0:compile [INFO] +- org.eclipse.jetty:jetty-jndi:jar:9.2.0.RC0:compile [INFO] | \- org.eclipse.jetty:jetty-util:jar:9.2.0.RC0:compile
tagged with: java
has title: Maven exclusion is persistent
has comment: http://stackoverflow.com/comment/36537545
has comment: http://stackoverflow.com/comment/36537616
possible better answer: http://stackoverflow.com/a/23762846
type: Question
has comment: http://stackoverflow.com/comment/36537571
answer count: 2

http://stackoverflow.com/q/23650843
has answer: http://stackoverflow.com/a/23651109
has answer: http://stackoverflow.com/a/23651106
has body: Have set with data, where object represent service with min time, max time, avg time and name of service. Need to show this set by category bar chart, where category is name of service. But main problem in: How to make range axis in this chart to show time like (... hourse ... min)?
accepted answer: http://stackoverflow.com/a/23651106
possible better answer: http://stackoverflow.com/a/23651109
type: AnsweredQuestion
tagged with: java
tagged with: categories
tagged with: jfreechart
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36324221
tagged with: bar-chart
score: 0
has title: JFreeChart with time range axis

http://stackoverflow.com/comment/36335086
has text: I can have multiple main methods in my project. I can just select which one I want to run. I can't have references to MyLauncher in the Launcher, though, because MyLauncher is inside an API I'm making.
type: AnswerComment
comment on: http://stackoverflow.com/a/23656468
type: Comment
score: 2

http://stackoverflow.com/comment/36369403
score: 0
type: AnswerComment
has text: I have edited my question, Please look into it, Thanks.
type: Comment
comment on: http://stackoverflow.com/a/23653497

http://stackoverflow.com/comment/36330991
type: AnswerComment
has text: The order-keeping function is really cool but the keeping the original value does not work correctly on the positive number. I don't know if I misinterpreted something. Anyway thanks
type: Comment
comment on: http://stackoverflow.com/a/23654277
score: 0

http://stackoverflow.com/a/23677170
answers question: http://stackoverflow.com/q/23671842
has comment: http://stackoverflow.com/comment/36763893
has comment: http://stackoverflow.com/comment/36377701
has comment: http://stackoverflow.com/comment/36763557
score: 0
has comment: http://stackoverflow.com/comment/36739399
type: Answer
has comment: http://stackoverflow.com/comment/36765808
has comment: http://stackoverflow.com/comment/36773728
has comment: http://stackoverflow.com/comment/36763854
has comment: http://stackoverflow.com/comment/36377007
has comment: http://stackoverflow.com/comment/36769085
has comment: http://stackoverflow.com/comment/36376191
has comment: http://stackoverflow.com/comment/36736366
has body: I am new to Regular expressions. After reading this question i tried the following in online regex testers. it works fine. (\s)*select(\s)+((\*)|([a-zA-Z0-9]+))(\s)+from(\s)+[a-zA-Z0-9]*(\s)+where(\s)+([a-zA-Z0-9]*(\s)*=(\s)*[0-9]*)+((\s)+and(\s)+([a-zA-Z0-9]*(\s)*=(\s)*[0-9]*))*(\s)* I think it is too long. But it works fine for case 2 and case 3. If you want to achieve only these cases through regex , you need two regex to achieve your desired solution. If you want to achieve all the three in single regex its not possible[According to my knowledge] . As Bobbel mentioned in comments , Its not possible. Because you need to check whether "where" is present or not . If present , it should have condition. Else "where" itself shouldn't be present. EDIT import java.util.regex.Pattern; import java.util.regex.Matcher; public class HelloWorld { private static final String PATTERN="(\\s)*select(\\s)+((\\*)|([a-zA-Z0-9]+)) (\\s)+from(\\s)+[a-zA-Z0-9]*(\\s)+where(\\s)+([a-zA-Z0-9]*(\\s)*=(\\s)*[0-9]*)+ ((\\s)+and(\\s)+([a-zA-Z0-9]*(\\s)*=(\\s)*[0-9]*))*(\\s)*"; public static void main(String []args) { System.out.println("Hello World"); String data="select * from asdf where a = 20 and ax =20"; Pattern pattern=Pattern.compile(PATTERN); Matcher matcher=pattern.matcher(data); if(matcher.find()) { System.out.print("True"); } else { System.out.print("false"); } System.out.print(":"+data+":\n"); } }

http://stackoverflow.com/comment/36604662
comment on: http://stackoverflow.com/q/23768065
has text: I did what you suggest, Lamq. Inside the listener(), I put this code: "if (histopatologia.getEspecie().equalsIgnoreCase("Silvestre")) { renderedInputMask = true; }". But this dind't work until I changed the update inside the p:ajax from "detalhe" to ":form:test" and I put the inputMask inside a <h:panelGroup id="test">. It works, but the inputMask field is generated outside the main form, and not beside the the p:selectOneMenu. Have you any idea how to make the inputMask field be shown next to selecOneMenu?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23735560
answers question: http://stackoverflow.com/q/23735217
has comment: http://stackoverflow.com/comment/36487072
has comment: http://stackoverflow.com/comment/36487670
has comment: http://stackoverflow.com/comment/36488943
has body: One solution could be to remove the cascade "cascade={CascadeType.ALL}" More on this subject here
score: 0
has comment: http://stackoverflow.com/comment/36488022
has comment: http://stackoverflow.com/comment/126581594
has comment: http://stackoverflow.com/comment/36488357
type: Answer

http://stackoverflow.com/a/23644599
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23644529
answers question: http://stackoverflow.com/q/23644529
has comment: http://stackoverflow.com/comment/36312607
type: Answer
has comment: http://stackoverflow.com/comment/36312498
has body: I think your first problem is coming from this assignment: strTemp = employeeNames[maxIndex] = employeeNames[i]; try changing that line of code to this: strTemp = employeeNames[maxIndex]; The assignment you're doing assigns the value of employeeNames[i] to both employeeNames[maxIndex] and strTemp. You need strTemp to contain the value at employeeNames[maxIndex], but that's being overwritten before you have a chance to store it. That is why your array isn't changing at all. Secondly, the check in your nested for loop should look like this: if (employeeInformation[j][GROSS_PAY] &gt; employeeInformation[maxIndex][GROSS_PAY]) and the line inside of the if statement should look like this: maxGross = employeeInformation[j][GROSS_PAY]; note the j (you're checking index i).

http://stackoverflow.com/q/23660586
tagged with: java
type: Question
has title: Eclipse android java: Orientation
tagged with: layout
accepted answer: http://stackoverflow.com/a/23660790
score: -1
has body: I have question about orientation. I started with an application for a phone. I just wonder if it is possible to make the layout in 2 different xml files. Currently I have the layout right for vertically but not horizontally. I wondered if it is possible to make two layouts files one for vertical and one for horizontal. Thanks,
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/23660790
favorite count: 0
tagged with: orientation
tagged with: android
possible better answer: http://stackoverflow.com/a/23660684
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23660684
upvote count: 0

http://stackoverflow.com/a/23662593
type: Answer
has comment: http://stackoverflow.com/comment/36347868
has body: Replace text.setText(btn1.getText().toString()); with String t=text.getText().toString(); text.setText(t+btn1.getText().toString())
answers question: http://stackoverflow.com/q/23662195
accepted answer of: http://stackoverflow.com/q/23662195
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/36528339
score: 0
type: AnswerComment
has text: how can i get BT101 when selecting Restaurant from spinner
type: Comment
comment on: http://stackoverflow.com/a/23757543

http://stackoverflow.com/q/23730296
has answer: http://stackoverflow.com/a/23730568
has body: I am trying to write a few test cases for automation testing as a part of practice assignment in selenium webdriver using java. The java version is 1.6 and selenium webdriver version is 2.39 while firefox browser version is 29.0.1. I am trying to access the drop down titled CARSIZE in the following link: http://www.carrentals.com/ I am not able to manipulate it. I have tried the following code... driver.get("http:\\www.carrentals.com/"); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Select dropdown= new Select(driver.findElement(By.xpath("//*[@name='carType']"))); dropdown.selectByValue("carsize-1"); With the above code, it seems that I am able to find the element(as no exception is thrown) but not change a value. When I try to change a value by SELECTBYVALUE method, I get an exception saying element not visible. Can someone help me? The Html code for the above can be seen in firebug and just for information I have also tried using ID and name instead of XPath for the concerned select box but I get the same exception.
accepted answer: http://stackoverflow.com/a/23730568
has comment: http://stackoverflow.com/comment/36477212
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: AnsweredQuestion
has title: Accessing drop down list- selenium webdriver & java
tagged with: java
tagged with: selenium
upvote count: 1
type: Question

http://stackoverflow.com/q/23732386
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24734730
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24734730
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/23754928
upvote count: 2
tagged with: freetype
has title: jpod library not working outside eclipse
answer count: 3
has body: If I run project from eclipse - it's ok. If I run project as runnable jar exception thrown: .Exception in thread "main" java.lang.ExceptionInInitializerError at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLib rary(Unknown Source) at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.create PlatformFont(Unknown Source) at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(U nknown Source) at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(Unknown So urce) at de.intarsys.pdf.content.CSInterpreter.process(Unknown Source) at de.intarsys.pdf.content.CSInterpreter.process(Unknown Source) at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(Unknown Sour ce) at RenderDoc.renderPage(RenderDoc.java:75) at RenderDoc.renderPages(RenderDoc.java:97) at RenderDoc.run(RenderDoc.java:139) at RenderDoc.main(RenderDoc.java:48) Caused by: java.lang.NullPointerException: no native interface available at de.intarsys.nativec.api.NativeInterface.set(Unknown Source) at de.intarsys.nativec.api.NativeInterface.get(Unknown Source) at de.intarsys.cwt.freetype.nativec._FTNI.init(Unknown Source) at de.intarsys.cwt.freetype.nativec._FTNI.&lt;init&gt;(Unknown Source) at de.intarsys.cwt.freetype.Freetype.&lt;clinit&gt;(Unknown Source) ... 11 more My system windows7 64 bit, java 8 64 bit. I think problem, that freetype.dll not seen outside eclipse. I found it inside jar (jpod dependencies). How I can correctly include this dll in packaging jar, and why it works from eclipse?
favorite count: 0
tagged with: jna
possible better answer: http://stackoverflow.com/a/23754928
has answer: http://stackoverflow.com/a/51209322

http://stackoverflow.com/a/23773505
has body: I think your code should change like this public class Arrayto2DArray { public static void main(String[] args) { // TODO code application logic here int[] a = {0,1, 6, 83, 4, 5, 12, 7}; int[][] b = new int[4][2]; for (int i = 0; i &lt; b.length; i++) { for (int j = 0; j &lt; b[i].length; j++) { b[i][j]=0; System.out.print(b[i][j]); } System.out.println(); } System.out.println("--------------------------"); for (int i = 0; i &lt; 4; i++) { for (int j = 0; j &lt; b[i].length; j++) { try{ b[i][j] = a[i+j*4]; }catch(Exception e){ e.printStackTrace(); System.out.println(e); } } } for (int i = 0; i &lt; 4; i++) { for (int j = 0; j &lt; 2; j++) { System.out.print(b[i][j]+" "); } System.out.println(); } } }
answers question: http://stackoverflow.com/q/23773324
score: 0
type: Answer

http://stackoverflow.com/comment/36308825
has text: Presumably, you do not have `data.xml` in the `assets/` directory of your project. Besides, an XML resource is *much* faster to read in. Put your file in `res/xml/data.xml`, then use `getResources().getXml()` to get your `XmlPullParser`.
comment on: http://stackoverflow.com/q/23642810
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36302553
type: QuestionComment
score: 0
has text: Is it possible that you'll store an object using one key, and then try to retrieve it using a key which is an identical object, but not the same object?
comment on: http://stackoverflow.com/q/23639825
type: Comment

http://stackoverflow.com/comment/36516998
score: 0
type: Comment
type: QuestionComment
has text: What about this http://stackoverflow.com/questions/662972/saxexception-bad-envelope-tag
comment on: http://stackoverflow.com/q/23751481

http://stackoverflow.com/q/23683708
upvote count: 5
tagged with: java
tagged with: eclipse
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36422361
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25761526
has body: Starter situation (without any error): I have three different bundles: bunbdle A (called org.apache.xmlbeans), bundle B and bundle C bundle B import some packages exported from the bundle A bundle B export some packages (e.g. the package com.prova.xsd.config) bundle C import the packages exported by the bundle B (e.g. the package com.prova.xsd.config) Now I make bundle B a fragment of the bundle A (fragment-host) adding the directive Fragment-Host: org.apache.xmlbeans in the MANIFEST of the bundle B After this change there are NO errors in the MANIFEST.MF of all the bundles (A,B,C) but in the classes .java of the bundle C I have the compile error: "The import com.prova.xsd.config cannot be resolved" associated to the import at the head of the file .java. What is the problem? How can I fix it? Thanks a lot, Andrea
score: 5
tagged with: osgi-fragment
answer count: 1
has title: Osgi eclipse: how to export package from a fragment bundle and make them visible to an external bundle?

http://stackoverflow.com/comment/36356095
score: 0
type: Comment
has text: Oh wow I never knew that. I always thought both x and y needed to be there even if they didn't do anything.
type: AnswerComment
comment on: http://stackoverflow.com/a/23666855

http://stackoverflow.com/q/23658800
tagged with: java
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36339708
tagged with: spring
has answer: http://stackoverflow.com/a/23660916
tagged with: asynchronous
type: UnansweredQuestion
has body: I've read Spring's documentation about @Async, and it's not clear to me whether this is supposed to work only when the caller and the called service are in the same JVM. I have a Spring web app deployed on a Tomcat, and a Swing application, using Spring HttpInvoker for communication between those two. I want to call server services from the client and return the results asynchronously. Do I have to build something else, or can I use @Async? When testing this in the same JVM, it worked. When testing it with 2 JVMs, I got java.io.NotSerializableException: java.util.concurrent.FutureTask on the server, which implies that I cannot use this mechanism with two JVMs. Any ideas? Of the many tutorials I found concering @Async, none seems to cover the case of remote calls and return values.
has comment: http://stackoverflow.com/comment/36342368
has title: Does Spring @Async work with Client-Server communication?

http://stackoverflow.com/q/23767056
favorite count: 0
has comment: http://stackoverflow.com/comment/36546586
type: Question
has comment: http://stackoverflow.com/comment/36546745
has comment: http://stackoverflow.com/comment/36546615
has title: How many instances are created on generic class instantiation?
has answer: http://stackoverflow.com/a/23767516
tagged with: java
has body: Consider such class: class Foo&lt;T&gt; { private T myField; public void Set(T x) { myField = x; } } And then you instantiate it with T equal to int, bool (value types) and String, List. How may instantiations will be created and how they would look like? I am interested in Java and C#. From what I read Java would create one general class with basically casting, while in C# there would be two classes for int and bool plus single one for String and List because they are reference values (is this true? what about static fields?).
downvote count: 3
has answer: http://stackoverflow.com/a/23767500
has answer: http://stackoverflow.com/a/23767262
has comment: http://stackoverflow.com/comment/36546872
upvote count: 4
tagged with: instantiation
tagged with: c#
answer count: 4
has comment: http://stackoverflow.com/comment/36546669
has answer: http://stackoverflow.com/a/23767477
has comment: http://stackoverflow.com/comment/36546913
has comment: http://stackoverflow.com/comment/36546783
accepted answer: http://stackoverflow.com/a/23767262
has comment: http://stackoverflow.com/comment/36546616
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23767477
score: 1
tagged with: generics

http://stackoverflow.com/q/23652527
tagged with: spring
has body: i have a requirement, where in i need to validate my @RequestParam such that it is matched with my pattern Example : @RequestMapping(value = "/someTest") public Object sendWishes(@RequestParam("birthDate") String birthDate) { // i need birthDate to be a valid date format in YYYYMMDD format // if its not valid it should not hit this method }
possible better answer: http://stackoverflow.com/a/23652843
tagged with: spring-mvc
type: AnsweredQuestion
has title: Can we validate @RequestParam value with a pattern
tagged with: java
upvote count: 10
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23652851
answer count: 3
score: 10
has answer: http://stackoverflow.com/a/45328512
favorite count: 0
has answer: http://stackoverflow.com/a/23652843
accepted answer: http://stackoverflow.com/a/23652851

http://stackoverflow.com/comment/36278493
comment on: http://stackoverflow.com/a/23627165
score: 0
type: AnswerComment
has text: Ha, you're right! While we're at it, using a list like you do makes more sense and is faster since unicity of the keys is already guaranteed by the map.
type: Comment

http://stackoverflow.com/q/23703886
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23704027
score: -5
has comment: http://stackoverflow.com/comment/36427640
has comment: http://stackoverflow.com/comment/36426198
upvote count: 3
has comment: http://stackoverflow.com/comment/36425865
tagged with: java
has comment: http://stackoverflow.com/comment/36425812
type: Question
has comment: http://stackoverflow.com/comment/36425801
has body: I was trying to exercise on creating triangles. However, I realy find this diffucult to implement. Can you give me a way to complete it? 5 545 54345 5432345 543212345 ops! you're so tough. you down vote a lot! here is the code that I tried to do something but the only true thing is the calculation of spaces. for (int i = 1; i &lt;= n; i++) { for (int j = n; j &gt; i; j--) { System.out.print(" "); } //left for (int j = i; j &gt; 1; j--) { System.out.print(j + " "); } //right for (int j = 1; j &lt;= i; j++) { System.out.print(j + " "); } System.out.println(); }
has comment: http://stackoverflow.com/comment/36425838
has answer: http://stackoverflow.com/a/23704873
answer count: 3
has comment: http://stackoverflow.com/comment/36426271
has comment: http://stackoverflow.com/comment/36426945
favorite count: 0
has title: Creating triangle in java
downvote count: 8
has answer: http://stackoverflow.com/a/23704137
has comment: http://stackoverflow.com/comment/36425820
possible better answer: http://stackoverflow.com/a/23704027
accepted answer: http://stackoverflow.com/a/23704873

http://stackoverflow.com/comment/36457185
type: QuestionComment
comment on: http://stackoverflow.com/q/23720381
has text: @newboyhun I believe iamSiddharthYadav is intentially using same object equality (aka `==`) to test interning behaviour
score: 0
type: Comment

http://stackoverflow.com/q/23701917
accepted answer: http://stackoverflow.com/a/23702356
upvote count: 0
has comment: http://stackoverflow.com/comment/36421876
answer count: 1
has comment: http://stackoverflow.com/comment/36422541
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36421812
has body: I'm writing an Android app, but it crashes. Here's the code: public class Images extends Activity { private ImageView d1; private ArrayList&lt;Integer&gt; listaImagenes=new ArrayList&lt;Integer&gt;(); @Override public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.rellenar(); setContentView(R.layout.imagentonas); d1=(ImageView)findViewById(R.id.imagenes01); d1.setImageResource(listaImagenes.get(0)); } private void rellenar() { listaImagenes.add(R.drawable.rosa1); listaImagenes.add(R.drawable.imagencilla); } } Logcat: &gt;05-16 14:21:13.792: E/dalvikvm-heap(887): Out of memory on a &gt; 69120016-byte allocation. 05-16 14:21:13.882: E/AndroidRuntime(887): &gt; FATAL EXCEPTION: main 05-16 14:21:13.882: E/AndroidRuntime(887): &gt; Process: com.example.terceraniversario, PID: 887 05-16 14:21:13.882: &gt; E/AndroidRuntime(887): java.lang.OutOfMemoryError 05-16 14:21:13.882: &gt; E/AndroidRuntime(887): at &gt; android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 05-16 &gt; 14:21:13.882: E/AndroidRuntime(887): at &gt; android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587) &gt; 05-16 14:21:13.882: E/AndroidRuntime(887): at &gt; android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422) &gt; 05-16 14:21:13.882: E/AndroidRuntime(887): at &gt; android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840) &gt; 05-16 14:21:13.882: E/AndroidRuntime(887): at &gt; android.content.res.Resources.loadDrawable(Resources.java:2110) 05-16 &gt; 14:21:13.882: E/AndroidRuntime(887): at &gt; android.content.res.Resources.getDrawable(Resources.java:700) 05-16 &gt; 14:21:13.882: E/AndroidRuntime(887): at &gt; android.widget.ImageView.resolveUri(ImageView.java:638) 05-16 &gt; 14:21:13.882: E/AndroidRuntime(887): at &gt; android.widget.ImageView.setImageResource(ImageView.java:367) 05-16 &gt; 14:21:13.882: E/AndroidRuntime(887): at &gt; com.example.terceraniversario.Images.onCreate(Images.java:20) 05-1…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36421805
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36422085
has title: ImageView and ArrayList
type: Question
has answer: http://stackoverflow.com/a/23702356
score: -2

http://stackoverflow.com/comment/36291788
type: QuestionComment
has text: Well sorry for misleading text, its an application which is not made by me.
score: 0
comment on: http://stackoverflow.com/q/23634132
type: Comment

http://stackoverflow.com/q/23727362
has comment: http://stackoverflow.com/comment/36512397
tagged with: java
has comment: http://stackoverflow.com/comment/36512417
tagged with: screen-capture
has comment: http://stackoverflow.com/comment/36646837
tagged with: xuggle
type: Question
tagged with: xuggler
has comment: http://stackoverflow.com/comment/36492081
score: 0
has body: I am making a screen recording application with Xuggler. I've basically encapsulated Java Code Geeks' Xuggler tutorial code into a runnable class for the actual recording. It should run just like the tutorial, but I'm getting some (actually a ton of) errors. The link to that code is here: JavaCodeGeeks. I'm not trying to take credit for this entire block of code. Here is what I have so far: import java.awt.AWTException; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.util.concurrent.TimeUnit; import javax.swing.JOptionPane; import src.dtf.gui.GUI; import com.xuggle.mediatool.IMediaWriter; import com.xuggle.mediatool.ToolFactory; import com.xuggle.xuggler.ICodec; public class ScreenRecorder implements Runnable { //Booleans to run and to pause. (Pausing not implemented yet) boolean running = true; boolean paused = false; //Some variables private GUI gui; private Toolkit tk; private String path, name, outputFilename; private int fps; private long startTime; private Rectangle recArea; private Dimension bounds; //Declare the MediaWriter private IMediaWriter writer; //Constructor public ScreenRecorder(GUI gui) { //Set the GUI to the one that I'm using (Another class this.gui = gui; //Initialize variables, based on previous user input. tk = Toolkit.getDefaultToolkit(); path = gui.getPath(); name = JOptionPane.showInputDialog("Please enter a name for your video file:"); outputFilename = path + "\\" + name + ".mp4"; fps = gui.getFPS(); if (gui.fullscreenChecked()) { recArea = new Rectangle(0, 0, tk.getScreenSize().width, tk.getScreenSize().height); } else { recArea = gui.getArea(); } bounds = new Dimension(recArea.width, recArea.height); } //Start method public void start() { gui.disableButtons(); gui.changeRecordButton(false); running = true; } //Run method public void run() { //Initialize init(); long lastTime = System.currentTimeMillis(); int updateT…
has comment: http://stackoverflow.com/comment/36601353
has comment: http://stackoverflow.com/comment/36492299
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36515740
has title: Xuggler "Could not write header" error
has answer: http://stackoverflow.com/a/23835592
has comment: http://stackoverflow.com/comment/36622839
tagged with: screenshot

http://stackoverflow.com/a/23729455
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23727193
has body: See if this post helps. It looks like some problem related to the installation or configuration of your JDK. Also, are you going through a proxy server or firewall?

http://stackoverflow.com/q/23756862
answer count: 2
tagged with: arrays
has body: I am looking at some example code on Listinterface and the implementation of it using array. I don't understand the instance variable private Object items[]; // an array of list items So is it an object called items, which is an array? why doesn't it just say private array items[] ? Also about the constructor items = new Object[MAX_LIST];does it initalise an array named item? The code is attached below. Many thanks for your help! public interface ListInterface { public boolean isEmpty(); public int size(); public void add(int index, Object item) throws ListIndexOutOfBoundsException, ListException; public Object get(int index) throws ListIndexOutOfBoundsException; public void remove(int index) throws ListIndexOutOfBoundsException; public void removeAll(); } public class ListArrayBased implements ListInterface { private static final int MAX_LIST = 90; private Object items[]; // an array of list items private int numItems; // number of items in list
score: 0
has title: Array-based implementation of the list interface
accepted answer: http://stackoverflow.com/a/23756935
tagged with: interface
has answer: http://stackoverflow.com/a/23757664
has comment: http://stackoverflow.com/comment/36526804
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/23757664
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23756935
tagged with: object

http://stackoverflow.com/q/23743970
has comment: http://stackoverflow.com/comment/43056268
type: Question
has answer: http://stackoverflow.com/a/23747510
has body: I'm trying to learn Ninja framework for building RESTful web services at here I got the following error when I run "mvn clean install" inside the newly created maven project folder: [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.610 s [INFO] Finished at: 2014-05-19T11:39:50-07:00 [INFO] Final Memory: 11M/81M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ninja: Fatal error compiling: invalid target release: 1.7 -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException I am on Mac Mavericks with Java 8, if this matters. Thanks
score: 0
answer count: 1
has title: Ninja framework Install Error with Maven
accepted answer: http://stackoverflow.com/a/23747510
tagged with: maven
type: AnsweredQuestion
tagged with: ninjaframework
tagged with: java

http://stackoverflow.com/q/23748399
has title: Can't read file correctly?
has body: I have a game that I am making and I have a character selection screen in which on this screen you can add/del characters. Adding characters works fine but the deleting part is being weird or so I think. Code Removed ActionListener for delbutton Which leads on to the delChar method of the program here. public static void delChar(int charNum) { String input; try { ArrayList&lt;String&gt; oldFile = new ArrayList&lt;String&gt;(); br = new BufferedReader(new FileReader(file)); while ((input = br.readLine()) != null) { if (!input.startsWith(charNum + "*")) { oldFile.add(input); } } br.close(); FileWriter write = new FileWriter(file,false); PrintWriter print = new PrintWriter(write); for (int i =0;i&lt;oldFile.size();i++) { print.printf("%s" + "%n", oldFile.get(i)); } write.close(); print.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Then into the charSelect method here. public static void charSelect(){ String[] stat = StatReader.getCharStats(charNum); if (StatWriter.getCharCount() &lt;1) { name.setText("No Characters Created"); classs.setText(""); lv.setText(""); ad.setText(""); md.setText(""); as.setText(""); armor.setText(""); mr.setText(""); health.setText(""); mana.setText(""); energy.setText(""); mReg.setText(""); eReg.setText(""); hReg.setText(""); } try { name.setText(stat[0]); classs.setText(stat[1]); lv.setText(stat[2]); ad.setText(stat[3]); md.setText(stat[4]); as.setText(stat[5]); armor.setText(stat[6]); mr.setText(stat[7]); health.setText(stat[8]); mana.setText(stat[9]); energy.setText(stat[10]); mReg.setText(stat[11]); eReg.setText(stat[12]); hReg.setText(stat[13]); // System.out.println(charNum); // System.out.println(Arrays.toString(stat)); } catch(NullPointerException e) { } MainMenu.MMframe.repaint(); MainMenu.MMframe.setVisible(true); } Then after that I hoped that the screen would display "No characters" but it doesn't. Another thing I had discovered is that when I delete the char from the file it does i…
has comment: http://stackoverflow.com/comment/36510991
tagged with: jframe
type: UnansweredQuestion
tagged with: filereader
has answer: http://stackoverflow.com/a/23748565
tagged with: java
tagged with: filewriter
tagged with: jpanel
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36510924
score: 0

quadratic
tags question: http://stackoverflow.com/q/23721264
type: Tag
tag name: quadratic

http://stackoverflow.com/comment/36415196
has text: destroy won't kill the whole tree and thus won't close their end of the pipe
type: Comment
comment on: http://stackoverflow.com/a/23697179
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36478187
has text: Why are you trying to define the class `java.lang.String`? Surely that already exists and is defined by the boot classloader? In Java, only the boot classloader is permitted to define classes whose name begins with `java.`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23727678
score: 0

http://stackoverflow.com/a/23682476
downvote count: 1
score: -1
has body: Thanks for the answers, folks. I'm pretty green in software engineering (junior dev, first job), so was just playing with the idea to see if I could make my adapter more extensible and easier to work with later. After reading the comments and playing with some things, it occurred to me that there's a much simpler way to go about this... @Override public Fragment getItem( int position ) { if( mRosterUids == null || mRosterUids.size() &lt;= position ) return null; Log.e( "RosterDetailsPagerAdapter", "getItem(): " + mRosterUids.get(position) ); return getRosterDetailsFragment( mRosterUids.get(position) ); } public SLRosterDetailsFragment getRosterDetailsFragment( String uid ) { return SLRosterDetailsFragment.newInstance( uid ); } and I'm sure I could even turn the return type to Fragment, but eh. Thanks all!
upvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23682179
answers question: http://stackoverflow.com/q/23682179
type: Answer

http://stackoverflow.com/comment/36354149
comment on: http://stackoverflow.com/q/23666058
type: Comment
type: QuestionComment
has text: Also, generics is a compile time concept. Reflection is a run time concept.
score: 0

http://stackoverflow.com/a/23748222
has comment: http://stackoverflow.com/comment/36511468
has comment: http://stackoverflow.com/comment/36510966
score: 0
has comment: http://stackoverflow.com/comment/36510517
has comment: http://stackoverflow.com/comment/36510854
answers question: http://stackoverflow.com/q/23748085
type: Answer
has body: This should work fine import java.awt.Dimension; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ImageProcessing extends JFrame { private JLabel jLabel1; private JPanel jPanel1; public ImageProcessing() { initComponents(); ImageIcon icon = new ImageIcon("D:\\timeline.jpg"); Image scaledInstance = icon.getImage().getScaledInstance(jLabel1.getWidth(), jLabel1.getHeight(), Image.SCALE_SMOOTH); ImageIcon scaledIcon = new ImageIcon(scaledInstance); jLabel1.setIcon(scaledIcon); this.setSize(new Dimension(1024, 768)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new ImageProcessing(); } }); } private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 604, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 351, Short.MAX_VALUE) ); jLabel1.setText("Label"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(139, 139, 139) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 493, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax…
has comment: http://stackoverflow.com/comment/36511682
has comment: http://stackoverflow.com/comment/36510852
has comment: http://stackoverflow.com/comment/36510932
has comment: http://stackoverflow.com/comment/36510902

http://stackoverflow.com/q/23649836
type: Question
has body: This question comes from previous experiences with svn. We had a problem where our code was badly formatted, mainly because of the increase in developers at the time who did not adhere to our formatting guide for various reasons. So there was discrepancies in code formatting for quite a bit of time. Additionally the codebase was quite old as well, so it was probably going on for years. Anyway, there was a suggestion to format all touched classes in new features into our agreed standard code formatting style. Other developers were against this mainly because: You can't use an annotation style view of the code, so you can't see what features a particular line of code is related to. In the end, we ended up rejecting this idea and only did formatting for newly introduced class files. For new code in existing classes, we only ensured that the lines that were edited were indented correctly. We are mostly eclipse users, but I think that this feature is available in other ide's as well (just checked online for netbeans and intellij). For an additional bit of context, the codebase in question was fairly mature and there was a fair balance between support work and new feature work. Sometimes new features were split into phases, so this is also something to consider. So the question(s) are: Was this the correct approach? Is it reasonable to reject "code formatting commits" just to preserve an annotated view of the code? Are there better ways of doing this? My opinion here is that maybe there should have been a commit hook that does automatic formatting, not sure if something like this is exists or is even valid though?
tagged with: version-control
has answer: http://stackoverflow.com/a/23649992
accepted answer: http://stackoverflow.com/a/23660238
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23650052
possible better answer: http://stackoverflow.com/a/23650052
tagged with: code-formatting
type: AnsweredQuestion
has title: "code formatting" commits into svn
has answer: http://stackoverflow.com/a/23660238
tagged with: svn
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36345798
comment on: http://stackoverflow.com/q/23661105
type: Comment
type: QuestionComment
has text: Check your firewalls..Best is that you disable them completely while testing..
score: 0

http://stackoverflow.com/comment/36417360
has text: Your regex in question seemed faulty. Try updated regex.
comment on: http://stackoverflow.com/a/23699388
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/23671745
has comment: http://stackoverflow.com/comment/36364763
tagged with: regex
has answer: http://stackoverflow.com/a/23671874
type: AnsweredQuestion
score: 0
tagged with: java
has title: regular expression with letters, numbers and some punctuation
type: Question
accepted answer: http://stackoverflow.com/a/23671874
answer count: 1
has body: I am very new to regular expressions. I need to construct a regular expression which if used in the code below would produce a newLine that had only letters (upper and lowercase), numbers, @, -, _ and .. The following expression does not work: ([^\\w][^@][^-][^_][^\\.]). It replaces some of the letters and not all of the unwanted characters. Why doesn't it work? String line = in.nextLine(); String newLine = line.replaceAll( "([^\\w][^@][^-][^_][^\\.])", " ");

http://stackoverflow.com/comment/36458826
score: 1
comment on: http://stackoverflow.com/q/23721264
type: Comment
type: QuestionComment
has text: For what input values?

http://stackoverflow.com/q/23685003
downvote count: 1
has comment: http://stackoverflow.com/comment/36390438
has answer: http://stackoverflow.com/a/23685337
tagged with: java
score: -1
type: Question
has body: I'm trying to get my loop to go over and over again until the user types in "quit" then it will quit. Basically I'm trying to get my Finch robot to change nose color depending on how it's positioned, but I'm confused on how to get it to allow the user to position it again after it has already been positioned so that the nose color can change color multiple times. When it first runs the Finch will execute the code but quits immediately afterwards. Here is my code: public class finch { public static final int INCREASE = 20; public static final int SEC = 1000; public static final int MAXSPEED = 255; public static final int HALFSEC = 500; public static Finch myFinch; public static void main(String[] args) { myFinch = new Finch(); Menu(); } public static void Menu() { Scanner console = new Scanner(System.in); System.out.println("Enter your choice:" + ""); int input; int input1; boolean flag=true; while(flag){ System.out.println("1.\t" + "Rolling" + "Finch"); System.out.println("2.\t" + "Obedient" + "Finch"); System.out.println("3.\t" + "Exit"); System.out.println(); System.out.println("Enter your choice:"); System.out.println(); input = console.nextInt(); flag=false; if (input == 1) { //input = DarkFinch; System.out.println("Position the Finch \"down\" or \"up\" to change nose color"); rolling(myFinch); } else if (input == 2) { // input = ChasetheFinch; // System.out.println("Chase The Finch"); } else if (input == 3) { // input = Exit; System.out.println("Goodbye"); } else { // System.out.println("Try again"); flag=true; /* return Menu(); */ } } } public static boolean rolling(Finch myFinch) {//This method will change the Finches nose color depending on the Finches position. //"up" = place the finch upright standing on its tail for (int i = 1; i &lt;= 20; i++) { while (myFinch.isBeakDown() || myFinch.isBeakUp()) { if (myFinch.isBeakDown()) { myFinch.setLED(0,0,255,3000); } else if (myFinch.isBeakUp()) { myFinch.setLED(255,0,0,3000); } else { myFinch.setLED(0,0,0,5000); }…
upvote count: 0
has comment: http://stackoverflow.com/comment/36390404
answer count: 1
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/36390352
has title: While loop behaving unexpectedly in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36390258
tagged with: finch
tagged with: loops

http://stackoverflow.com/comment/36471965
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23727659
has text: At the end of your info method you have 12 random Strings, are you saying you want one of those Strings to be the message in your JOPtionPane?

http://stackoverflow.com/comment/36262232
score: 1
comment on: http://stackoverflow.com/q/23618147
type: Comment
type: QuestionComment
has text: It should be something like `em.merge(editUser);` instead of `em.merge(searchQuery);`. Then all you need to do is make `User` a proper *JPA* entity. After, you'll need to rid of the code in the middle part of your `editUserProfile` method (as they are/will be useless). Finally you'll also need to rightly instantiate `EntityManager`, its 'factory', and the PU. That's it you are done.

http://stackoverflow.com/q/23675025
favorite count: 0
type: Question
tagged with: android
has body: I'm using a custom list view here and already disabled the dividers for the list view. I also tried on the normal listview (not a custom one) but it still didn't worked. Is there any ways beside modifying it from the xml? Here's the code for the listview xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:showDividers="none" tools:context=".MainActivity" > Could someone help me get rid of the divider? :) Thanks!
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23675189
has title: Java Android - Dividers already disabled but still shown
type: UnansweredQuestion
tagged with: divider
tagged with: listview
has comment: http://stackoverflow.com/comment/36373974
downvote count: 0
score: 1

http://stackoverflow.com/comment/36284261
has text: `Maybe there is something I miss about how HashMaps work` rather not ... it seems like you are missing the point that not creating new object is not creating new object(so you are using the same - `tempNomoi` instance)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23630710
score: 0

http://stackoverflow.com/q/23651999
tagged with: java
tagged with: hibernate
score: 0
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/23645091
type: UnansweredQuestion
type: Question
has title: Hibernate update with relations foreign key
has answer: http://stackoverflow.com/a/23653304
has body: I am trying to persist entity A which has a reference to a B object, with Hibernate through JPA. In my view, I created a form which has a combobox filled with B entries. When I process user's input I create a new DTO for A element and I assign a B DTO as its related entity. Then I send this object to my service layer and there I call my dao to persist my A entity: dao.persist(A); But I get the following exception: Error org.hibernate.TransientPropertyValueException: object references an unsaved transient instance If I annotate my Entity with cascade=CascadeType.ALL, then I get a new B entity inserted into the database. How can I do it so my A entity is persisted just by the foreign key for B? That is, only the foreign key gets inserted into the database (since B is a master table, I don't need elements to be inserted).

http://stackoverflow.com/q/23703677
has comment: http://stackoverflow.com/comment/36427254
has comment: http://stackoverflow.com/comment/36425950
type: Question
score: 0
answer count: 2
tagged with: jsoup
has body: My problem is the following: I got some data with Jsoup from a website (Jsoup code is from here also) public class Kereso { public static void main(String[] args) throws IOException { String html = "http://www.szerencsejatek.hu/xls/otos.html"; Document doc = Jsoup.connect(html).get(); Elements tableElements = doc.select("table"); Elements tableRowElements = tableElements.select(":not(thead) tr"); for (Element row : tableRowElements) { Elements rowItems = row.select("td"); for (Element rowItem : rowItems) { System.out.println(rowItem.text()); } System.out.println(); } } } Every line that I get from the website should be an object and I want to store all of these objects in an ArrayList This is the class for the objects, and the data they need: public class Huzas { private String ev; private String het; private String huzasdatum; private String otosDb; private String otos; private String negyesDb; private String negyes; private String harmasDb; private String harmas; private String kettesDb; private String kettes; private int szam1; private int szam2; private int szam3; private int szam4; private int szam5; public Huzas(String ev, String het, String huzasdatum, String otosDb, String otos, String negyesDb, String negyes, String harmasDb, String harmas, String kettesDb, String kettes, int szam1, int szam2, int szam3, int szam4, int szam5) { this.ev = ev; this.het = het; this.huzasdatum = huzasdatum; this.otosDb = otosDb; this.otos = otos; this.negyesDb = negyesDb; this.negyes = negyes; this.harmasDb = harmasDb; this.harmas = harmas; this.kettesDb = kettesDb; this.kettes = kettes; this.szam1 = szam1; this.szam2 = szam2; this.szam3 = szam3; this.szam4 = szam4; this.szam5 = szam5; } Is it possible to store them in that way? And if Yes, of course how?
has answer: http://stackoverflow.com/a/23716315
tagged with: arraylist
tagged with: store
accepted answer: http://stackoverflow.com/a/23716315
has title: How can I store data, using Jsoup
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23704237
tagged with: java
has answer: http://stackoverflow.com/a/23704237

http://stackoverflow.com/comment/36320229
comment on: http://stackoverflow.com/a/23648663
score: 0
type: AnswerComment
has text: Thank you so much [@MadProgrammer](http://stackoverflow.com/users/992484/madprogrammer). Let me study this. If I had enough points I'd up-vote you. I'll accept your answer later. Let me leave the question open for the time being. Thank you again.
type: Comment

http://stackoverflow.com/q/23733895
type: Question
has comment: http://stackoverflow.com/comment/36483437
tagged with: java
tagged with: scrollbar
tagged with: jtextarea
upvote count: 1
answer count: 1
has body: I have a JTextArea in my GUI (my GUI class extends JFrame), which I have added using the following code: public static JTextArea displayOutput = new JTextArea(text, rows, columns); displayOutput.setBounds(10, 610, 700, 450); panel.add(displayOutput); displayOutput.setEditable(false); I now want to add a scroll bar to the JTextArea, and have tried doing this by adding the lines: JScrollPane displayOutputScroll = new JScrollPane(displayOutput); displayOutputScroll.setVericalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); But, I get a syntax error on "setVerticalScrollBarPolicy", which says that an Identifier is expected after this token. I have also tried adding the scrollbar with this line instead: JScrollPane displayOutputScroll = new JScrollPane(displayOutput, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); But get a compile error that says: "The constructor JScrollPane(JTextArea, int) is undefined. Can someone point out to me what I'm doing wrong here? How can I add a scroll bar to the JTextArea? Here is the full code for my Gui class, as requested: package openDIS; import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.IOException; import java.net.UnknownHostException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Gui extends JFrame{ public static String text = ""; public static int rows = 20; public static int columns = 5; public static JTextArea receivingNetworkInfo = new JTextArea(text, rows, columns); public static JTextArea sendingNetworkInfo = new JTextArea(text, rows, columns); public static JTextArea displayOutput = new JTextArea(text, rows, columns); public static JTextArea displayFilteredOutput = new JTextArea(text, rows, columns); /*Add scroll bars to the display areas */ JScrollPane displayOutputScroll = new JScrollPane(displayOutput); displayOutputScroll.setVerticalScrollBarPolicy(ScrollPaneConstan…
favorite count: 0
has comment: http://stackoverflow.com/comment/36483708
accepted answer: http://stackoverflow.com/a/23734307
has answer: http://stackoverflow.com/a/23734307
type: AnsweredQuestion
downvote count: 0
has title: Adding a scrollbar to my JTextArea- class extends JFrame
score: 1

http://stackoverflow.com/q/23754783
score: 0
tagged with: playframework
answer count: 1
has title: How to parse RequestBody in Play Framework (Java)
has body: I need to parse the RequestBody of a POST, currently I am doing the following: public static Result createMessages(){ RequestBody body = request().body(); return ok("Got body: " + body); } This results in the following being returned to the browser: Got body: DefaultRequestBody(None,None,None,None,None,Some(MultipartFormData(Map(from -&gt; List(Hello), message -&gt; List(World), subject -&gt; List(Test)),List(),List(),List())),false) I need to get the MultipartFormData from this output as you can see it has the posted values, but unsure how to do this in Java Play
type: UnansweredQuestion
tagged with: playframework-2.0
tagged with: java
has answer: http://stackoverflow.com/a/23755156
tagged with: http
type: Question
tagged with: post

http://stackoverflow.com/comment/36333365
comment on: http://stackoverflow.com/a/23642404
has text: I did get it to work if I took out the JFrame portion of the code and then just put the JPanel into the JPanel in red. Then it worked but your way would also allow for any menu on the JFrame to be displayed as well.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23704903
accepted answer: http://stackoverflow.com/a/23705060
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/3487585
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/23705060
has title: How to share code between two projects?
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: classpath
has body: I have two Java projects called A and B. Both of them are web apps deployed as war files. I created them in Eclipse workspace separately. Project B uses a class in project A named MusicMapper. I added the project A to project B's build path in Eclipse as suggested in this post. So now project B can compile without any errors and the class MusicMapper can be seen in project B by importing it in project B: import com.projectA.MusicMapper; Everything seems to be fine before I launched the web app of project B. However, when I launched the project B and called the code that references class MusicMapper in project A, I got the following runtime error: java.lang.ClassNotFoundException: com.projectA.MusicMapper So this error seems to be caused by unfound class com.projectA.MusicMapper which is imported from project A. Since I already added project A to project B build path and project B compiles fine without any errors, why does it report this error at runtime? Another approach I took was: I've also tried using the following Maven import in project B's pom.xml: com.projectA projectA 0.0.1-SNAPSHOT system /path/to/projectA.jar where projectA.jar is the jar file I exported from project A. But it still gave me the same ClassNotFoundException. How can I make the class in project A usable by project B? It seems that neither of the two approaches I've tried works.
has comment: http://stackoverflow.com/comment/36428984
type: Question

http://stackoverflow.com/comment/36403748
comment on: http://stackoverflow.com/q/23691593
score: 1
type: Comment
type: QuestionComment
has text: I'm not sure of this (which is why it's just a comment) but I don't think SOAP lets you transmit dates and times as a `Timestamp`. I would suggest storing them as the number of milliseconds since 1/1/1970, which you can get using the `getTime()` method. Please let me know if that works and I'll convert this comment to an answer.

http://stackoverflow.com/comment/87144604
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/38274671
type: Comment
has text: Best answer since it only relies on Jackson, rather than two distinct libraries.

http://stackoverflow.com/q/23617753
has comment: http://stackoverflow.com/comment/36259804
has title: Passing in a List<Interface> parameter
type: Question
has comment: http://stackoverflow.com/comment/36260368
has comment: http://stackoverflow.com/comment/36260066
has comment: http://stackoverflow.com/comment/36260089
score: 0
has comment: http://stackoverflow.com/comment/36260234
has comment: http://stackoverflow.com/comment/36260180
answer count: 0
linked to: http://stackoverflow.com/q/2745265
type: UnansweredQuestion
tagged with: interface
has body: I'm using a method: public List&lt;IRecord&gt; combineTypes(List&lt;IRecord&gt;) Which will take the required values from the IRecord objects and combine like values, updating and returning the updated list. However, IRecord is an interface. I'm attempting to call the combineTypes() method on passing in a list of an object that implements the IRecord interface: For example, the CoverageRecord class implements IRecord and I am trying to call combineTypes(data) where data is a List&lt;CoverageRecord&gt; But my compiler is throwing an error, saying I am passing in an invalid argument. Is there a workaround or something I am missing? I feel like I'm just brain-farting.
duplicate of: http://stackoverflow.com/q/2745265
has comment: http://stackoverflow.com/comment/36260117
has comment: http://stackoverflow.com/comment/36259805
tagged with: java
has comment: http://stackoverflow.com/comment/36259904

http://stackoverflow.com/comment/36556576
type: QuestionComment
comment on: http://stackoverflow.com/q/23771902
has text: @araut Yes I'm using Fragment, but how can I set listener of my button inside fragment_main? I don't want the button in activity_main.
score: 0
type: Comment

http://stackoverflow.com/a/23777493
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36566716
has body: The exception you have received is quite informative... learning to read exceptions and trace them is an important process! It looks to me as if at line 338 of MyPokerGame.java you are calling scanner.nextLine without first double-checking that scanner.hasNextLine() calling nextLine() when the scanner doesn't have a next line will throw this exception. the idiomatic way to use the Scanner class is: while(scanner.hasNextLine()){ str=scanner.nextLine(); //... } If you ever get an exception check the source of the exception and refer to the docs for the Exception type (or just paste the execption into google and you'll probably find a link to the answer right here on StackOVerflow!)
answers question: http://stackoverflow.com/q/23777315
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36567087
downvote count: 0
has comment: http://stackoverflow.com/comment/36567153
accepted answer of: http://stackoverflow.com/q/23777315
type: Answer

http://stackoverflow.com/comment/36269865
type: Comment
type: QuestionComment
score: 1
has text: One thing I can confirm that the issue is with your JS client and not the server. I dont have html 5 here so cannot test your JS, but I used a java based client and the server worked fine.
comment on: http://stackoverflow.com/q/23622842

http://stackoverflow.com/a/23642642
score: 7
type: AcceptedAnswer
downvote count: 0
has body: UnaryOperator&lt;T&gt; - this does exactly this thing.
accepted answer of: http://stackoverflow.com/q/23642422
answers question: http://stackoverflow.com/q/23642422
type: Answer
upvote count: 7

http://stackoverflow.com/comment/36413752
comment on: http://stackoverflow.com/q/23697869
score: 1
type: Comment
type: QuestionComment
has text: You have a `List` of `Product`. When you do `list.get(9)` you get a `Product` and since you didn't specify that a `Product` is comparable, the compiler doesn't know that such method exists for the underlying implementation of the Product object you get.

http://stackoverflow.com/comment/36515444
type: Comment
score: 0
has text: @Halt, You are very welcome. Please remember you can mark this as the accepted answer if it resolves your question. :)
comment on: http://stackoverflow.com/a/23750838
type: AnswerComment

http://stackoverflow.com/comment/36278823
type: QuestionComment
has text: @JonSkeet that was mistake. I tried doing some changes with code :)
score: 0
comment on: http://stackoverflow.com/q/23627343
type: Comment

http://stackoverflow.com/comment/36292013
type: AnswerComment
type: Comment
has text: Alternatively `numNeuronsPerLayer` could be saved as a class variable. It depends on what the idea behind this class is.
score: 0
comment on: http://stackoverflow.com/a/23634604

http://stackoverflow.com/comment/36265033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23620351
has text: Thank you, huge improvement compared to before, but i am still getting a null message `How many tickets do you want? 0 Sorry, there is a 1 lotto ticket minimum! null How many tickets do you want? 1 8 44 24 18 14 MEGA: 16 `
type: Comment

http://stackoverflow.com/a/23648313
has body: This is a little bit confusing, but you have to set the foreground color and a fill pattern. final HSSFCellStyle cell = (HSSFCellStyle) workbook.createCellStyle(); cell .setFillForegroundColor( ... ); cell .setFillPattern( CellStyle.SOLID_FOREGROUND ); Updated to CellStyle.SOLID_FOREGROUND
type: Answer
has comment: http://stackoverflow.com/comment/36323913
has comment: http://stackoverflow.com/comment/36323140
score: 0
answers question: http://stackoverflow.com/q/23648237

http://stackoverflow.com/q/23635208
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36298664
tagged with: ejb
tagged with: junit
has comment: http://stackoverflow.com/comment/36322967
has body: I'm developing a client-server application using EJB and Glassfish in NetBeans. I've implemented a method on the client that uses a Session Bean. I've tried the method calling the method from the main and it works. Now I was trying to test the behavior of the method in a test case. Netbeans force me to put the JUnit test case in the Test Packages folder. Running the test throws the following exception: Testcase: test21(registrazioneTest): Caused an ERROR javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial java.lang.RuntimeException: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at GestoreAccountLocale.GestoreAccountLocale.lookupGestoreAccountRemotoRemote(GestoreAccountLocale.java:147) at GestoreAccountLocale.GestoreAccountLocale.registrazione(GestoreAccountLocale.java:37) at registrazioneTest.test21(registrazioneTest.java:185) Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:344) at javax.naming.InitialContext.lookup(InitialContext.java:411) at GestoreAccountLocale.GestoreAccountLocale.lookupGestoreAccountRemotoRemote(GestoreAccountLocale.java:144) Here is the client method 'registrazione' that i want to test: public static void registrazione(String username, String password, String nome, String cognome, String email, Date dataNascita) throws VincoliInputException, RegistrazioneException { checkUsername(username…
type: Question
tagged with: session-bean
has comment: http://stackoverflow.com/comment/36326279
tagged with: netbeans
score: 0
has answer: http://stackoverflow.com/a/23636479
has comment: http://stackoverflow.com/comment/36295067
answer count: 1
has title: Runnig tests that use EJB in Netbeans

http://stackoverflow.com/q/23763070
tagged with: java
has comment: http://stackoverflow.com/comment/39575139
has comment: http://stackoverflow.com/comment/36546547
has title: Can't create new or open Netbeans projects in Ubuntu 14
type: Question
answer count: 2
has body: When to try to create a project in Netbeans, it freezes up after clicking Finish. All my buttons are greyed out, and I have to close the dialogue. I would attach a picture to show, but Im missing a few rep points. After I close this dialogue, I just see the blank netbeans screen with no projects visible in my projects sidebar. If I try to Open Project and navigate to where I saved it, I can select the project and click the Open Project button, but I return to the screen shown above, with no projects in the projects navigator in the sidebar. Here is what I have already tried: Reinstall netbeans Remove openjdk and install oracle's java Deleting the nbproject folder inside my project Thanks in advance.
tagged with: project
tagged with: ubuntu
has answer: http://stackoverflow.com/a/25352328
score: 0
has comment: http://stackoverflow.com/comment/36538721
type: UnansweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/28225974
has comment: http://stackoverflow.com/comment/36538548

http://stackoverflow.com/a/23674186
answers question: http://stackoverflow.com/q/23673925
has body: You need to perform download operation on background thread and update UI from UI thread. For this, you can use AsyncTask: Like this: private class DownloadFilesTask extends AsyncTask&lt;URL, Integer, Long&gt; { protected Long doInBackground(URL... urls) { // TODO do actual download // publish your download progress publishProgress(count); return null; // TODO insert your result } protected void onProgressUpdate(Integer... progress) { // TODO set progress to progressbar // update UI } protected void onPostExecute(Long result) { // called when download is complete // update UI } } start download: private void startDownload() { progressBar.setVisibility(View.VISIBLE); asyncTask = new DownloadFilesTask(); asyncTask.execute(&lt;urls for download&gt;); }
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23673925
score: 1
upvote count: 1

http://stackoverflow.com/comment/36478428
comment on: http://stackoverflow.com/q/23731172
score: 0
type: Comment
type: QuestionComment
has text: Why do you think a `Licence` is a `Vector` to begin with?

http://stackoverflow.com/comment/36563477
type: QuestionComment
comment on: http://stackoverflow.com/q/23775924
has text: There is not input box, I have to enter in the div directly. and using sendKeys I am not able to
score: 0
type: Comment

servlet-mapping
tags question: http://stackoverflow.com/q/23622189
type: Tag
tag name: servlet-mapping

http://stackoverflow.com/comment/36440459
type: Comment
comment on: http://stackoverflow.com/a/23711068
score: 0
type: AnswerComment
has text: I made changes, as you mentioned above but then it doesn't work properly. It is not adding records by making the changes you mentioned !

http://stackoverflow.com/comment/36263705
score: 0
has text: What action is you your ActionListener (FrequentQuestions) attached to?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23619552

http://stackoverflow.com/comment/36427124
has text: @blalasaadri Technically macros aren't supported by Java itself, but you can always run your java source through a C preprocessor to get the same effect
score: 0
comment on: http://stackoverflow.com/q/23704355
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23739158
tagged with: iframe
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23761239
score: 0
has body: Good morning! I have a java servlet which receives a list of parameters and generates a PDF file for me. Something like: http://url/download/file?id=123&amp;ext=pdf When I access that URL within my browser window, the file is downloaded. The problem is that I need to download the file in a hidden iframe, and notify the user when the download completes. Downloading the file is easy: var iframe = $('&lt;iframe/&gt;', { src: formURL+'&amp;'+formData+'&amp;docList='+inputDocList.val() }); $('body').append(iframe); Iframe is appended to the body and the download starts. I need to know when the download ends. I already tried using jquery's load event: iframe.load(...) but it wont trigger when my download finishes. I also tried inspecting the DOM of the iframe before and after the download completes, and it appears to be the same. Is there a way to do this? I need a callback! Thank you guys.
answer count: 1
tagged with: jquery
tagged with: callback
linked to: http://stackoverflow.com/q/3982369
has title: IFRAME callback after download completes?
type: UnansweredQuestion

sockets
tags question: http://stackoverflow.com/q/23749939
tags question: http://stackoverflow.com/q/23726690
tags question: http://stackoverflow.com/q/23755874
tags question: http://stackoverflow.com/q/23671043
tags question: http://stackoverflow.com/q/23739088
tags question: http://stackoverflow.com/q/23649120
tags question: http://stackoverflow.com/q/23682165
tags question: http://stackoverflow.com/q/23639286
tags question: http://stackoverflow.com/q/23636187
tags question: http://stackoverflow.com/q/23638249
tags question: http://stackoverflow.com/q/23703398
tags question: http://stackoverflow.com/q/23653679
tags question: http://stackoverflow.com/q/23730358
tags question: http://stackoverflow.com/q/23677567
tags question: http://stackoverflow.com/q/23668476
tags question: http://stackoverflow.com/q/23681664
tags question: http://stackoverflow.com/q/23766607
tags question: http://stackoverflow.com/q/23752373
tags question: http://stackoverflow.com/q/23747812
tags question: http://stackoverflow.com/q/23731226
tags question: http://stackoverflow.com/q/23622839
tags question: http://stackoverflow.com/q/23634768
tags question: http://stackoverflow.com/q/23718466
tags question: http://stackoverflow.com/q/23760031
tags question: http://stackoverflow.com/q/23732582
tags question: http://stackoverflow.com/q/23770063
type: Tag
tags question: http://stackoverflow.com/q/23716830
tags question: http://stackoverflow.com/q/23658848
tags question: http://stackoverflow.com/q/23640931
tags question: http://stackoverflow.com/q/23643063
tags question: http://stackoverflow.com/q/23671267
tags question: http://stackoverflow.com/q/23737362
tags question: http://stackoverflow.com/q/23667967
tags question: http://stackoverflow.com/q/23741399
tags question: http://stackoverflow.com/q/23730280
tags question: http://stackoverflow.com/q/23765799
tags question: http://stackoverflow.com/q/23716735
tags question: http://stackoverflow.com/q/23642284
tags question: http://stackoverflow.com/q/23718921
tags question: http://stackoverflow.com/q/23643600
tags question: http://stackoverflow.com/q/23730855
tags question: http://stackoverflow.com/q/23662414
tags question: http://stackoverflow.com/q/23742157
tag name: sockets
tags question: http://stackoverflow.com/q/23618729
tags question: http://stackoverflow.com/q/23748285
tags question: http://stackoverflow.com/q/23702360
tags question: http://stackoverflow.com/q/23689605
tags question: http://stackoverflow.com/q/23696170
tags question: http://stackoverflow.com/q/23686292
tags question: http://stackoverflow.com/q/23761984
tags question: http://stackoverflow.com/q/23724112
tags question: http://stackoverflow.com/q/23763752
tags question: http://stackoverflow.com/q/23766596
tags question: http://stackoverflow.com/q/23686267
tags question: http://stackoverflow.com/q/23623035
tags question: http://stackoverflow.com/q/23720341
tags question: http://stackoverflow.com/q/23688094
tags question: http://stackoverflow.com/q/23628514

http://stackoverflow.com/comment/36345309
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23661582
score: 0
has text: And then add it with lines.add(string);

http://stackoverflow.com/q/23666732
has answer: http://stackoverflow.com/a/23669671
has answer: http://stackoverflow.com/a/23670758
tagged with: many-to-many
has comment: http://stackoverflow.com/comment/36399403
score: 0
tagged with: java
tagged with: hibernate
answer count: 2
has comment: http://stackoverflow.com/comment/36406967
tagged with: mysql
has comment: http://stackoverflow.com/comment/36407030
has comment: http://stackoverflow.com/comment/36360238
has comment: http://stackoverflow.com/comment/36403972
type: UnansweredQuestion
type: Question
has body: I'm trying to implement a @ManyToMany relationship, but my join table isn't being populated. My app models a bunch of Competition objects to Competitor objects. There is a group of Competitors. Within that group, each Competitor is matched with each other Competitor to form a Competition. So each Competition can have a list of Competitor objects. And each Competitor can be in multiple Competitions. Entity Objects Competition looks like this: @Entity @Table(name = "competition") public class Competition implements java.io.Serializable { @Id @GeneratedValue private int competitionId; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "competition_competitors", joinColumns = @JoinColumn(name = "competitionId"), inverseJoinColumns = @JoinColumn(name = "competitorId")) private Set&lt;Competitor&gt; competitors = new TreeSet&lt;Competitor&gt;(); . . . My competitor object looks something like this: @Entity @Table(name = "competitor") public class Competitor implements Comparable&lt;Competitor&gt;, java.io.Serializable { @Id @GeneratedValue private int competitorId; @ManyToMany(mappedBy = "competitors", cascade = CascadeType.ALL) private Set&lt;Competition&gt; competitions = new TreeSet&lt;Competition&gt;(); . . . CompetitionService Method @Override @Transactional(readOnly = false) public Competition createCompetition(League league, Competitor competitor1, Competitor competitor2) { Competition competition = getCompetitionDAO().create(league); competition.add(competitor1); competition.add(competitor2); this.competitionDao.saveOrUpdate(competition); return competition; } CompetitionDAO Method @Override @Transactional(readOnly = false) public void saveOrUpdate(Competition competition) { if (competition != null) { Session session = getCurrentSession(); try { session.saveOrUpdate(competition); } catch (Exception exception) { throw new AppException(exception); } } } Application Code This code should create a competition and persist it. It used to do that, but somewhere alo…
has title: Hibernate @ManyToMany -- join table isn't being populated

http://stackoverflow.com/a/35104071
upvote count: 1
has comment: http://stackoverflow.com/comment/57947596
score: 1
has comment: http://stackoverflow.com/comment/57929586
downvote count: 0
answers question: http://stackoverflow.com/q/23751618
type: Answer
has comment: http://stackoverflow.com/comment/57929697
has body: public static String[] splitPath (String path) { String backslash = ((char)92) + ""; if (path.contains(backslash)) { ArrayList&lt;String&gt; parts = new ArrayList&lt;&gt;(); int start = 0; int end = 0; for ( int c : path.toCharArray() ) { if (c == 92) { parts.add(path.substring(start, end)); start = end + 1; } end++; } parts.add(path.substring(start)); return parts.toArray( new String[parts.size()] ); } return path.split("/"); }

http://stackoverflow.com/comment/36329388
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23653477
has text: I have just found the solution [here](http://stackoverflow.com/questions/20270002/jenkins-maven-could-not-resolve-default-java-home-path-build-failing?rq=1). What I had to do was to define the JAVA_HOME also in the global configuration of Jenkins. Thanks Anders!
type: QuestionComment

http://stackoverflow.com/q/23665121
has title: Running different .exe program from java program
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23665610
has answer: http://stackoverflow.com/a/23674790
has comment: http://stackoverflow.com/comment/36353134
type: Question
answer count: 2
favorite count: 0
has body: I got stuck while trying to run bfgminer.exe -o bla.bla.com -u &lt;nick&gt; -p &lt;passwd&gt; -S auto -d all I tried a number of ways to run this executable, but I can't get it to work: public static void runCmd(){ try{ ProcessBuilder builder = new ProcessBuilder("cmd.exe","/c", "cd \"C:\\Users\\pawisoon\\bfgminer-3.10.0-win64\" &amp;&amp; bfgminer.exe -o bla.bla.com -u &lt;user&gt; -p &lt;pswd&gt; -S auto -d all"); builder.redirectErrorStream(true); Process pd = builder.start(); BufferedReader r = new BufferedReader(new InputStreamReader(pd.getInputStream())); String line; while (true) { line = r.readLine(); if (line == null) { break; } System.out.println(line); } } catch(IOException e){ } } This is what I got from console in Eclipse: 'bfgminer.exe' is not recognized as an internal or external command, operable program or batch file. Please help me how to solve this problem :/
tagged with: cmd
possible better answer: http://stackoverflow.com/a/23674790
upvote count: 0
tagged with: process
accepted answer: http://stackoverflow.com/a/23665610
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/36383044
type: Comment
type: QuestionComment
has text: OMG I just totally overlooked configuration activity chapter there! Thanks for good point
score: 1
comment on: http://stackoverflow.com/q/23681057

http://stackoverflow.com/comment/36554779
comment on: http://stackoverflow.com/q/23771124
type: Comment
type: QuestionComment
has text: The Thread can only make itself sleep. You need to pass it a signal somehow (implemented in your own code).
score: 0

http://stackoverflow.com/comment/36364880
type: Comment
comment on: http://stackoverflow.com/a/23655060
score: 0
type: AnswerComment
has text: Not much about it as I never worked on J2ME. But yes I have worked on mobile app development using Android and PhoneGap. I have swing for desktop app development and found it to be quite heavy for mobile development. A quick search on google reveals that there are some frameworks(not sure if they are based on swing) for UI in J2ME. http://stackoverflow.com/questions/116394/java-me-ui-libraries http://developer.nokia.com/community/wiki/Java_ME_UI_Frameworks

http://stackoverflow.com/comment/36347473
type: AnswerComment
has text: That is what I was looking for. So if I have a class that implements an interface of a couple of interfaces I would be better off make the instance that of the interface rather than the class. i will put up another example here in the next hour or so.
comment on: http://stackoverflow.com/a/23662371
type: Comment
score: 0

http://stackoverflow.com/q/23716832
has comment: http://stackoverflow.com/comment/36497218
tagged with: java
has comment: http://stackoverflow.com/comment/36451703
has answer: http://stackoverflow.com/a/28637010
accepted answer: http://stackoverflow.com/a/28637010
has title: Prevent killing of service when clear recent tasks
type: Question
upvote count: 1
answer count: 1
has body: My app has Remote, Foreground aidl service which bound to activity. When i clear recent task (by swipe) service destroy. How can i prevent killing of service. &lt;service android:enabled="true" android:exported="false" android:stopWithTask="false" android:process=":xplay" android:name="com.perm.x.Services.PlayingService"/&gt; Here is how i bind (in onResume) Intent serviceIntent = new Intent(this,PlayingService.class); startService(serviceIntent); bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); Here is how i unbind service (in onPause) unbindService(serviceConnection);
linked to: http://stackoverflow.com/q/20677781
has comment: http://stackoverflow.com/comment/36463998
favorite count: 0
has comment: http://stackoverflow.com/comment/36555048
has comment: http://stackoverflow.com/comment/36495819
tagged with: android
has comment: http://stackoverflow.com/comment/36555092
tagged with: service
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36463981
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/45573626
has comment: http://stackoverflow.com/comment/45553713

http://stackoverflow.com/comment/36566366
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23777070
has text: @LuiggiMendoza did POI load all content at once?

http://stackoverflow.com/q/23744024
has title: Time Based Streaming
tagged with: java-8
tagged with: java
has comment: http://stackoverflow.com/comment/54165021
type: Question
has body: I am trying to figure out how to get time-based streaming but on an infinite stream. The reason is pretty simple: Web Service call latency results per unit time. But, that would mean I would have to terminate the stream (as I currently understand it) and that's not what I want. In words: If 10 WS calls came in during a 1 minute interval, I want a list/stream of their latency results (in order) passed to stream processing. But obviously, I hope to get more WS calls at which time I would want to invoke the processors again. I could totally be misunderstanding this. I had thought of using Collectors.groupBy(x -&gt; someTimeGrouping) (so all calls are grouped by whatever measurement interval I chose. But then no code will be aware of this until I call a closing function as which point the monitoring process is done. Just trying to learn java 8 through application to previous code
has comment: http://stackoverflow.com/comment/54165022
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23744705

http://stackoverflow.com/q/23749624
has answer: http://stackoverflow.com/a/23761527
score: 0
has body: I have a Mule app that takes in HTTP requests (http inbount endpoint.) When I'm starting my server, I need to make sure the Mule app is ready to take in requests before I start another program, let's call it program B, which is the client sending the requests to the Mule app. While Mule starts at about the same time as Program B in Ubuntu, program B is much faster to be up and kicking than the Mule app is. Program B only gets "Connection Refused" Errno111 until the Mule app is ready, which, while not being a critical issue (thanks to retries), is annoying to see happening at every startup. Therefore, I need to let Program B idle for a given amount of time until the app is ready to take in requests. So far I can think of two ways to do this. The first is to use a hard-coded integer in my shell script (Program B), for instance: sleep 180 with the hope it is long enough for the Mule app to be ready. It does work quite reliably because Mule and the app are identical every time the server is started, and so they tend to take the same amount of time given the same hardware/OS. The second solution I'm thinking of is to check the output of Mule or the new lines appended to its log file and trigger the program when the Mule app is ready to start. When the app is ready, you usually have a line like this in the main mule.log as well as in the stdout: + Started app 'myapp' + I could then sleep for a few seconds to be sure and then start to make requests. However, I'm wondering if there is not a more refined way to do this. For instance, Program B could be the one expecting to be notified by Mule when it is ready. Or there may be a way to query Mule in a cleaner fashion to tell whether an app is ready or not. Thanks for your suggestions!
tagged with: process
accepted answer: http://stackoverflow.com/a/23761527
type: AnsweredQuestion
has title: Mule: Checking that an app is ready
tagged with: java
tagged with: mule
possible better answer: http://stackoverflow.com/a/25435460
tagged with: app-startup
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25435460

http://stackoverflow.com/comment/36522621
score: 0
type: Comment
has text: @PrasadKharkar: Miskate while rearranging the answer.. ;) fixed it. Thanks for notifing..
type: AnswerComment
comment on: http://stackoverflow.com/a/23754559

http://stackoverflow.com/q/23764324
downvote count: 1
has answer: http://stackoverflow.com/a/23764389
has title: Unfortunately, (App Name) has stopped. eclipse to show maps
favorite count: 0
has answer: http://stackoverflow.com/a/23764515
tagged with: android
answer count: 4
type: AnsweredQuestion
has body: from showing every time I run my Test Application in my AVD. I'm trying to show a maps and Eclipse shows no mistakes. So how can I fix this and how can I find out what the problem is if Eclipse shows no problems? (Here's a copy of my MainActivity) package com.example.test; import android.app.Activity; import android.support.v4.app.FragmentActivity; import android.os.Bundle; public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle arg0) { // TODO Auto-generated method stub super.onCreate(arg0); setContentView(R.layout.activity_main); } } (Here's a copy of my Activity_main.xml) <fragment android:id="@+id/fragment1" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" /> (Here's a copy of my TestManifest) <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.djandroid.mapsv2.permission.MAPS_RECEIVE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.example.test..API_KEY" android:value="AIzaSyBQ1sjxD09jxrSff68ZP77JpLQxm9LB8Hs" /> <uses-library android:name="com.google.android.maps" android:required="true" /> please help me
has comment: http://stackoverflow.com/comment/36541012
tagged with: java
has answer: http://stackoverflow.com/a/23764456
possible better answer: http://stackoverflow.com/a/23764450
accepted answer: http://stackoverflow.com/a/23764456
type: Question
linked to: http://stackoverflow.com/q/23353173
has answer: http://stackoverflow.com/a/23764450
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36540923
score: 0
has comment: http://stackoverflow.com/comment/36540963
has comment: http://stackoverflow.com/comment/36540924
upvote count: 1

vcf-vcard
tags question: http://stackoverflow.com/q/23750840
type: Tag
tag name: vcf-vcard

http://stackoverflow.com/q/23628526
accepted answer: http://stackoverflow.com/a/23632999
tagged with: resteasy
has comment: http://stackoverflow.com/comment/36280564
has answer: http://stackoverflow.com/a/23632999
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has body: I have two business objects having many too many relationships. I am using a REST service to call the DAO method given below and get a list of political indicators for a political event. However though the piList in DAO successfully gives me the list of Political Indicators but it still gives me an exception Failed to lazily intialize a collection of role... through reference chain: org.hibernate.collection.internal.PersistentBag[0]-----&gt;PolIndicator.piList.role org.jboss.resteasy.spi.writerException org.codehaus.jackson.map.JsonmappingException" I have used @JsonIgnore in the Political Indicator class against the political event property but still the lazy exception happens. Where am I going wrong? PolEvent { @Id @Column(name="SEQ_EVENT_ID") private BigDecimal id; @Column(name="EVENT_NAME") private String eventName; @ManyToMany @JoinTable( name="POL_LINK_INDCTR" joinColumns={@JoinColumn(name="SEQ_EVENT_ID")}, inverseJoinColumns=@JoinColumn(name="SEQ_PI_ID") ) private List &lt;PolIndicator&gt; piList; } PolIndicator { @Id @Column(name="SEQ_PI_ID") private BigDecimal id; @Column(name="POL_IND_NAME") private String piName; @ManyToMany(mappedBy="piList") @JsonIgnore private List &lt;PolEvent&gt; eventList; } DAO Layer Code public List &lt;PolIndicator&gt; getPiList (String eventId) { Criteria criteria = session.createCriteria(PolEvent.class); criteria.add(Restrictions.eq("id",id); PolEvent polEvent = new PolEvent(); polEvent=criteria.uniqueResult(); piList = polEvent.getPiList(); return piList(); }
type: Question
tagged with: lazy-initialization
tagged with: jackson
has comment: http://stackoverflow.com/comment/36924605
has comment: http://stackoverflow.com/comment/36280688
upvote count: 1
answer count: 1
has title: failed to lazily initialize a collection of role in ManyToMany relationship despite using JsonIgnore
favorite count: 0

http://stackoverflow.com/a/23724789
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23724703
has body: You have to consider that the . is not part of the allowed characters inside the phrase: ([A-Z^]{1})([^.]*)(\\.) The matching is greedy and will select as many characters as possible that will match your expression.
has comment: http://stackoverflow.com/comment/36465895

http://stackoverflow.com/comment/36456806
score: 1
comment on: http://stackoverflow.com/q/23720138
type: Comment
has text: You can't de-obfuscate code. Luckily. So we are protected against **thieves**.
type: QuestionComment

http://stackoverflow.com/comment/36465651
type: QuestionComment
comment on: http://stackoverflow.com/q/23724661
score: 0
has text: What do you think `^` means here?
type: Comment

http://stackoverflow.com/a/23703342
type: Answer
upvote count: 3
has body: Those classes that you don't have to import are those classes in the java.lang package. The JLS, Chapter 7, states: A compilation unit automatically has access to all types declared in its package and also automatically imports all of the public types declared in the predefined package java.lang. String, Integer, Character, Exception, and Boolean are all in the java.lang package. However, ArrayList and HashMap are in the java.util package and, as you already know, need to be imported (or they could be fully qualified) if used.
answers question: http://stackoverflow.com/q/23703328
score: 3
downvote count: 0

http://stackoverflow.com/comment/36334700
comment on: http://stackoverflow.com/q/23655959
has text: What's the problem with type casting ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36428171
comment on: http://stackoverflow.com/q/23704010
type: Comment
type: QuestionComment
has text: It might be considered bad practice to have a self executing constructor (some times, it's the only way to go), such as having the frame making itself visible from the constructor. It's also, generally, discouraged to extend from `JFrame` as you're not actually adding any new functionality to the class
score: 0

http://stackoverflow.com/comment/36451274
has text: @snukrabill Mind sharing what kind of research? I was just going off of what seemed logical, and some hard sources might help
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23717011
type: AnswerComment

http://stackoverflow.com/comment/36459253
has text: Thanks for reply but i can't use web application. I am in android application and i want use bean component (beans tag in xml file) from spring for declare all of my classes and take these classes and methods with reflection in android. Do you understand what i mean? Thanks again :)
comment on: http://stackoverflow.com/a/23721431
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36447874
type: QuestionComment
type: Comment
has text: It is much better to use a `Scanner` than get your input through command-line arguments.
comment on: http://stackoverflow.com/q/23715593
score: 0

http://stackoverflow.com/comment/36505484
score: 3
has text: You're going to hit Java's [recursive limit](http://stackoverflow.com/a/861385/2970947) very quickly with your current approach. Why do you need a recursive solution?
comment on: http://stackoverflow.com/q/23745658
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36414565
comment on: http://stackoverflow.com/q/23697869
score: 0
type: Comment
type: QuestionComment
has text: @BheshGurung in fact--it's in the message box, as well.

http://stackoverflow.com/a/23650888
has body: So I changed the interface in the way Vince Emigh suggested it. I don't know if this is best practice. Maybe a better solution would be to create a factory that creates objects instead of an interface. So if you have any further advice please let me know. :) The IObjectizable Inteface: public interface IObjectizable { Object toObject(InputStream inputStream); } The implemented MessageBodyReader interface: @Provider @Consumes(MediaType.APPLICATION_XML) public class LinkDataDemarshaller implements MessageBodyReader&lt;Object&gt; { @Override public boolean isReadable(Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { if(IObjectizable.class.isAssignableFrom(type)) { return true; } else { return false; } } @Override public Object readFrom(Class&lt;Object&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap&lt;String, String&gt; httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { try { Object obj = type.newInstance(); IObjectizable interfaceObj = ((IObjectizable) obj); return interfaceObj.toObject(entityStream); } catch (InstantiationException e) { e.printStackTrace(); return null; } catch (IllegalAccessException e) { e.printStackTrace(); return null; } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23636565

http://stackoverflow.com/comment/36291940
score: 0
comment on: http://stackoverflow.com/q/23634193
type: Comment
type: QuestionComment
has text: In the game, it doesn't matter the suit right? The suit is only determined by the image. So you should set the action command the same for two button. Like for button 0 and 8, set the action command to `"1"`. Unless you need to reference that the card is a diamond or a club, then just go with my suggestion above (comparing the last character)

http://stackoverflow.com/comment/36399572
type: QuestionComment
comment on: http://stackoverflow.com/q/23689670
has text: The thing is that it might be difficult to differentiate between "1", "12", and "123". Or "4" and "49". Or "9" and "95". You get my point.
score: 4
type: Comment

http://stackoverflow.com/q/23658006
has answer: http://stackoverflow.com/a/23671046
type: AnsweredQuestion
tagged with: java
has body: These three fields are part of multivalue field, but I need to make the field Business Groups a multivalue field as well, which should save its values as a list. See my configuration But the problem is that I can't save the values and I get exception Is that possible to create nested multifield? Thanks in advance
type: Question
accepted answer: http://stackoverflow.com/a/23671046
score: 0
tagged with: magnolia
has title: Nested multivalue field
answer count: 1
tagged with: nested
tagged with: multivalue

http://stackoverflow.com/q/23736059
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/36487200
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36488760
type: Question
answer count: 1
has title: Value of Thread.currentThread().getName() is a constant value or not?
has body: I have a question related to java thread. I have a facade class, where I am initialising memory analyser which in turn creates a task_map. Map's key is Thread.currentThread().getName() { test.startMemoryAnalyser(request, Thread.currentThread().getName()); } Once my task is in progress, I am updating the status of the task in the task_map. I am trying to fetch the status of map element correspond to Thread.currentThread().getName() key, but I am getting NullPointerException. Code to insert data in map: processMemoryMap.put(Thread.currentThread().getName(), requestStatus); Code to get entry to update status: Status s = processMemoryMap.get(Thread.currentThread().getName()); s.update(); //Throwing null pointer exception Both are called from same handler class. As both method is called from same class, I expect to get the status which I have placed in above scenario, but I am getting null. Please suggest me your thought. Thanks for your time and help in advance :-)
has comment: http://stackoverflow.com/comment/36490269
has comment: http://stackoverflow.com/comment/36487407
has comment: http://stackoverflow.com/comment/36487477
has answer: http://stackoverflow.com/a/50062496
favorite count: 0
has comment: http://stackoverflow.com/comment/36487202
type: UnansweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/36487262

http://stackoverflow.com/q/23755630
has answer: http://stackoverflow.com/a/23755915
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36526145
has answer: http://stackoverflow.com/a/23755790
tagged with: awt
tagged with: timer
has body: I try start-stop timer via same Jbutton. Let me share my code; Button Action; private void ButtonActionPerformed(java.awt.event.ActionEvent evt) { if(Button.getText().equals("START")){ Button.setText("STOP"); Spinner.setEnabled(false); Informer.setBackground(Color.green); Informer.setText("Running"); Timer time = new Timer(); ScheduledTask st = new ScheduledTask(); time.schedule(st, 0, (int) Spinner.getValue()*1000*60); } else{ Button.setText("START"); Spinner.setEnabled(true); Informer.setBackground(Color.red); Informer.setText("Stopped"); } } When user press the button; Button name changed STOP from START, Named informer textfield paint to green and write in Running, And below timer started, public class ScheduledTask extends TimerTask { public void run() { if (Button.getText().equals("STOP")){ Worker1 worker1 = new Worker1(); worker1.execute(); } else{ ScheduledTask.this.cancel(); } } } As you can see timer execute a SwingWorker named worker1. If i press button again (named STOP) jbutton renamed to START and timer dont see STOP in button text than stop itself. Imagine setup the timer 1 min and press the START button. When START button pressed worker1 executed immediatelly and timer start countdown you know. In 20-30 sec press the STOP button and wait 5-10 sec. Press the START button again. Problem is here 2 timer already running now. When first timer countdown complete worker1 executed. 5-10 seconds later timer fininsh old countdown and start worker1 again. How can i stop current timer countdown when same button pressed if any countdown already active?
has title: Start-Stop timer via same Button
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36526110

http://stackoverflow.com/comment/36264855
score: 0
type: AnswerComment
type: Comment
has text: This is what an exception is supposed to do. Probably you would like something like: ```int number = keyboard.nextInt(); while(number < 1) { System.out.println("1 ticket minimum! Retype!"); number = keyboard.nextInt(); }```
comment on: http://stackoverflow.com/a/23620164

http://stackoverflow.com/comment/36293806
type: AnswerComment
has text: Thanks. In the answer for "Where to get declarations from", there is a link to an example: http://z3.codeplex.com/SourceControl/latest#examples/tptp/tptp5.cpp, but the link is dead. Could you please check it for me?
comment on: http://stackoverflow.com/a/23632565
type: Comment
score: 0

http://stackoverflow.com/a/23730364
type: Answer
has body: Its a three method implementation : public BigInteger mod(BigInteger m) { if (m.signum &lt;= 0) throw new ArithmeticException("BigInteger: modulus not positive"); BigInteger result = this.remainder(m); // call remainder() return (result.signum &gt;= 0 ? result : result.add(m)); } public BigInteger remainder(BigInteger val) { MutableBigInteger q = new MutableBigInteger(), a = new MutableBigInteger(this.mag), b = new MutableBigInteger(val.mag); return a.divide(b, q).toBigInteger(this.signum); // call toBigInteger() } BigInteger toBigInteger(int sign) { if (intLen == 0 || sign == 0) return BigInteger.ZERO; // here is your answer. return new BigInteger(getMagnitudeArray(), sign); }
score: 0
answers question: http://stackoverflow.com/q/23730246

http://stackoverflow.com/comment/36347246
type: AnswerComment
has text: Thanks, Grove. It helped me. Now I'm trying to generate report using ReportNG, but I will create a new question for it. :)
type: Comment
comment on: http://stackoverflow.com/a/23626331
score: 0

http://stackoverflow.com/comment/139950835
score: 1
comment on: http://stackoverflow.com/a/23778200
has text: it is 2025 and I'm still waiting for @SomeArgsConstructor
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36332878
type: Comment
comment on: http://stackoverflow.com/q/23654798
has text: Check how you named your test classes ? Show your pom file.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23727530
has comment: http://stackoverflow.com/comment/36472281
downvote count: 0
has comment: http://stackoverflow.com/comment/36471807
has comment: http://stackoverflow.com/comment/36472350
answers question: http://stackoverflow.com/q/23727379
upvote count: 2
has body: There are two ways to accomplish this. You can either have your class be the ActionListener (which is the way you have it set up now), or you can have a unique ActionListener for each button. As a design decision I prefer the latter, as you can have more precise control and easier to read code this way. Each of your buttons, menu items, and any other Object you want to have a unique effect should each have it's own ActionListener. You can either write a new class file for each ActionListener, an inner class, or an anonymous inner class for each. I prefer anonymous inner classes placed in line of your constructor or setup method like this: JButton testButton = new JButton("Test"); testButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { // do stuff here System.out.println("You clicked me!"); } }); This method allows you to ignore huge conditional branches and unnecessary comparisons. Implement the interface uniquely for each component that needs the listener.
has comment: http://stackoverflow.com/comment/36472429
type: Answer
score: 2

http://stackoverflow.com/a/23703905
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23703822
type: Answer
answers question: http://stackoverflow.com/q/23703822
upvote count: 3
score: 3
has body: You will have to read that perl file as resource and write it somewhere on file system as File (like this) and then pass that path to your command See Also Extract and load DLL from JAR

http://stackoverflow.com/comment/36407030
type: Comment
has text: is there any exceptions available in your logging? Can you post the service layer code that is performing the saving of your objects
type: QuestionComment
comment on: http://stackoverflow.com/q/23666732
score: 0

http://stackoverflow.com/q/23700333
possible better answer: http://stackoverflow.com/a/23700954
has answer: http://stackoverflow.com/a/23701387
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23701387
has body: I'm having a hard time removing data from my JTable. I've tried JTable .repaint(), setRowCount(0) , also model.removeRow(). I created print statements to see the row count when using setRowCount and the rows do become 0 however my table does not update. This is the last part of this project I need to implement. I'm not sure why my table isn't updating because I am altering the model with removeRow as well as setRowCount. If you guys could guide me in the right direction I would appreciate it. public class TemplateGui extends JFrame { private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField textField; private static String [] sortedRoles_Flags,finalFlagsArr,finalHSArr; private static String finalFlags="",finalHS="",columnToConvert="Result"; private Vector&lt;String&gt; SF,HS,column; private JTable hotelSecurityTable,securityFlagsTable; private DefaultTableModel hsTableModel,sfTableModel; public TemplateGui(){ super("Galaxy Template Generator V1.0"); //column name column = new Vector(Arrays.asList(columnToConvert)); getContentPane().setForeground(new Color(0, 0, 0)); getContentPane().setLayout(null); getContentPane().setBackground(new Color(51, 51, 51)); //radio buttons JRadioButton rdbtnNewRadioButton = new JRadioButton("Central User "); rdbtnNewRadioButton.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnNewRadioButton.setBackground(Color.WHITE); buttonGroup.add(rdbtnNewRadioButton); rdbtnNewRadioButton.setBounds(222, 75, 127, 36); getContentPane().add(rdbtnNewRadioButton); final JRadioButton rdbtnPropertyUser = new JRadioButton("Property User"); rdbtnPropertyUser.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnPropertyUser.setBackground(Color.WHITE); buttonGroup.add(rdbtnPropertyUser); rdbtnPropertyUser.setBounds(222, 38, 127, 34); getContentPane().add(rdbtnPropertyUser); textField = new JTextField(); textField.setFont(new Font("Tahoma", Font.BOLD, 18)); textField.setBounds(10, 35, 53, 34); getContentPane().add(textField); textField.setColumns…
has title: delete previous content from JTable every time button event happens
has answer: http://stackoverflow.com/a/23700954
tagged with: jtable

http://stackoverflow.com/comment/36349606
type: Comment
comment on: http://stackoverflow.com/q/23652663
score: 0
type: QuestionComment
has text: That looks like two questions now and I'd split up otherwise the answers are going to be confusing

http://stackoverflow.com/q/23719849
score: -1
downvote count: 1
upvote count: 0
tagged with: multithreading
has body: i need two counters to work like a chess clock. When the first one starts the second stops. When the second starts the fisrt one stop. In parallel with these two counters i need another clock which never stops. I am trying to do it. I created two counters and it works fine but when i create a new thread(3 Threads in total), which will run the clock, it causes some problem(increment both counters at the same time). Does these problem have something related with synchronization problem? Why does it run correctedly for 2 Threads but not for three? //////////////////////////////// HOW THE OBJECTS ARE CREATED ///////////////////////// private Relogio relogioBranco, relogioPreto; private RelogioGeral relogioGeral; relogioBranco = new Relogio(relogioBrancoLabel); relogioPreto = new Relogio(relogioPretoLabel); relogioGeral= new RelogioGeral(relogioPretoLabel,menu); new Thread(relogioBranco).start(); new Thread(relogioPreto).start(); new Thread(relogioGeral).start(); relogioBranco.rodarRelogio(false); relogioPreto.rodarRelogio(false); relogioGeral.rodarRelogio(true); ////////////////////////////////////// COUNTERS ////////////////////////////// // The clock will be used to autosave my game every 1 minute package Janela; import java.io.Serializable; import java.util.concurrent.atomic.AtomicInteger; import javax.swing.JLabel; public class Relogio implements Runnable, Serializable { private volatile AtomicInteger segundo, minuto, hora; private JLabel relogioLabel; private boolean relogioRodando; public Relogio(JLabel relogio) { segundo = new AtomicInteger(); minuto = new AtomicInteger(); hora = new AtomicInteger(); minuto.set(0); hora.set(0); segundo.set(0); minuto.set(0); this.relogioLabel = relogio; } public void rodarRelogio(boolean rodar) { relogioRodando = rodar; } @Override public void run() { try { while (true) { Thread.sleep(1000); if (relogioRodando) { segundo.incrementAndGet(); if (segundo.intValue() == 60) { segundo.set(0); minuto.incrementAndGet(); if (minuto.intVal…
has answer: http://stackoverflow.com/a/23720345
accepted answer: http://stackoverflow.com/a/23720345
type: AnsweredQuestion
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36458253
answer count: 1
tagged with: counter
has title: Are there any synchronization issue when it's used two counters and one clock, all of them working in a different Thread?
tagged with: clock

http://stackoverflow.com/q/23691203
tagged with: java
has title: Appending Objects to an existing file
possible better answer: http://stackoverflow.com/a/23691656
has answer: http://stackoverflow.com/a/23691656
has comment: http://stackoverflow.com/comment/36402884
linked to: http://stackoverflow.com/q/2094637
has answer: http://stackoverflow.com/a/23691515
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23691515
tagged with: serialization
type: Question
answer count: 2
upvote count: 1
has body: I'm trying to create a system where users can save a series of Message objects to a .txt file, which can then be de-serialized and read by the recipient of the Message. However each time I try and write to the file I simply overwrite the object that was there previously. My current code is as follows: public class Comms{ Message msg; public void sendMessage(Message myMessage){ msg = myMessage; //Generate Message ID String msgID = "MSG" + genMsgID(); myMessage.setMessageID(msgID); //******************************************************** try { FileOutputStream logFile = new FileOutputStream("logFile.txt"); NoHeaderObjectOutputStream out = new NoHeaderObjectOutputStream(logFile); out.writeObject(myMessage); out.close(); logFile.close(); }catch(IOException i) { } } } class NoHeaderObjectOutputStream extends ObjectOutputStream { public NoHeaderObjectOutputStream(OutputStream os) throws IOException { super(os); } protected void writeStreamHeader() {} } I appreciate that there are similar questions out there but with my limited knowledge I'm struggling to make sense of the answers provided. If anyone has a solution to this or some pointers that'd be greatly appreciated.
has comment: http://stackoverflow.com/comment/36403208

http://stackoverflow.com/comment/36263011
has text: Can you be more specific than "it doesn't work"?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23618657
score: 0

http://stackoverflow.com/comment/36433230
type: QuestionComment
comment on: http://stackoverflow.com/q/23707833
has text: An `InputStream` is supposed to return `-1` when no more data is available, I thought...
score: 0
type: Comment

http://stackoverflow.com/q/23673105
has comment: http://stackoverflow.com/comment/36367621
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36368086
upvote count: 1
score: 1
tagged with: java
has body: I have a custom DialogFragment. I want to show this dialog while switching my activities. Scenario:- 1) In actvity1 I start the dialog. 2) Start a asynctask class. 3) Do some authentication in doInBackground(). 4) Start new actvity from onPostExecute(). Issue:- The dialog stops before the asynctask. Here is my code:- myWebView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { // TODO Auto-generated method stub super.onPageStarted(view, url, favicon); redirected =view.getUrl(); redirected= Uri.decode(redirected); if(redirected!=null &amp;&amp; redirected.contains(string1)) { myprogressDialog.show(getFragmentManager(), "Wait"); } } @Override public void onPageFinished(WebView view, String url) { // TODO Auto-generated method stub super.onPageFinished(view, url); if(redirected!=null &amp;&amp; redirected.contains(mystring) ) { myWebView.stopLoading(); String authorizationContentString = myurl new Authentication(Activity2.this, myprogressDialog, url).execute(authorizationString); } private static class ProgressDialogFragment extends DialogFragment { public static ProgressDialogFragment newInstance() { return new ProgressDialogFragment(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(STYLE_NO_FRAME, android.R.style.Theme_Translucent); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_dialog_progress, container, false); } } Authentication.java @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); /* progDia.show(man, "wait"); progDia= new Utility.ProgressDialogFragment().newInstance();*/ } public AuthenticateDevice(Details1 myContext, ProgressDialogFragment myprogressDialog, String Url) { // TODO Auto-generated constructor stub mContext = myContext; this.progDia = myprogressDialog; this.Url = Url; …
type: Question
has answer: http://stackoverflow.com/a/23674697
has comment: http://stackoverflow.com/comment/36368445
has comment: http://stackoverflow.com/comment/36367737
has answer: http://stackoverflow.com/a/23673341
tagged with: progressdialog
answer count: 2
has comment: http://stackoverflow.com/comment/36367499
has title: Creating Progress dialog while switching from one activity to another
downvote count: 0
favorite count: 0
tagged with: android-asynctask

http://stackoverflow.com/comment/36513186
type: QuestionComment
has text: Are you certain `newLevel` is actually a value that satisfies the `if`?
comment on: http://stackoverflow.com/q/23749572
score: 0
type: Comment

http://stackoverflow.com/q/23683876
has answer: http://stackoverflow.com/a/23687926
favorite count: 0
type: UnansweredQuestion
has body: I would like to use initialization with aspectj. @Aspect public class TotoAspect { @Before("initialization( *.new(..))") public void test(JoinPoint thisJoinPoint) throws AuditReactiveException { System.err.println("I AM HERE"); } } But, the message was not print with new ABC(); I use the java agent for aspectj. Where is the mistake ?
upvote count: 1
has title: Aspectj and initialization
score: 1
tagged with: java
tagged with: aop
type: Question
tagged with: aspectj
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37212746

http://stackoverflow.com/a/23768401
score: 1
upvote count: 1
has body: As stated in the fileUpload interceptor docs: It adds the following parameters, where [File Name] is the name given to the file uploaded by the HTML form. [fileName, contentType] When mucking with interceptor stacks there are always two plans of attack: Try a non-custom stack Don't mess with the stack unless you know precisely why you're doing it, and what you're doing. Also, actions that are configured to use almost no interceptors, as yours is, are almost always suspect, because they eliminate the bulk of framework functionality. Params in particular is key to essentially every form-based action.
accepted answer of: http://stackoverflow.com/q/23767586
answers question: http://stackoverflow.com/q/23767586
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23670548
has answer: http://stackoverflow.com/a/23679053
accepted answer: http://stackoverflow.com/a/23679053
tagged with: dom
has body: Here I have mentioned in below the way that we are normally working on the Dom nodes. I want to find a way to get particular node calling by name without iterating over the entire list as I commented on the code. NodeList nodeList = _myDoc.getElementsByTagName("Parent"); // I want to get child2 node here calling by name without iterating over entire list for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getLocalName() != null) { if (node.getLocalName().equals("child1")) { // get node as child1 }else if (node.getLocalName().equals("child2")) { // get node as child2 }etc... } } Note : I know that this can be done with XPath. But I'm looking for a way in DOM Here NodeList means org.w3c.dom.NodeList and Node means org.w3c.dom.Node. (Answer in Get Node by Name from Nodelist provides the XPath solution)
score: 0
has comment: http://stackoverflow.com/comment/36362501
answer count: 1
linked to: http://stackoverflow.com/q/12891992
has title: How to get a particular DOM node calling by name on the NodeList (Not in XPath) in java
linked to: http://stackoverflow.com/q/12966127
has comment: http://stackoverflow.com/comment/36362464
linked to: http://stackoverflow.com/q/20088599
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/36362787
tagged with: java

http://stackoverflow.com/a/23715994
has body: Are you using tomcat in eclipse. then refresh the project,maven build it and maven update the project and let me know if you are still facing this issue.
score: 0
has comment: http://stackoverflow.com/comment/36504027
answers question: http://stackoverflow.com/q/23713732
type: Answer

http://stackoverflow.com/comment/36568196
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException:](http://stackoverflow.com/questions/21992071/org-apache-poi-poixmlexception-org-apache-poi-openxml4j-exceptions-invalidforma)
comment on: http://stackoverflow.com/q/23773107

http://stackoverflow.com/a/23692157
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23692117
has body: Probably you're looking at the String representation the Timestamp object gives in your database engine or its Java representation by printing it in the console using System.out.println or by another method. Note that which is really stored (in both Java side or in your database engine) is a number that represents the time since epoch (usually January 1st 1970) and the date you want/need to store. You should not pay attention to the String format it is represented when you consume your Timestamp. This can be easily demostrated if you apply the same SimpleDateFormat to get a String representation of your timestamp object: DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String currentTime = df.format(new Date()); Timestamp timestamp = Timestamp.valueOf(currentTime) //will print without showing the .x part String currentTimeFromTimestamp = df.format(currentTime); Anyway, if you want the current time, just create the Timestamp directly from the result of new Date: Timestamp timestamp = new Timestamp(new Date().getTime());
upvote count: 2

http://stackoverflow.com/q/23724260
tagged with: jsp
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/23724380
has body: I have an JSP file, which is called from a button of a form in a HTML file. In this JSP I get the option selected in a drop-downlist of the form, which is saved into the variable "topic". In this JSP file I have another button that have to call the Javascript function crearframe(). The parameter have to be the value saved in the variable "topic". How can I do that? I need to open a different html file when the user press the button depending of the value of the variable "topic". The name of the html file will be "topicValue" + ".html". Is there any way of doing this? Thank you very much. Here is the code. <% String topic = request.getParameter("opcion"); out.println(" Resultado del análisis sobre " + topic + " "); %> Ver;
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/3177733
type: UnansweredQuestion
tagged with: parameters
tagged with: java
has title: How to include a variable JSP into a HTML label?
type: Question
answer count: 1

http://stackoverflow.com/a/23754961
upvote count: 1
has body: I guess that you have to use a custom Deserializer. This seems to work: public class RankingValueDeserializer extends JsonDeserializer&lt;RankingValue&gt; { @Override public RankingValue deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode node = jp.getCodec().readTree(jp); Integer key = node.get("key").asInt(); Integer detail = node.get("aggregations").get("asMap").get("detail").get("value").asInt(); Integer listed = node.get("aggregations").get("asMap").get("listed").get("value").asInt(); return new RankingValue(key, detail, listed); } } and your object will be something like @JsonDeserialize(using = RankingValueDeserializer.class) public class RankingValue { private Integer adId; private Integer listed; private Integer detail; public RankingValue(Integer key, Integer listed, Integer detail) { this.adId = key; this.listed = listed; this.detail = detail; } @Override public String toString() { return "RankingValue [adId=" + adId + ", listed=" + listed + ", detail=" + detail + "]"; } }
answers question: http://stackoverflow.com/q/23753533
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23753533

http://stackoverflow.com/a/23748073
downvote count: 0
answers question: http://stackoverflow.com/q/23747954
score: 3
has body: Oracle has a page listing changes between Java 6 and Java 7. Based on that page and the table of contents of your book, I wouldn't say there are any significant "data structures" changes. The ForkJoinPool qualify, but it would probably be considered more 'advanced' than the topics in the book. There's also a bug fix to TreeMap that detects errors you could previously get away with, but that's pretty minor anyway and correct code shouldn't change as a result.
upvote count: 3
type: Answer

http://stackoverflow.com/comment/36406379
score: 0
has text: @geoand I bet it fixed his problem. I don't know why he was trying to manually do what `@Transactional` does anyway....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23662039

http://stackoverflow.com/comment/37943007
type: AnswerComment
has text: UPDATE : Problem is not related to the position of a tag and hander. I used iframe and cordova.js is included in parent and iframe both. That was terrible mistake. I removed cordova.js from iframe and every things fine.
comment on: http://stackoverflow.com/a/24507811
score: 0
type: Comment

http://stackoverflow.com/q/23733020
answer count: 2
has comment: http://stackoverflow.com/comment/36481649
has title: How can i print json objects and array values?
has body: In the Result String i have entire data for that i'm parsing ,i need to print Current Conditions inside values. current_condition": [ {"cloudcover": "75", "humidity": "71", "observation_time": "06:55 AM", "precipMM": "0.6", "pressure": "1009", "temp_C": "32", "temp_F": "90", "visibility": "10", "weatherCode": "116", "weatherDesc": [ {"value": "Partly Cloudy" } ], "weatherIconUrl": [ {"value": "http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png" } ], "winddir16Point": "S", "winddirDegree": "170", "windspeedKmph": "9", "windspeedMiles": "6" } ] This is my json array ,here i need cloudcover ,weatherDescarrays inside values,how can i print those values. Here what i did is JSONParser parser = new JSONParser(); Object obj1 = parser.parse(Result); JSONObject jobj = (JSONObject) obj1; JSONObject dataResult = (JSONObject) jobj.get("data"); JSONArray current_condition = (JSONArray) dataResult.get("current_condition"); //out.println(current_condition); for (int i = 0; i &lt; current_condition.size(); i++) { } inside for loop how to repeat and print values ,could anybody help me,thanks in advance.
score: 0
has answer: http://stackoverflow.com/a/23733302
has comment: http://stackoverflow.com/comment/36482384
possible better answer: http://stackoverflow.com/a/23733326
has answer: http://stackoverflow.com/a/23733326
has comment: http://stackoverflow.com/comment/36481543
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23733302
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/36481489

http://stackoverflow.com/comment/36561676
score: 0
has text: First can you try to update [maven-release-plugin](maven.apache.org/maven-release/maven-release-plugin/) cause you are using an really old version. The current version is 2.5.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23761791

http://stackoverflow.com/comment/139263278
has text: It seems likely that the Java process is not running in UTC.
comment on: http://stackoverflow.com/q/23676743
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36543261
type: QuestionComment
comment on: http://stackoverflow.com/q/23765282
has text: i didnt get you, in my above snippet i used a URL object , it didnt work
score: 0
type: Comment

http://stackoverflow.com/q/23763344
has body: I am writing a snake game in java and the turns are controlled by keyboard. everything works fine, but when i by mistake press 2 keys then the whole application freezes (the gui) snake stops moving, but thread keeps running according to my eclipse, i thought it might be the default case that causes problems, but the statement does not get printed. private class KeyboardListener extends KeyAdapter { public void keyPressed(KeyEvent e) { Directions direc = c.getDirectionSnake(); switch (e.getKeyCode()) { case KeyEvent.VK_RIGHT: case KeyEvent.VK_NUMPAD6: // if it's not the opposite direction if (c.getDirectionSnake() != Directions.LEFT) c.setDirectionSnake(Directions.RIGHT); break; case KeyEvent.VK_UP: case KeyEvent.VK_NUMPAD8: if (c.getDirectionSnake() != Directions.BOTTOM) c.setDirectionSnake(Directions.TOP); break; case KeyEvent.VK_LEFT: case KeyEvent.VK_NUMPAD4: if (c.getDirectionSnake() != Directions.RIGHT) c.setDirectionSnake(Directions.LEFT); break; case KeyEvent.VK_DOWN: case KeyEvent.VK_NUMPAD2: if (c.getDirectionSnake() != Directions.TOP) c.setDirectionSnake(Directions.BOTTOM); break; default: System.out.println("here"); break; } } } jframe public Window() throws FileNotFoundException { this.setTitle("Snake"); this.setSize(400, 450); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); gamePanel = new GamePanel(); topPanel = new TopPanel(); this.add(new TopPanel(), BorderLayout.NORTH); this.add(gamePanel, BorderLayout.CENTER); c = new ThreadsController(gamePanel.getSnakeDepartPosition()); c.start(); this.buttonPanel = new ButtonPanel(this, c); this.add(buttonPanel, BorderLayout.SOUTH); this.setVisible(true); this.addKeyListener(new KeyboardListener()); }
has comment: http://stackoverflow.com/comment/36555235
has title: thread stops when 2 KeyEvents are pressed
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36539685
has comment: http://stackoverflow.com/comment/36539484
has comment: http://stackoverflow.com/comment/36542934
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36541117
answer count: 0
tagged with: java
score: 0
tagged with: multithreading
linked to: http://stackoverflow.com/q/22741215
type: Question
has comment: http://stackoverflow.com/comment/36539314

http://stackoverflow.com/comment/36379589
type: Comment
type: QuestionComment
has text: Yes I have. Its working fine in eclipse, and on the server... I coud build and run it inside the eclipse... It's only fail with gradle, thats why I asking the question mainly. Google dont helped me. And if I want to extend the build script with jococo it woud be nice if it is working in local first :)
comment on: http://stackoverflow.com/q/23678908
score: 0

http://stackoverflow.com/q/23711363
favorite count: 0
type: UnansweredQuestion
has title: Problems with Spring Java Config and @EnableTransactionManagement
has body: I am migrating away from XML config for Spring context configuration. Instead when I try to use the functionally equivalent @EnableTransactionManagement on a Spring 4.0.3.RELEASE Java Configuration, my Spring context fails to instantiate with the following exception: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.ju…
tagged with: spring
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23711495
type: Question
tagged with: java
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23618409
upvote count: 0
has answer: http://stackoverflow.com/a/23618482
has answer: http://stackoverflow.com/a/23618469
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36261354
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23618531
downvote count: 2
has comment: http://stackoverflow.com/comment/36261172
answer count: 4
has comment: http://stackoverflow.com/comment/36261287
tagged with: java
has body: I am having trouble detecting if a string is at the end of a line. For example, in the string: "hey hi hello" How do you detect if the hi is at the end of the line? I am reading in strings from a file, so is the end of line character any different in files?
tagged with: file
has comment: http://stackoverflow.com/comment/36261323
type: Question
score: -2
has answer: http://stackoverflow.com/a/23618538
has title: how do you check if a string is at the end of a line?
has comment: http://stackoverflow.com/comment/36261076

http://stackoverflow.com/a/23629955
type: Answer
has body: From what ever that was understood from the question: Well compile the parent project first, build a jar out of it, and then compile the second project, with the first jar in CLASSPATH. Thats how its achieved.
score: 0
answers question: http://stackoverflow.com/q/23629791
has comment: http://stackoverflow.com/comment/36287040

http://stackoverflow.com/a/23708509
answers question: http://stackoverflow.com/q/23707833
upvote count: 1
has body: It doesn't make sense to read the input until EOS and then expect to be able to write a response back to the same connection. You haven't actually written anything like an 'simple HTTP server yet. You need to study the HTTP RFC, in particular the part about content-length of requests. They are delimited by length, not by end of stream.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/23704590
tagged with: java
has answer: http://stackoverflow.com/a/23707645
score: 0
has body: I'm trying to extend my Sonatype Nexus OSS instance with nexus-npm-repository-plugin. I've tried either to compile from sources and install release from https://github.com/georgy/nexus-npm-repository-plugin/releases but no luck at all: Despite it is built in Jenkins successfully, when i try to deploy bundle, my nexus instance tells me the following: Name Nexus npm repository plugin Version 0.0.1 Status Broken Description Adds npm (https://www.npmjs.org/) capabilities to Nexus OSS SCM Version b272d72cba8b6eadc8bade76eb71495ab60ba3af SCM Timestamp N/A Site http://nexus.bolyuba.com This plugin was not able to be activated ... com.bolyuba.nexus.plugin:nexus-npm-repository-plugin:0.0.1 :: action=ACTIVATE result=BROKEN Reason: Problem installing: reference:file:/home/tomcat-nexus/sonatype-work/nexus/plugin-repository/nexus-npm-repository-plugin-0.0.1/ I dug into debug output and found out that despite bundle is provided with following structure: nexus-npm-repository-plugin-0.0.1 \_nexus-npm-repository-plugin-0.0.1.jar |_dependencies \_gson-2.2.4.jar nexus instance tries to find a file META-INF/MANIFEST.MF directly in sonatype-work/nexus/plugin-repository/nexus-npm-repository-plugin-0.0.1/ instead of sonatype-work/nexus/plugin-repository/nexus-npm-repository-plugin-0.0.1/nexus-npm-repository-plugin-0.0.1.jar. I tried to extract contents of nexus-npm-repository-plugin-0.0.1.jar to sonatype-work/nexus/plugin-repository/nexus-npm-repository-plugin-0.0.1/ but had no luck. Could you please tell me what exactly am I doing wrong and how to workaround this issue.
answer count: 1
accepted answer: http://stackoverflow.com/a/23707645
has title: Sonatype Nexus OSS fails to load nexus-npm-repository-plugin
tagged with: node.js
type: AnsweredQuestion
tagged with: npm
tagged with: nexus
type: Question

http://stackoverflow.com/q/23713897
has comment: http://stackoverflow.com/comment/36444528
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23714021
accepted answer: http://stackoverflow.com/a/23713988
downvote count: 0
possible better answer: http://stackoverflow.com/a/23714021
favorite count: 0
has body: Hi all I am creating a simple text editor as a project and I have hit a snag when it comes to saving the content typed as a file. I can save the file using the Save As principle with a dialog box prompting the user to enter a filename. The problem I am having is implementing the Save so that it saves to the file that is opened without having to go to the dialog box each time, like it would if someone did Ctrl+S. Anyone have any ideas how I would implement this feature? Here's some of my code: JMenuItem saveFile = new JMenuItem(new AbstractAction("Save") { @Override public void actionPerformed(ActionEvent e) { JFileChooser save = new JFileChooser(); File filename = save.getSelectedFile(); if(opened == false &amp;&amp; saved == false) { save.showSaveDialog(null); int confirmationResult; if(filename.exists()) { confirmationResult = JOptionPane.showConfirmDialog(getParent(), "Replace existing file?"); if(confirmationResult == JOptionPane.YES_OPTION) { saveFile(filename); } } else { saveFile(filename); } } else { saveFile(filename); } } }); saveFile.setPreferredSize(new Dimension(100, 20)); saveFile.setEnabled(true); save method: private void saveFile(File filename) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); writer.write(textArea.getText()); writer.close(); saved = true; editorWindow.setTitle("JavaText - " + filename.getName()); } catch (IOException err) { err.printStackTrace(); } }
answer count: 3
has answer: http://stackoverflow.com/a/23714743
has answer: http://stackoverflow.com/a/23713988
upvote count: 1
has title: How to save a text file without having to enter file name every time?

http://stackoverflow.com/a/23627165
downvote count: 0
has comment: http://stackoverflow.com/comment/36278493
answers question: http://stackoverflow.com/q/23627077
has body: You cannot remove (printers.remove(key);) items from a collection while you are iterating (for (Map.Entry&lt;String, ?&gt; entry : Utils.currentPrinters.entrySet())) over them. The best way to achieve your aim is to collect a list of all items you want to remove and remove them at the end. List&lt;String&gt; remove = new ArrayList&lt;String&gt;(); for (Map.Entry&lt;String, ?&gt; entry : Utils.currentPrinters.entrySet()) { String key = entry.getKey(); if (...) { remove.add(key); } } // Remove the ones I don't want. for(String r:remove) { printers.remove(r); } Once you've done that you still need to either use synchronized or a ConcurrentMap.
upvote count: 2
has comment: http://stackoverflow.com/comment/36278305
has comment: http://stackoverflow.com/comment/36278121
type: Answer
score: 2

http://stackoverflow.com/comment/36292261
type: Comment
has text: Also check that the methods that you reference in onclick in your layout always take a View as first and unique parameter, that they are public and return void: public void myMethod(View v). The simple fact that the error only occurs on some devices and that you have to manually check details like this without the compiler returning any error should be enough to convince you to use OnClickListener instead.
type: AnswerComment
comment on: http://stackoverflow.com/a/23633722
score: 0

libpd
tags question: http://stackoverflow.com/q/23616739
type: Tag
tag name: libpd

http://stackoverflow.com/q/23718739
has answer: http://stackoverflow.com/a/23718954
has answer: http://stackoverflow.com/a/23719178
linked to: http://stackoverflow.com/q/23710037
has title: Java - JSON Parser Error
type: AnsweredQuestion
has body: I am creating an application which it will send http request to a web server. The return will be in json. Here is how the json look like [//I used a tool to make it beautiful and easy to read. { "item_name": "Adame", "item_type": "Special", "item": "Chestplate", "item_min_lvl": "50", "enchantment": { "health": "0.3", "dam": "24%", "life": "0.1", "xp": "24%", "loot": "22%" }, "def": "73" }, { "item_name": "Sticks'", "item_type": "Unique", "item": "Stick", "item_min_lvl": "4", "enchantment": { "health": "0.6", "mana": "1", "dam": "12%", "life": "0.3", "xp": "17%", "loot": "17%" }, "min_dam": "39", "max_dam": "34" }, { "item_name": "Sword'", "item_type": "Unique", "item": "Sword", "item_min_lvl": "8", "enchantment": [], //colonm 30 is [ "min_dam": "9", "max_dam": "10" } ] Are you can see, the data inside the array are different. I got this error, Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 30. This is my code: MyJSON[] data = gson.from(jsonString, MyJSON[].class); class MyJSON { String item_name; String item_type; String item; String item_min_lvl; Enchantment enchantment; String min_dam; String max_dam; @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("\nitem_name:").append(item_name); builder.append("\nitem_type:").append(item_type); builder.append("\nitem:").append(item); builder.append("\nitem_min_lvl:").append(item_min_lvl); builder.append("\n\nEnchantment Details:"); builder.append("\nhealth:").append(enchantment.health); builder.append("\ndam:").append(enchantment.dam); builder.append("\nlife:").append(enchantment.life); builder.append("\nxp:").append(enchantment.xp); builder.append("\nloot:").append(enchantment.loot); return builder.toString(); } } class Enchantment { String health; String dam; String life; String xp; String loot; String mana; } Can anyone help me to improve my code so my code an parse the json in different case. Thanks in advanced. (P.s. that's not my web server so I can't do anythi…
score: 0
possible better answer: http://stackoverflow.com/a/23718764
accepted answer: http://stackoverflow.com/a/23719178
type: Question
has answer: http://stackoverflow.com/a/23718764
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/36454071
answer count: 3

http://stackoverflow.com/comment/36383338
has text: no problem, Thanks for your help mate I have updated the question with my new code, if you get time see what you think. Thanks again
type: AnswerComment
comment on: http://stackoverflow.com/a/23677438
score: 0
type: Comment

http://stackoverflow.com/comment/36442657
score: 0
type: AnswerComment
has text: Please note, that this approach is the learning one from the categories mentioned by @Luiggi Mendoza. Using a pattern or a library / framework that already implemented and integrated it is always the best choice in a production environment.
type: Comment
comment on: http://stackoverflow.com/a/23712552

http://stackoverflow.com/q/23738078
upvote count: 2
type: UnansweredQuestion
tagged with: bin-packing
score: 2
tagged with: 2d
tagged with: gurobi
tagged with: java
has answer: http://stackoverflow.com/a/23738553
type: Question
answer count: 2
downvote count: 0
has title: A Solver for 2D bin packing for Large number of Bins (java | Gurobi)
favorite count: 0
has body: I am looking for a Solver to solve a 2D bin packing problem. I saw several post, suggesting "Binary Tree Algorithm", but I have around 200,000 of bins, So I am not sure if the algorithm is Scalable or not. I was thinking about Gurobi. But I dont know how to model the problem in Gurobi. Is any one aware of any available model that I can use? Or Is there any java code available, that can give me an "close to exact" solution, considering the fact that it is NP hard? Thanks /Mina
has answer: http://stackoverflow.com/a/79443428

http://stackoverflow.com/comment/36534455
comment on: http://stackoverflow.com/a/23760821
type: AnswerComment
score: 0
type: Comment
has text: @BHeshGurung and final also.

http://stackoverflow.com/q/23714572
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24096739
tagged with: swing
has body: It is very common that we use JSliders in our java applications. But I want to replace JSliders by knobs. I need some guidance to study in this respect.
tagged with: jslider
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/12175174
has comment: http://stackoverflow.com/comment/36446036
type: Question
upvote count: 0
score: -1
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36445725
favorite count: 0
has title: Replacing JSlider by Knob in java applications

http://stackoverflow.com/comment/36293402
score: 0
type: AnswerComment
has text: Thanks for your answer. Given that this process will be re-used for a number of flows I think the first option will create an unnecessary number of dummy flows - so looks like the second option is the one to go with here. Would you be able to provide an example of how I'd load a test properties file? Or is it simply a case of replacing: `return "mappingtest.xml";` in my `MappingTest` class with `return "mappingtest.xml,test.properties";` and then populating `test.properties` with the temp folder paths?
type: Comment
comment on: http://stackoverflow.com/a/23635186

http://stackoverflow.com/q/23633971
tagged with: web-applications
type: Question
accepted answer: http://stackoverflow.com/a/23634428
has title: java web application screenshot of the current window
score: 0
answer count: 1
has body: For our web application we need a feature, where the web application generates image, out of the currently displayed application page. In detail, it is a java web application where Super user checks the data saved by normal user and convey his remarks to the normal user. For this purpose the super user opens the form where the data is entered by the normal user and click on the button on the same form which should take the screenshot of the displayed form(or should generate image out of the current window html) and save the image on the server. Is it possible to do it within the webapplication? If yes, please send me the link or example. Best Regards
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23634428
tagged with: screenshot
tagged with: java

http://stackoverflow.com/a/23625373
has comment: http://stackoverflow.com/comment/36274874
has comment: http://stackoverflow.com/comment/36274409
has comment: http://stackoverflow.com/comment/36275038
downvote count: 0
has comment: http://stackoverflow.com/comment/36274428
has comment: http://stackoverflow.com/comment/36274542
accepted answer of: http://stackoverflow.com/q/23625196
has comment: http://stackoverflow.com/comment/36275228
has body: public class A { public static void main(String[] args) { int height = Integer.parseInt(args[0]); int counter = 1; int spaces = height-1; for (int row = 1; row &lt;= height; row++){ for (int j = 1; j &lt;= spaces; j++){ System.out.print(" "); } for (int j = 1; j &lt;= counter; j++){ System.out.print("*"); } System.out.println(""); counter += 2; spaces--; } // end of outer loop counter-=2; // length of last line for(int i=1; i&lt;=counter/2-1; i++){ System.out.print(" "); } System.out.print("==="); } } Observe that we leave space equal to (length of last line)/2 in the first row and it keep decreases by 1. We can find length of last line by Arithmetic Progression. Observe that middle = of === will always be on (length of last line)/2+1 character. And Thus we have to put space till two characters before that that is (length)/2-1.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36274928
score: 1
has comment: http://stackoverflow.com/comment/36275013
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23625196
has comment: http://stackoverflow.com/comment/36274184

http://stackoverflow.com/comment/36450767
has text: I have absolutely no idea xD. I removed it and it is now fixed. I'm fairly tired tonight, sorry for idiocy! Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/23716946
score: 0
type: Comment

http://stackoverflow.com/a/23788890
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23765286
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23765286
type: Answer
score: 2
downvote count: 0
has body: This may be caused by not shutting down the Quartz scheduler upon Tomcat shutdown or web-application redeploy (most likely your case). You will need to implement a ServletContextListener and in its contextDestroyed method you will need to do this: scheduler.shutdown( true ); // true = wait for jobs to complete // you may want to give Quartz some extra time to shutdown //Thread.sleep(1000); You may also want to configure the Quartz thread-pool to mark its threads as "daemon threads" (org.quartz.threadPool.makeThreadsDaemons=true) as they will not block the JVM from stopping. Otherwise, the JVM will wait for all these worker threads to finish.

http://stackoverflow.com/a/23747333
type: Answer
has comment: http://stackoverflow.com/comment/36523335
has body: Resolved it. I had to enter this line into the ProGuard configuration. -keep class android.support.v7.** { *; }
has comment: http://stackoverflow.com/comment/39819587
answers question: http://stackoverflow.com/q/23744440
score: 0

http://stackoverflow.com/q/23690437
tagged with: regex
answer count: 4
favorite count: 0
has body: I am working with JSP and Servlet and user is going to input some string from that form in the JSP page. And that string can be like this - /pp/dc/dc1/h1 ... /pp/dc/dc1/h100 or /pp/dc/dc2/h1 ... /pp/dc/dc2/h100 or /pp/dc/dc3/h1 ... /pp/dc/dc3/h100 Here pp and dc are not going to change at all. Sometimes, they can pass dc1 or dc2 or dc3 and they will always pass a string like this which starts with h and then followed by some number like h1 or h2 or h100. so that means sometimes string can be like this - /pp/dc/dc1/h10 or /pp/dc/dc3/h3 or /pp/dc/dc2/h10 So my question is how do I check for these kind of patterns using regular expressions. If there is any string after h10 or any number followed by h like this - /pp/dc/dc2/h10/pro then I will return false otherwise returns true if it is in the same pattern as shown above. Is this possible to do using RegularExpressions? String data = "/pp/dc/dc3/h1"
has answer: http://stackoverflow.com/a/23690542
has comment: http://stackoverflow.com/comment/36401171
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23690574
accepted answer: http://stackoverflow.com/a/23690518
has title: Match a string using regular expressions?
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23690526
has answer: http://stackoverflow.com/a/23690518
tagged with: string
upvote count: 1
has answer: http://stackoverflow.com/a/23690574

http://stackoverflow.com/comment/36358603
comment on: http://stackoverflow.com/q/23668269
score: 0
type: Comment
type: QuestionComment
has text: I am using plain Java.

http://stackoverflow.com/comment/36442779
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23712870
score: 0
has text: *But what is `n`*? You never defined what `n` is. Read the error messages that are emitted by your compiler. They give you a *very* good idea of what you messed up. And the idea of this exercise isn't for you to go find an algorithm that does the work for you. The idea is to make you *think* and figure out the answer on your own

http://stackoverflow.com/q/23770063
has comment: http://stackoverflow.com/comment/36567194
type: UnansweredQuestion
tagged with: sockets
tagged with: android
tagged with: wpf
answer count: 0
tagged with: tcp
tagged with: java
type: Question
score: 0
has body: So i have a registration Android app that in main activity creates a socket connection on create opensocket(). Everything runs perfectly on the first submit, the debugger out put looks great and it sends/recieves data back from my WPF app. Now It goes to a thanks activity which onclick leads back to my mainactivity. Now when i hit submit, it works fine, but is showing its hitting my socket methods twice (only inserts the records once on my WPF app) , and so on as many times i submit. I realize i'm not closing or reusing my socket connection correctly?! I've tried several things, but can't seem to get this to either reuse the same opensocket instance or can't just close and reopen on reload. I'm quite new to android and sockets all together, any help is greatly appreciated! @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); settingsCheck(); openSocket(); sett.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { launchSettings(); } }); mainLogo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { RefreshMain(); } }); btn_register.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub tv_errors.setText(""); errorMsg = ""; nameCheck(et_lName.getText().toString(),et_fName.getText().toString()); emailCheck(et_email.getText().toString()); partnerCheck(); mobileCheck(et_mobile.getText().toString()); if (SocketHandler.SocketConnected){ if(errorMsg == ""){ //tv_errors.setText(""); if(checkForSD() == true){ sendRegistrantInfo(et_fName.getText() + "," + et_lName.getText() + "," + et_email.getText() + "," + et_mobile.getText() + "," + et_partEmail.getText() + "," + cb_terms1.isChecked() + "," + cb_terms2.isChecked() ); } else{ tv_errors.setText("**Please insert an SD Card."); } } else{ //tv_errors.setText(errorMsg); } } else { connectionStatus.setText("Connection Error.")…
has title: Android Socket sending data to WPF application
has comment: http://stackoverflow.com/comment/36581432

http://stackoverflow.com/q/23697622
downvote count: 0
has body: I've only recently started using Mockito (or mocking/stubbing for that matter). I'm starting to get the hang on how to mock objects, but I'm stuck on the following code: public class ConveyorBeltTest { private Layout layout; @Mock private WorkStation station1; @Mock private WorkStation station2; @Mock private WorkStation station3; @Mock private CarAssemblyProcess car1; @Mock private CarAssemblyProcess car2; @Before public void setUp() { layout = new Layout(); layout.getWorkStations().add(station1); layout.getWorkStations().add(station2); layout.getWorkStations().add(station3); when(station1.retrievePendingTasks().size()).thenReturn(0); when(station2.retrievePendingTasks().size()).thenReturn(2); when(station3.retrievePendingTasks().size()).thenReturn(1); when(station1.getCar()).thenReturn(car1); // it's impossible to have a car in a workstation and to have pending tasks, but it's tested regardless when(station2.getCar()).thenReturn(car2); when(station3.getCar()).thenReturn(null); } The following line throws: // line causing the problem when(station1.retrievePendingTasks().size()).thenReturn(0); // error msg org.mockito.exceptions.misusing.WrongTypeOfReturnValue: Integer cannot be returned by retrievePendingTasks() retrievePendingTasks() should return Set It's obviously telling me that it can't recognize station1.retrievePendingTasks() because station1 is not a real object but a mock. But I figured if I had a mock, I could chain commands behind the mock, which all wouldn't matter as long as I give the expected end result in thenReturn(). Can someone clarify what I did wrong here exactly? I have also tried with: doReturn(0).when(station1).retrievePendingTasks().size(); but the result is the same. The workaround I have found is to make a new Set, fill it with mock elements and pass that to the result of retrievePendingTasks() for each station. This works, though that's quite a bit of extra code clogging up the screen when my only goal is to have a number for the size of…
favorite count: 0
has answer: http://stackoverflow.com/a/23698348
has title: mockito: WrongTypeOfReturnValue (JAVA)
possible better answer: http://stackoverflow.com/a/23698487
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23698487
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23698348
type: Question
tagged with: testing
answer count: 2
tagged with: mockito
tagged with: junit

http://stackoverflow.com/comment/36361637
type: QuestionComment
comment on: http://stackoverflow.com/q/23669598
has text: @MadProgrammer Yes, the suggestion '`JToggleButton`' hardly speaks to the source of the compiler error. I decided to vote to close for lack of a reproducible example.
type: Comment
score: 1

http://stackoverflow.com/comment/36533607
comment on: http://stackoverflow.com/a/23758364
has text: After trying this out, the counting works perfectly for letter count eg "String StringToFind="a".toLowerCase();" but for the case of word count, the response gives a count of zero (0) no matter the number of occurrences of the word.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/91301364
has text: The last part is correct and I liked it but the first part wasn't needed at all and as you mentioned it won't work for non-BMP characters. `cp = (int)str[n];` is the exactly same as `cp = (int)str.charAt(n);` in Java, but not `codePointAt()`. Moreover, as you can tell, you don't even have to cast like that in most cases if a string consists of BMP characters only both in Java and C#. In the first place, OP's Java code was wrong and that made you misunderstand it, I guess.
comment on: http://stackoverflow.com/a/23751329
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/36528581
type: Comment
comment on: http://stackoverflow.com/a/23757454
score: 0
has text: It seems that this is more of a Java7/Java8 issue than a OpenJDK/HotSpot one - I added a benchmark on Oracle JDK 7u55...
type: AnswerComment

http://stackoverflow.com/comment/36461454
type: Comment
comment on: http://stackoverflow.com/q/23722456
has text: @Matt3o12 sure, pmd.sourceforge.net , findbugs.sourceforge.net, www.sonarqube.com
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36405660
type: Comment
comment on: http://stackoverflow.com/a/23692708
score: 0
type: AnswerComment
has text: Okay now see latest _EDIT_ please

http://stackoverflow.com/comment/36305806
type: AnswerComment
has text: You should put your source under a different directory to your target
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23640681

http://stackoverflow.com/comment/36642836
type: QuestionComment
has text: Compilers will generally generate similar object code patterns for similar high-level constructs. So once you become familiar with the patterns of a given compiler you can sometimes "see" the source code at a glance. Optimizers can muck this up big time, but very little optimization occurs in *javac* (mostly because the JVM specs don't allow it) -- Java optimization is left to the JITC and so the bytecodes are left "unmolested".
comment on: http://stackoverflow.com/q/23749326
score: 0
type: Comment

http://stackoverflow.com/comment/36475952
comment on: http://stackoverflow.com/q/23729224
has text: And about your code, it is not *minimal*, you post a lot of SQL lines when you ask about layout of components. Remove all unnecessary lines.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36454207
type: AnswerComment
comment on: http://stackoverflow.com/a/23718303
type: Comment
has text: So that program calls `fflush(stderr),` or maybe does whatever it is that disables the buffering, and yours doesn't.
score: 0

http://stackoverflow.com/comment/36399467
has text: Incidentally, HSL is not the same thing as HSV. It doesn't matter though, in terms of your answer.
comment on: http://stackoverflow.com/a/23689335
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36339228
score: 0
has text: `The char[] reference could potentially be a reference to an empty char array` what do you mean by potentially? As in undefined results? Or as in "It can be seen as" (on a phone; cant test right now)
type: Comment
comment on: http://stackoverflow.com/a/23658546
type: AnswerComment

http://stackoverflow.com/a/23701857
type: Answer
answers question: http://stackoverflow.com/q/23701750
score: 0
has body: You can override the paint(Graphics g) method of the JButton and draw anything you want instead of it. Or, if preferred, you can call super.paint first and then draw in addition over default image. You can check the text and state of the button you are drawing by simply calling the state check methods like getText() or isSelected(). The simplest way seems to ask your graphic designer to provide button images for the different state, and the draw these images instead of the button. Just do not resize, otherwise the text may not look well. You are right it is also possible to implement a pluggable looks and feel but for your case seems overkill.

http://stackoverflow.com/a/23655060
has comment: http://stackoverflow.com/comment/36335896
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36332294
type: Answer
accepted answer of: http://stackoverflow.com/q/23654788
has comment: http://stackoverflow.com/comment/36331970
score: 2
answers question: http://stackoverflow.com/q/23654788
upvote count: 2
has body: According to content in the book that you mentioned in the questions Section 1 is must, would teach you basics about java. Section 2: If you have already worked in any oo language then you can skip this section and come back to it later stage. Section 3 and Section 6 will be good for you as the code you need to write , need to be memory efficient and multi-threaded.
has comment: http://stackoverflow.com/comment/36364880

http://stackoverflow.com/q/23778189
has comment: http://stackoverflow.com/comment/36572873
tagged with: http://stackoverflow.com/tag/xlsx
score: 2
tagged with: apache-poi
has answer: http://stackoverflow.com/a/23781289
upvote count: 2
accepted answer: http://stackoverflow.com/a/23781289
type: AnsweredQuestion
has body: I was trying to add some styles to the excel sheet, I have generated using apache poi. Here is the code, I tried to make the first row in BOLD. SXSSFWorkbook wb=new SXSSFWorkbook(); Sheet sheet = wb.createSheet("Excelx"); Row row= sheet.createRow((short)0); row.createCell((short) 0).setCellValue("SRNum"); row.createCell((short) 1).setCellValue("Name"); CellStyle cs = wb.createCellStyle(); Font f = wb.createFont(); f.setFontHeightInPoints((short) 20); f.setBoldweight(Font.BOLDWEIGHT_BOLD); cs.setFont(f); row.setRowStyle(cs); But still, the first row is not changing to BOLD.
tagged with: java
has comment: http://stackoverflow.com/comment/36571502
type: Question
answer count: 1
downvote count: 0
has title: setBoldweight is not working
favorite count: 0

http://stackoverflow.com/a/35988497
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23757979
upvote count: 2
has body: it was a long time ago but some others could find this useful. You can use EJBs with tomcat but you have to include the following dependencies in your maven project: org.apache.openejb javaee-api 6.0-6 provided org.apache.openejb openejb-core 4.7.4 org.apache.openejb apache-tomee 1.7.4
type: Answer

http://stackoverflow.com/comment/36265544
type: AnswerComment
comment on: http://stackoverflow.com/a/23620410
type: Comment
has text: For some reason this isn't working when making matches()on Java, I put the input with ñ, and it returns false. Also I find weird that it prints the word Castañeda like this: CastaÃ±eda. May Java be messing with the codification?
score: 1

http://stackoverflow.com/comment/36589993
has text: The problem is that `Iterables.tryFind(list, predicate2)` gets always evaluated. You'd need `||` from Javascript or `or` from LISP. In Java it could only work if `tryFind` was lazy and `Optional` would evaluate its argument when needed.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23787497
type: Comment

http://stackoverflow.com/a/23642504
answers question: http://stackoverflow.com/q/23641113
type: Answer
upvote count: 3
score: 3
has body: I was curious too how this was possible since Threads can't be restarted, so I analyzed the code of ThreadPoolExecutor which is the implementation of all the ThreadPool ExecutorService you get through the static constructor. First of all as stated in the other answer you don't use Threads, but Runnables in ThreadPools, because that would defeat the purpose. So here is a detailed explaination how an ExecutorService reuses Threads: You usually add a Runnable through submit() which internally calls the execute() method. Basically this adds the runnable to a queue and adds a Worker if none is working ATM public void execute(Runnable command) { ... int c = ctl.get(); if (workerCountOf(c) &lt; corePoolSize) { if (addWorker(command, true)) return; c = ctl.get(); } if (isRunning(c) &amp;&amp; workQueue.offer(command)) { int recheck = ctl.get(); if (! isRunning(recheck) &amp;&amp; remove(command)) reject(command); else if (workerCountOf(recheck) == 0) addWorker(null, false); } else if (!addWorker(command, false)) reje ct(command); } The executor maintains a bunch of Worker (inner Class of ThreadPoolExecutor). It has your submitted runnable and a Thread that will be created through the ThreadFactory you maybe set or else just a default one; also the Worker itself is a Runnable, which is used to create the Thread from the factory private final class Worker extends AbstractQueuedSynchronizer implements Runnable { ... Worker(Runnable firstTask) { this.firstTask = firstTask; this.thread = getThreadFactory().newThread(this); } public void run() { runWorker(this); } ... } When adding a Worker it gets kickstarted private boolean addWorker(Runnable firstTask, boolean core) { ... Worker w = new Worker(firstTask); Thread t = w.thread; ... t.start(); ... return true; } the runWorker() method runs in a loop and get with getTask() the runnables you submitted which are queued in the workingQueue and will wait at getTask unitl a timeout happens. final void runWorker(Worker w) { Runnable tas…
downvote count: 0

http://stackoverflow.com/q/23625947
has body: I'm trying to use MigLayout for my project but i'm struggling to understand the logic. I'd like to place 2 labels on top and at the bottom of a certain panel with a margin of 20px between the labels and the ends of the panel. Moreover, he labels must be centered horizontally. Any ideas on how to do this ?
has comment: http://stackoverflow.com/comment/36275582
answer count: 1
score: -2
has title: How to… using MigLayout
favorite count: 0
has answer: http://stackoverflow.com/a/23631319
linked to: http://stackoverflow.com/q/352781
has comment: http://stackoverflow.com/comment/36275458
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/36275743
accepted answer: http://stackoverflow.com/a/23631319
has comment: http://stackoverflow.com/comment/36276315
type: AnsweredQuestion
tagged with: miglayout
has comment: http://stackoverflow.com/comment/36275875
tagged with: java
type: Question
upvote count: 0

http://stackoverflow.com/a/23723094
score: 1
type: AcceptedAnswer
has body: This is how I would do it: import java.util.Date; import java.util.Map; import java.util.NavigableSet; import java.util.TreeSet; public class DescendingSetTest { public static void main(String[] args) { NavigableSet&lt;Map.Entry&lt;Date, String&gt;&gt; set = new TreeSet&lt;Map.Entry&lt;Date, String&gt;&gt;(); set.add(newEntry(new Date(0), "0000")); set.add(newEntry(new Date(700000000000l), "0000")); set.add(newEntry(new Date(700000000000l), "9999")); for (Map.Entry&lt;Date, String&gt; entry : set.descendingSet()) System.out.println(entry); } public static &lt;K extends Comparable&lt;? super K&gt;, V extends Comparable&lt;? super V&gt;&gt; Map.Entry&lt;K, V&gt; newEntry(K key, V value) { return new Entry&lt;K, V&gt;(key, value); } private static class Entry&lt;K extends Comparable&lt;? super K&gt;, V extends Comparable&lt;? super V&gt;&gt; implements Map.Entry&lt;K, V&gt;, Comparable&lt;Entry&lt;K, V&gt;&gt; { private K key; private V value; Entry(K key, V value) { this.key = key; this.value = value; } @Override public K getKey() { return key; } @Override public V getValue() { return value; } @Override public V setValue(V value) { throw new UnsupportedOperationException(); } @Override public int compareTo(Entry&lt;K, V&gt; that) { int c = key.compareTo(that.key); return c != 0 ? c : value.compareTo(that.value); } @SuppressWarnings("unchecked") @Override public boolean equals(Object that) { return that instanceof Entry&lt;?, ?&gt; ? compareTo((Entry&lt;K, V&gt;)that) == 0 : false; } @Override public String toString() { return key + "," + value; } } }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23722650
has comment: http://stackoverflow.com/comment/36462628
has comment: http://stackoverflow.com/comment/36462722
accepted answer of: http://stackoverflow.com/q/23722650
downvote count: 0

http://stackoverflow.com/q/23701593
has answer: http://stackoverflow.com/a/23704033
upvote count: 3
has comment: http://stackoverflow.com/comment/36421158
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/23701805
has answer: http://stackoverflow.com/a/23701755
favorite count: 0
has body: I may be wrong but from what I understand when creating an object in java by: Class object = new Class; the new Class create new object of Class type which is then applied to "object" reference so when u create array of objects by: Class[] objects = new Class[10]; does it mean new Class[10] creates 10 objects of Class type wich are then applied to objects reference or just a memory for size of 10 objects of Class type is reserved and you need to create certain objects later
accepted answer: http://stackoverflow.com/a/23701647
answer count: 5
has answer: http://stackoverflow.com/a/23701860
has comment: http://stackoverflow.com/comment/36421094
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23701647
tagged with: java
has title: what exactly happens when new operator is called for array and object?
possible better answer: http://stackoverflow.com/a/23701755
type: Question

http://stackoverflow.com/comment/36452829
comment on: http://stackoverflow.com/q/23717957
score: 0
type: Comment
type: QuestionComment
has text: Ah, I see. In that case, wouldn't a way to traverse the AST be more helpful than just printing it?

http://stackoverflow.com/comment/36434820
has text: I couldnt get onClickListener to Work.
comment on: http://stackoverflow.com/a/23708673
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36300824
has text: What this passage is trying to explain is that when a comment starts with `//`, it ends at the line terminator and does not carry over to the next line the way the `/*` comment does. In other words, `//` is the start of a one-line comment (which can be placed after a line of executed code).
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23638692
type: AnswerComment

http://stackoverflow.com/q/23676743
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23676816
type: UnansweredQuestion
tagged with: datetime
has body: When I want to get a time set to 00:00:00, Calendar always get 12:00:00 Calendar currentDate = Calendar.getInstance(); // even set AM_PM it was still 12:00:00 // currentDate.set(Calendar.AM_PM, Calendar.AM); // Calendar.HOUR still not work currentDate.set(Calendar.HOUR_OF_DAY, 0); currentDate.set(Calendar.MINUTE, 0); currentDate.set(Calendar.SECOND, 0); currentDate.set(Calendar.MILLISECOND, 0); How could I make it? Thanks in advance.
linked to: http://stackoverflow.com/q/17821601
has comment: http://stackoverflow.com/comment/36374551
tagged with: calendar
has comment: http://stackoverflow.com/comment/36374256
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/139263278
upvote count: 3
has title: Calendar can not set hour correctly
answer count: 2
has comment: http://stackoverflow.com/comment/36374926
has answer: http://stackoverflow.com/a/23676897

http://stackoverflow.com/comment/36449501
type: QuestionComment
has text: use `sequence` type of column in database.
comment on: http://stackoverflow.com/q/23716409
score: 0
type: Comment

abstract-class
tags question: http://stackoverflow.com/q/23754577
type: Tag
tags question: http://stackoverflow.com/q/23697869
tags question: http://stackoverflow.com/q/23645753
tag name: abstract-class
tags question: http://stackoverflow.com/q/23682090
tags question: http://stackoverflow.com/q/23665959

http://stackoverflow.com/comment/36473911
has text: @boolean And tab = 9. Tabs are whitespace. And so are newlines/carriage returns. Again, whitespace includes more than just the space character.
score: 0
comment on: http://stackoverflow.com/q/23728424
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23749312
accepted answer of: http://stackoverflow.com/q/23747702
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23747702
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: In the second example the NullPointerException is not caught, instead, you are catching an EJBException which is other runtime exception class. As you say, when the Container intercepts the NullPointerException, the transaction is marked for rollback. The first example catches Exception, wich is a base class (the Java exceptions are hierarchical ), therefore, any subclass of Exception such as NullPointer or EJBException is caught. In this case the Container doesn't mark the transaction for rollback.

http://stackoverflow.com/q/23651047
has title: Play Framework with eclipselink error on change and reload
favorite count: 0
tagged with: playframework-2.0
upvote count: 1
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23673777
tagged with: jpa
downvote count: 0
type: UnansweredQuestion
score: 1
type: Question
has body: Im faced with some problems for the integration of eclipselink into the play framework. When I type run the server starts and I can connect to my application without any error. But: Afterwards when I (as an example) force a recompile with a little change then the application breaks with an error (on em.persist): play.api.Application$$anon$1: Execution exceptionIllegalArgumentException: Object: model.Car@1a5f139c is not a known entity type. What I did(to keep it simple) a car model: package model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "car") public class Car { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int carId; private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } } My build.sbt looks like this: name := "WebTest" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( "org.eclipse.persistence" % "eclipselink" % "2.5.1", "mysql" % "mysql-connector-java" % "5.1.18", javaJdbc, javaEbean, cache ) play.Project.playJavaSettings application.conf(partially): db.default.jndiName=DefaultDS db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://localhost/playjpa?characterEncoding=UTF-8" db.default.user=xxxx db.default.password=xxxx jpa.default=defaultPersistenceUnit Ans my persistence.xml in conf.META-INFO(drop create was in there before): model.Car org.eclipse.persistence.jpa.PersistenceProvider DefaultDS <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> And now the controller which executes the call: public class Application extends Controller { private static final String PERSISTENCE_UNIT_NAME = "defaultPersistenceUnit"; private static EntityManagerFactor…
tagged with: eclipselink

http://stackoverflow.com/comment/36473549
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23727101
type: Comment
has text: durgas's answer was what I am looking for

http://stackoverflow.com/comment/36525135
score: 0
has text: "After millions of calcs and around 7 hours, I got a read timeout on java side." - you mean a read timeout from the socket? How long do you have left the sockets open? Please show a minimal example code.
type: Comment
comment on: http://stackoverflow.com/q/23755874
type: QuestionComment

http://stackoverflow.com/q/23705574
type: UnansweredQuestion
has body: I am very new to development and have inherited a 10-year old application that was just converted from OAS to Weblogic. One of the operations of the web service does not work, while two do. When examining the source, it looks like the difference between the two that work and the one that does not is ejb-ref in the web.xml The ear that is deployed is built with ant and there are no jar files within the ear file or it's war file. When the non-functioning operation is called with correct arguments from the weblogic web services testing page, it returns: java.lang.NoClassDefFoundError: Could not initialize class org.geotools.cs.GeographicCoordinateSystem The ear file contains a /lib directory, a META-INF directory and a war file. The war file contains a classes directory, a META-INF directory and a number of xml documents. The library in question from the error exists in the /lib folder of the ear. The application xml looks like this: <?xml version='1.0' encoding='UTF-8'?> Map Viewer Services MapViewerServicesPortTypeImpl.war /outside/mapviewer The weblogic-application.xml seems to contain only the default information: <?xml version='1.0' encoding='UTF-8'?> The /web/WEB-INF/web.xml contains the only reference to ejb: <?xml version = '1.0' encoding = 'windows-1252'?> web.xml file for Map Viewer Service Application MapViewerWS oracle.j2ee.ws.StatelessJavaRpcWebService class-name ws1.mapViewer.MapViewerServices interface-name ws1.mapViewer.IMapViewerWS MapViewerWS /MapViewerWS 35 html text/html txt text/plain ws1.mapViewer.NotifiedResults Session ws1.mapViewer.NotifiedResultsHome ws1.mapViewer.NotifiedResults ws1.mapViewer.NotifiedResults If this is not sufficient information to be able to diagnose or suggest option, please let me know and I can post additional details. Thanks in advance for any help!
answer count: 0
score: 1
tagged with: java
tagged with: noclassdeffounderror
upvote count: 1
type: Question
tagged with: weblogic
tagged with: ejb
has title: Weblogic Web Services - EJB (not a jar) returns NoClassDefFoundError
has comment: http://stackoverflow.com/comment/36429339
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36281782
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23629075
has text: should i use a windows live account like xyz@windows.live.com ??

http://stackoverflow.com/q/23739333
tagged with: java
has comment: http://stackoverflow.com/comment/36496061
has title: Accessing property that is filled by an AsyncTask returns null
has comment: http://stackoverflow.com/comment/36495800
type: Question
has comment: http://stackoverflow.com/comment/36493384
has body: I am trying to get values from my User class (holding all the user information for the logged in user. It is set once logged in, and it is printing out in the log just fine, but then when calling from the class that instantiates it, it returns a null? Here is the code: public ApiConnector api; public String ID; public String USERNAME = null; public String NAME = null; public String LASTNAME = null; public String PASSWORD = null; public String EMAIL = null; public User(String id) { this.ID = id; this.api = new ApiConnector(); new GetUserDataClass().execute(api); } private class GetUserDataClass extends AsyncTask&lt;ApiConnector,Boolean,JSONArray&gt; { @Override protected JSONArray doInBackground(ApiConnector... params) { return params[0].getAllUserData(ID); } @Override protected void onPostExecute(JSONArray jsonArray) { if(jsonArray != null) { for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject json = null; try { json = new JSONObject(); json = jsonArray.getJSONObject(i); if(!json.getString("username").isEmpty()) { setUsername(json.getString("username")); Log.d("username", getUsername()); } if(!json.getString("firstname").isEmpty()) { setName(json.getString("firstname")); Log.d("name", getName()); } if(!json.getString("lastname").isEmpty()) { setLastName(json.getString("lastname")); Log.d("lastname", getLastName()); } if(!json.getString("email").isEmpty()) { setEmail(json.getString("email")); Log.d("email", getEmail()); } } catch (JSONException e) { e.printStackTrace(); } } } else { Log.d("hey", "hey"); } } The logcat output is: 05-19 02:03:55.996: W/EGL_emulation(4367): eglSurfaceAttrib not implemented 05-19 02:03:55.996: D/username(4367): Me 05-19 02:03:55.996: D/name(4367): Me 05-19 02:03:55.996: D/lastname(4367): Mememe 05-19 02:03:55.996: D/email(4367): me@example.com I have all appropriate getters and setters in the class (as you can see in the above code, working fine. Here is the Menu class (that is returning the null): public class Menu extends Acti…
has answer: http://stackoverflow.com/a/23739838
score: 0
has answer: http://stackoverflow.com/a/23740083
has comment: http://stackoverflow.com/comment/36495971
has comment: http://stackoverflow.com/comment/36495759
has comment: http://stackoverflow.com/comment/36493712
has answer: http://stackoverflow.com/a/23743318
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23739658
tagged with: android
answer count: 4
has comment: http://stackoverflow.com/comment/36493664
has comment: http://stackoverflow.com/comment/36493686
tagged with: oop

http://stackoverflow.com/comment/36540456
has text: Have you done debugging to ensure `inputStream` isn't null? And that the constructor calls don't return `null`?
comment on: http://stackoverflow.com/q/23729250
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23636733
has comment: http://stackoverflow.com/comment/39642525
score: 0
has comment: http://stackoverflow.com/comment/36299012
has comment: http://stackoverflow.com/comment/36296594
tagged with: sqlite
type: UnansweredQuestion
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/36322559
tagged with: java
has body: Is there any support in the SQLite libraries or frameworks for Android to lazy load? A common use case would be images stored in a SQL lite database. You can imagine getting a reference to a SQLite backed POJO with getters for image resources and not wanting to fetch those resources until the accessor is invoked. This is supported in ORM's I have worked with in Java, but I have not found any good suggestions for lazy loading of SQLite data in Android. Note, this is not a "lazy load in listview" question. I am working on an implementation that is decoupled from any specific UI element.
has title: Lazy Loading in SQLite
type: Question
has comment: http://stackoverflow.com/comment/36296540
has comment: http://stackoverflow.com/comment/36296408
has comment: http://stackoverflow.com/comment/36322265

http://stackoverflow.com/comment/36367504
type: QuestionComment
has text: @Tiny If I am wrong here, then second case won't work.
comment on: http://stackoverflow.com/q/23670842
score: 0
type: Comment

http://stackoverflow.com/comment/36608693
type: QuestionComment
comment on: http://stackoverflow.com/q/23768480
has text: Please post your configuration for all: server, proxy and client (local.config, pof.config, tangosol.override)
score: 0
type: Comment

http://stackoverflow.com/q/23683419
has comment: http://stackoverflow.com/comment/36387297
has answer: http://stackoverflow.com/a/23714240
answer count: 4
has comment: http://stackoverflow.com/comment/36387263
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23683826
tagged with: multithreading
upvote count: 1
has title: How to reproduce race condition in java?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23684012
accepted answer: http://stackoverflow.com/a/23714240
tagged with: java
linked to: http://stackoverflow.com/q/3830347
has comment: http://stackoverflow.com/comment/36387502
score: 0
has body: I tried to create a race condition like this. class Bankaccount { private int balance=101; public int getBalance(){ return balance; } public void withdraw(int i){ balance=balance-i; System.out.println("..."+balance); } } public class Job implements Runnable{ Bankaccount b=new Bankaccount(); public void run(){ if(b.getBalance()&gt;100){ System.out.println("the balanced ammount is"+b.getBalance()); /*try{ Thread.sleep(9000); } catch(Exception e){ }*/ makeWithdrawl(100); } } public void makeWithdrawl(int ammount){ b.withdraw(ammount); System.out.println(b.getBalance()); } public static void main(String[] args) { Job x=new Job(); Job y=new Job(); Thread t1=new Thread(x); Thread t2=new Thread(y); t1.start(); t2.start(); } } I am getting output: the balanced ammount is101 ...1 1 the balanced ammount is101 ...1 I was expecting it to be in negative as two times withdrawal happened for 100 What is missing here? Thanks in Advance
linked to: http://stackoverflow.com/q/5644384
possible better answer: http://stackoverflow.com/a/23684041
favorite count: 0
has answer: http://stackoverflow.com/a/23684041

http://stackoverflow.com/comment/36348665
score: 0
type: Comment
type: QuestionComment
has text: Basically should be a fields. Have I to define it as "private String.."?
comment on: http://stackoverflow.com/q/23663234

http://stackoverflow.com/a/23653794
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23652606
has body: CheckStyle - Its is an example for SCA(Static code analysis) tool. Other SCA tools for Java. Formatter - Limited to only formatting your source code. Cleanup - Formatter + Something more(Like removing trailing spaces, sorting member etc) To know the exact difference between Cleanup and Formatter. Create new profile for each one of these and check the difference. Refer this.
upvote count: 1

http://stackoverflow.com/q/23687065
has answer: http://stackoverflow.com/a/23729143
score: 1
tagged with: java
tagged with: vector
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23729143
has title: Vector normalization in jscience.mathematics.vector
has body: I have a Vector&lt;Real&gt; vec in jscience. I could not find the function to normalize it. Could you please help me to normalize vec?
type: AnsweredQuestion
tagged with: jscience
upvote count: 1
type: Question

http://stackoverflow.com/comment/36481196
score: 1
comment on: http://stackoverflow.com/q/23731605
type: Comment
has text: @Volodia as @Boris said: if you want to sleep use `Thread.sleep()` if you insist on misusing wait you have to write it as `long startTime = System.currentTimeMillis(); synchronized (lock) { while (System.currentTimeMillis() - startTime < 1000) { lock.wait(1000); } }`
type: QuestionComment

http://stackoverflow.com/comment/36324140
score: 0
has text: You're out of luck. It would only be possible if you poll manually whether timeout has occurred, and that's possible only if your task is divided to small enough steps. What's wrong with a multithreaded solution, i.e. do you actually have a problem you're trying to solve, or are you just asking this as a "can we do this?" question?
comment on: http://stackoverflow.com/q/23650349
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23772828
has comment: http://stackoverflow.com/comment/36563085
tagged with: class
score: 0
type: UnansweredQuestion
has title: How to send input from a MouseListener to another class?
has body: I have a runner class that runs the splashscreen and then runs the main menu. From the main menu, different screens should appear depending on the option the user has selected. The problem is that I use MouseListeners to detect which option the user has clicked on. This value then needs to be passed on to the runner class to determine which class to display next. I cannot get this to work in an efficient method. At the moment, I have it where it gets the mouse location at the very beginning of execution and never looks for it again. I also tried with a while loop that did [while the mouse position is not on top of a button get the mouse position again] but obviously we do not want to use while loops as that is inefficient. Several other threads on this site have suggested to make what would be my runner class implement the interface then parameter-pass it to the main menu... this however does not make much sense to me because shouldn't a runner class not be a subclass or implement any interfaces? Here is my code: Main menu class import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.*; public class MainMenu extends JPanel implements ActionListener, MouseListener{ //ActionListener? Image image; int loc = 0; public MainMenu(){ initializeImage(); addMouse(); } public void initializeImage(){ try{ image = ImageIO.read(new File("MainMenu.jpg")); //JLabel picLabel = new JLabel(new ImageIcon(image)); //add(picLabel); } catch(IOException e){} } public int getLoc() { return loc; } public void addMouse(){ addMouseListener (new MouseAdapter() { public void mouseReleased(MouseEvent e) { loc = e.getY(); } } ); addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent e) { //Add proposed helper method! if (e.getX() &gt;= 200 &amp;&amp; e.getX() &lt;= 800){ try{ if (e.getY() &gt;= 241 &amp;&amp; e.getY() &lt;= 309){ image = ImageIO.read(new File("MainMenu1.jpg")); …
tagged with: mouse
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36558382
type: Question

http://stackoverflow.com/a/23662537
type: Answer
score: 2
has body: There is no need to reinvent the wheel here. You don't even have to use direct Strings. Your onClick could simply be: @Override public void onClick(View v) { text.append(btn.getText()); } Also, I don't know what "toe" is in toe.setOnClickListener(this); but you should be setting the clicklistener on btn1
answers question: http://stackoverflow.com/q/23662195
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/36310759
type: Comment
has text: Aha.. `something the crops up over time`. Does that mean it only occurs under load? Do you have multiple servlets? Are there any other code besides `getNextMcsCheckAndIncrement()` that load and save to the Hotel table? If so, you are getting synchronization issues with other code that loads/saves into the DB. I am not well verse with Hibernate, so the last test I proposed is merely to see whether `query` would give you back the new value after you call `update`. Good luck.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23642734

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

http://stackoverflow.com/q/23714860
has title: Hide an Object's Type from Compiler
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36446297
accepted answer: http://stackoverflow.com/a/23715502
has comment: http://stackoverflow.com/comment/36446264
has comment: http://stackoverflow.com/comment/36446285
tagged with: java
has comment: http://stackoverflow.com/comment/36446274
possible better answer: http://stackoverflow.com/a/23714913
has comment: http://stackoverflow.com/comment/36446419
downvote count: 1
has answer: http://stackoverflow.com/a/23714913
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23715047
score: -1
has body: I was asked this question in an interview. It caught me completely off guard. You have a super class and a subclass. class B is a subclass of A. Both classes have an implementation of the same function foo(). Is it possible to write a piece of code that makes it so that the compiler doesn't know what the type of an object is? In this case the object is b below. A b = new B(); Then you would do a function call in which the type won't be known until execution. This was my answer on the whiteboard: (A)b.foo();
has comment: http://stackoverflow.com/comment/36446436
has comment: http://stackoverflow.com/comment/36469529
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23715502
favorite count: 0

http://stackoverflow.com/q/23617672
has answer: http://stackoverflow.com/a/23618515
tagged with: loops
has comment: http://stackoverflow.com/comment/36260482
has comment: http://stackoverflow.com/comment/36259844
type: Question
has comment: http://stackoverflow.com/comment/36260240
has comment: http://stackoverflow.com/comment/36259873
has comment: http://stackoverflow.com/comment/36260137
downvote count: 5
has comment: http://stackoverflow.com/comment/36260122
has answer: http://stackoverflow.com/a/23617896
answer count: 2
has comment: http://stackoverflow.com/comment/36259920
upvote count: 0
has comment: http://stackoverflow.com/comment/36259818
has comment: http://stackoverflow.com/comment/36260003
favorite count: 0
has body: Write a program to read two string and print “Equal” if they are the same case insensitive. For example : Input: Code Code Output: Equal Input: Masr Masry Output: Not Equal Input: Egypt EGYpt Output: Equal Note: You should use loops. Don’t use some existing method to check equality. i'v tried this code and faild more than 5 times :( import java.util.Scanner; public class equal { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); String st1=in.nextLine(); String st2=in.nextLine(); int len1=st1.length(); int len2=st2.length(); int y=1; if(len1==len2){ char ch1=st1.charAt(0); char ch2=st2.charAt(0); int con1=ch1 , con2=ch2; if(con1==con2){ for(int x=1;x&lt;len1;x++){ char Ch1=st1.charAt(x); char Ch2=st2.charAt(x); if(Ch1==Ch2){ y++; } } } } if(y==len1){ System.out.println("Equal"); }else if(y!=len1){ System.out.println("Not Equal"); } } }
has comment: http://stackoverflow.com/comment/36261361
has comment: http://stackoverflow.com/comment/36259815
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36260345
has comment: http://stackoverflow.com/comment/36259856
has comment: http://stackoverflow.com/comment/36259779
has comment: http://stackoverflow.com/comment/36259627
has comment: http://stackoverflow.com/comment/36262641
linked to: http://stackoverflow.com/q/23523820
score: -5
linked to: http://stackoverflow.com/q/3719711
has title: compare two strings using loops in java insensitive case?
tagged with: java
linked to: http://stackoverflow.com/q/16259250

http://stackoverflow.com/comment/113573864
type: AnswerComment
has text: Is there a way for `output.pdf` to exist, in-memory? (rather than get written to a file?
type: Comment
comment on: http://stackoverflow.com/a/38621650
score: 0

http://stackoverflow.com/comment/36433693
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23707950
has text: variable can not be `private` until you use `private` modifier for that variable.(_In Java_)

gradle
tags question: http://stackoverflow.com/q/23688702
tags question: http://stackoverflow.com/q/23730887
tags question: http://stackoverflow.com/q/23689054
tags question: http://stackoverflow.com/q/23640030
tags question: http://stackoverflow.com/q/23697438
tags question: http://stackoverflow.com/q/23673743
tags question: http://stackoverflow.com/q/23763534
tags question: http://stackoverflow.com/q/23692585
tags question: http://stackoverflow.com/q/23663299
type: Tag
tags question: http://stackoverflow.com/q/23621654
tags question: http://stackoverflow.com/q/23749531
tags question: http://stackoverflow.com/q/23698598
tags question: http://stackoverflow.com/q/23677459
tag name: gradle
tags question: http://stackoverflow.com/q/23706347
tags question: http://stackoverflow.com/q/23679292
tags question: http://stackoverflow.com/q/23638579
tags question: http://stackoverflow.com/q/23633430
tags question: http://stackoverflow.com/q/23763713
tags question: http://stackoverflow.com/q/23718190
tags question: http://stackoverflow.com/q/23742328
tags question: http://stackoverflow.com/q/23621723
tags question: http://stackoverflow.com/q/23678908
tags question: http://stackoverflow.com/q/23675666

http://stackoverflow.com/q/23622183
tagged with: sql
downvote count: 0
favorite count: 0
has title: How to dynamically bind a table name in JDBI
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23623221
has body: I tried using SELECT COUNT(*) FROM :TableName; And in JDBI I used .bind("Tablename", "MyTable") The result is always inside single quotes: SELECT COUNT(*) FROM 'MyTable'; Is there a proper way to parameterise something like TableName?
possible better answer: http://stackoverflow.com/a/33963796
tagged with: java
tagged with: jdbi
tagged with: mysql
has answer: http://stackoverflow.com/a/33963796
type: Question
upvote count: 12
tagged with: database
accepted answer: http://stackoverflow.com/a/23623221
score: 12
answer count: 2

http://stackoverflow.com/q/23685286
score: 2
favorite count: 0
tagged with: jenkins
upvote count: 2
has comment: http://stackoverflow.com/comment/36392380
tagged with: artifactory
tagged with: maven
accepted answer: http://stackoverflow.com/a/23687796
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36452487
tagged with: java
has title: Version of WAR after deploying
has body: I am currently building snapshots of a project using Java, Maven, Jenkins and Artifactory, and running the WAR on Tomcat. After I copy a WAR file out of Artifactory into Tomcat and rename it, I have essentially "lost" the version of the application. I have two remote teams that are constantly dropping wars across integration machines and it very quickly becomes difficult to tell what is running where. Eventually I would like to be able to query the app for it's version, or even just print out the app version into a log file at startup, but first I have to get the version into the war file itself. I'm not entirely certain which entity is responsible for creating the version but it looks like it is Artifactory creating the SNAPSHOT version, like "myapp-1.2.0-20140514.145130-1.war". The only solution I can think of is to stop using snapshots, increment maven versions manually at checkin, and then run a script that injects the maven version into a .java file before it is compiled. Yuck. Is there a way I can get this version into the app with my current setup?
type: Question
has comment: http://stackoverflow.com/comment/36448771
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23687796

http://stackoverflow.com/q/23732671
has body: I'm trying to build a simple mule REST service based on an Spring+MyBatis application which I've created earlier. The spring app worked just as it was supposed to (transactions were working properly) but after integrating the code into Mule REST component and running the app I get the following log with an error: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Initializing app 'test_rest' + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ INFO 2014-05-19 09:51:58,651 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker INFO 2014-05-19 09:51:58,813 [main] org.mule.config.spring.MuleApplicationContext: Refreshing org.mule.config.spring.MuleApplicationContext@6b1de1c2: startup date [Mon May 19 09:51:58 CEST 2014]; root of context hierarchy INFO 2014-05-19 09:52:00,762 [main] org.mule.config.spring.MuleApplicationContext: Bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) INFO 2014-05-19 09:52:00,766 [main] org.mule.config.spring.MuleApplicationContext: Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) INFO 2014-05-19 09:52:01,291 [main] org.springframework.jdbc.datasource.DriverManagerDataSource: Loaded JDBC driver: oracle.jdbc.OracleDriver ERROR 2014-05-19 09:52:01,408 [main] org.apache.ibatis.executor.BaseExecutor: Could not get a databaseId from dataSource java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//192.168.200.10:1522/ORCL at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConne…
tagged with: mule
score: 0
answer count: 3
has title: Mule, Spring, MyBatis - Could not get a databaseId from dataSource
has answer: http://stackoverflow.com/a/25387402
tagged with: mybatis
tagged with: rest
has answer: http://stackoverflow.com/a/23747959
tagged with: spring
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/67443374
type: Question

http://stackoverflow.com/comment/36535155
type: AnswerComment
type: Comment
has text: Link to the image isn't displayed + screenshot misses a lot of input (before all theses gwtp dependencies). You're looking for every client-side-only dependency that wouldn't have the `provided` scope. As for splitting or not, it's possible not to split but it's harder to maintain as the project grows (plus, your client-side classes will end-up in your WAR); splitting makes things easier generally-speaking (except for the initial setup of launching DevMode/SuperDevMode).
comment on: http://stackoverflow.com/a/23742422
score: 0

http://stackoverflow.com/comment/62145886
score: 1
has text: That project while officially supported by Couchbase is braid-dead from java prospective for about a year already because of this bug: https://github.com/couchbase/CouchbaseMock/issues/11. If one can't open a bucket the purpose of the whole thing is rather unclear.
comment on: http://stackoverflow.com/q/23648108
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36474340
type: Comment
type: QuestionComment
has text: @MarsAtomic: You're quite possibly right. Myself, I'm terrible at reading minds or guessing at code I can't see.
comment on: http://stackoverflow.com/q/23728920
score: 0

http://stackoverflow.com/q/23767478
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/10148421
has answer: http://stackoverflow.com/a/23775003
has body: I'm new in java so friends help me. i'm unable to get what i want. ButtonFrame() { jp=new JPanel(); btn1=new JButton("Green button"); btn2=new JButton("Yellow button"); add(jp); setTitle("change background color"); setSize(400,300); } public void actionPerformed(ActionEvent e) { if(e.getSource()==btn1) setBackground(new Color(Color.GREEN)); //same for others }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36547391
has title: i want to change jpanel background color by clicking on buttons
accepted answer: http://stackoverflow.com/a/23775003
type: Question
has comment: http://stackoverflow.com/comment/36550721
has comment: http://stackoverflow.com/comment/36547656

http://stackoverflow.com/q/23691474
answer count: 1
accepted answer: http://stackoverflow.com/a/23692487
has title: JTable update ColumnNames
has comment: http://stackoverflow.com/comment/36403216
has comment: http://stackoverflow.com/comment/36403783
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36403952
tagged with: java
has comment: http://stackoverflow.com/comment/36404907
tagged with: swing
has body: I am using AbstractTableModel. I have used the code provided from this website(http://www.javalobby.org/articles/jtable/?source=archives) to auto generate new rows for the JTable when JTable reaches on last row. Its working fine but I am not able to update the column names anymore when user clicks a button. So I have to remove auto generate row feature to update column names. As far as I understand the code from the website, Its using a hidden column as a trigger to create new row. InteractiveTableModelListener is disabling something which I don't understand how to change/edit it? How could I solve this? Thanks for your time!!
has answer: http://stackoverflow.com/a/23692487
type: Question
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36403148
has comment: http://stackoverflow.com/comment/36403610

http://stackoverflow.com/q/23657282
favorite count: 0
has comment: http://stackoverflow.com/comment/96446347
type: UnansweredQuestion
tagged with: java
has title: Want to resize components with the window?
has body: I want to make my components on my JFrame resize with the resizing of the window. How can this be done. Currently when I make the JFrame smaller the components remain in the same place and then disappear as the frame gets smaller. Ideally I would like to set a minimum JFrame size which would not allow the form to go any smaller but when I make it larger that components should move with the JFrame. Add: What if I want to use an absolute layout manager. This is the layout manager that my boss prefers. Code: import java.awt.Color; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import javax.swing.JCheckBox; import java.awt.Font; public class TestFrame extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; private JButton btnNewButton; private JButton btnNewButton_1; private JButton btnNewButton_2; private JCheckBox chckbxNewCheckBox; private JCheckBox chckbxNewCheckBox_1; private JCheckBox chckbxNewCheckBox_2; public static void main(String[] args) { TestFrame frame = new TestFrame(); frame.setVisible(true); } public TestFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 629, 458); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(15, 15, 15, 15)); setContentPane(contentPane); contentPane.setLayout(null); btnNewButton = new JButton("Save"); btnNewButton.setFont(new Font("Sylfaen", Font.BOLD, 14)); btnNewButton.setBounds(514, 386, 89, 23); contentPane.add(btnNewButton); btnNewButton_1 = new JButton("Open"); btnNewButton_1.setBounds(514, 352, 89, 23); contentPane.add(btnNewButton_1); btnNewButton_2 = new JButton("Close"); btnNewButton_2.setBounds(514, 318, 89, 23); contentPane.add(btnNewButton_2); btnNewButton_2.setBackground(Color.YELLOW); btnNewButton_2.setEnabled(false); chckbxNewCheckBox = new JCheckBox("Employeed"); chckbxNewCheckBox.setBounds(506, 7, 97, 23); contentPane.add(chckbxNewCheckBox); chckbxNewCheckBox_…
type: Question
has answer: http://stackoverflow.com/a/23657394
score: 0
upvote count: 1
downvote count: 1
answer count: 1

http://stackoverflow.com/q/23725832
has answer: http://stackoverflow.com/a/23725888
downvote count: 1
tagged with: jdbc
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36468057
has comment: http://stackoverflow.com/comment/36467945
tagged with: java
has comment: http://stackoverflow.com/comment/36468025
has comment: http://stackoverflow.com/comment/36468014
score: -1
has body: Can somebody tell me the equivalent oracle statement for the given mySql statement: Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/city?user=root&amp;password=root");
type: Question
has comment: http://stackoverflow.com/comment/36468064
answer count: 1
has title: Oracle equivalent staement for the given MySql statement
favorite count: 0
tagged with: oracle-database

http://stackoverflow.com/comment/36512761
comment on: http://stackoverflow.com/a/23749054
type: AnswerComment
score: 0
type: Comment
has text: @MadProgrammer For the actual JPanel that's currently holding each component, I'm using GridLayout (with 5 rows, 1 column, otherwise the buttons are lined up horizontally, not vertically)

http://stackoverflow.com/a/23676897
has comment: http://stackoverflow.com/comment/36405176
has body: You can set hour like this: SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd HH:mm:ss"); Calendar calendar = new GregorianCalendar(2014, 4, 15, 0, 0, 0); System.out.println(sdf.format(calendar.getTime())); OUTPUT 2014 mai 15 00:00:00 mai means may month in french.
upvote count: 1
answers question: http://stackoverflow.com/q/23676743
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36503739
has text: What line is throwing the out-of-bounds exception?
comment on: http://stackoverflow.com/q/23744845
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23755665
type: Answer
has comment: http://stackoverflow.com/comment/36529079
upvote count: 1
has body: XStream have dependencies on other libraries. Please make sure that you have xmlpull and xpp3_min in your classpath. It is easies to use Maven for that: com.thoughtworks.xstream xstream 1.4.7 Maven automatically resolve all the dependencies for you. Futhermore you have errors in your datamodel or xml. Please check class Boards { @XStreamImplicit(itemFieldName = "id") Either you set it in the datamodel to "ID" (uppercase) or to id (lowercase) in the xml. Please also check @XStreamAlias("camber") private String camber; Either you set the alias to "camber_profile" in the datamodel or to camber in the xml. Last but not least my advice to you is to use public void setIds(List<String> temp) { this.ids = new ArrayList<>(temp); } public List<String> getIds() { return Collections.unmodifiableList(ids); } When you return the reference of an internal list, the caller can arbitrary modify the list. This violates a good encapsulation.
score: 1
has comment: http://stackoverflow.com/comment/36529250
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23744756
answers question: http://stackoverflow.com/q/23744756
has comment: http://stackoverflow.com/comment/36526346

http://stackoverflow.com/comment/36319029
score: 0
type: Comment
type: QuestionComment
has text: Hope [This will][1] help you to resolve the issue. [1]: http://stackoverflow.com/questions/12223159/can-you-determine-which-database-vendor-is-used-from-a-sqlexception
comment on: http://stackoverflow.com/q/23648039

http://stackoverflow.com/comment/36444200
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23713453
has text: @user3580294: So, you don't think that counts as a *minor modification*?

http://stackoverflow.com/comment/36358679
score: 0
has text: Ok. Understood. Thank you! Question then: What method would I use to upload a .jar file to be executed from a web page? If any.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23664071

http://stackoverflow.com/q/23684514
has title: Spring Security + Container Managed Authentication issue
type: Question
tagged with: jakarta-ee
has body: I'm using Spring Security Framework + Spring MVC in order to build a secured web application. The authentication of my users must be handled by my container. I followed those 2 steps in order to achieve that: Secured my whole application in my web.xml file: FORM <web-resource-collection> Public Matches unconstrained pages /resources/* </web-resource-collection> <web-resource-collection> Secured Areas /* </web-resource-collection> Everyone Set up Spring Security with the following class: @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/resources/**").permitAll() .anyRequest().authenticated() .and() .jee().mappableRoles("Admin", "User"); } } This configuration seems to be working, for I have to authenticate whenever I try to access any URL within my application context except the static resources (in the /resources/ folder). Then after the login, the correct URL and page are shown (as expected). However, if I try to access another link, I have to log in again. Then, the correct URL and page are shown, and I can access any links without having to log in again. So, my question is: why do I have to log in twice in order not to be requested to log in again?
downvote count: 0
answer count: 1
tagged with: spring-security
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/29423678
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java

http://stackoverflow.com/a/23710137
has body: Instead of using a FileInputStream directly, wrap that in a BufferedInputStream, so that you don't allocate huge amounts of memory. A buffered input stream reads the data in segments, so you can encrypt that piece, and, if you are writing it back to a file, use a BufferedWriter to write that file in the same way.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36437505
answers question: http://stackoverflow.com/q/23710086
has comment: http://stackoverflow.com/comment/36438149
accepted answer of: http://stackoverflow.com/q/23710086
type: Answer
has comment: http://stackoverflow.com/comment/36438110
downvote count: 0
score: 1

http://stackoverflow.com/a/23692761
has body: You are indeed reading file incorrectly. You are ignoring the return value of the InputStream.read(). You should call this method in cycle because the individual call is not guaranteed to read the entire byte array. You can read it manually: int offset = 0; int read = _fileStream.read(_contents, 0, contents.length); while (read &gt; 0) { offset += read; read = _fileStream.read(_contents, offset , contents.length - offset ); } Or you can wrap the underlying input stream into DataInputStream and just use DataInputStream.readFully() method.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/84877496
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23691995
has comment: http://stackoverflow.com/comment/36413055
answers question: http://stackoverflow.com/q/23691995
upvote count: 2

http://stackoverflow.com/comment/36357126
type: AnswerComment
comment on: http://stackoverflow.com/a/23667238
has text: `f` is a precision ***suffix***. It means that the floating-point constant is single-precision. Without it, languages that are based on C (*e.g.* C++, Java, C#, GLSL) will *usually* (GLSL is the major exception to the rule ;P) assume that the constant is double-precision. Having the language assume double-precision is particularly annoying in the more type-safe C derivative languages.
type: Comment
score: 0

http://stackoverflow.com/comment/36414877
type: AnswerComment
has text: That doesn't make sense - even if you didn't explicitly set the built-in project properties, they would have non-null default values. Are you still trying to pull System properties instead of using `project`? Try adding this line to your build.gradle file and then run `gradlew x` from the command line and post your results: `task x << {println "$project.group $project.version"}`. At the very least it should print `<root_project_name> unspecified`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23681318

http://stackoverflow.com/comment/36258290
type: Comment
comment on: http://stackoverflow.com/a/23616215
has text: Yep that worked! But now I have an ArrayIndexOutofBound exception -_-. Thanks though!
type: AnswerComment
score: 0

http://stackoverflow.com/q/23707983
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/36433601
tagged with: java
tagged with: cascading
linked to: http://stackoverflow.com/q/4055780
has comment: http://stackoverflow.com/comment/36434137
tagged with: junit
has comment: http://stackoverflow.com/comment/36436634
has title: assertEquals not comparing HashSet java
linked to: http://stackoverflow.com/q/3692426
tagged with: hashset
has body: I am writing Unit test using Junit 4 to compare two List I have two lists of tuples of type java.util.List The tuple order can be different inside the List. I would like to compare these two Lists. What i have done assertEquals(new HashSet(List1), new HashSet(List2)); Assertion is failing saying junit.framework.AssertionFailedError: Expected :[2 second 38.46 162.417 361.583 112.331, 1 first 157.577 154.985 135.126 171.198] Actual :[2 second 38.46 162.417 361.583 112.331, 1 first 157.577 154.985 135.126 171.198] I can't see any difference between two, how to compare this? Edit: Even I am comparing like assertEquals(expectedCanonmap, getOutput(out)); it is saying junit.framework.AssertionFailedError: Expected :[1 first 157.577 154.985 135.126 171.198, 2 second 38.46 162.417 361.583 112.331] Actual :[1 first 157.577 154.985 135.126 171.198, 2 second 38.46 162.417 361.583 112.331]
has comment: http://stackoverflow.com/comment/36433635
score: 0
has comment: http://stackoverflow.com/comment/36433533
has comment: http://stackoverflow.com/comment/36433891
has comment: http://stackoverflow.com/comment/36436597
answer count: 0
duplicate of: http://stackoverflow.com/q/3692426
type: UnansweredQuestion

http://stackoverflow.com/comment/36415514
type: Comment
comment on: http://stackoverflow.com/a/23690047
score: 0
type: AnswerComment
has text: no, this doesn't matter, I can comments all the code inside method public void testvalidate(). still will get same error.

http://stackoverflow.com/q/23664111
has body: I have created a simple Web Portal using JSP/Servlets. It is connected to MySQL Database and basically the portal is just used to manage the records in the MySQL Database. I now want to expose REST APIs for anyone to retrieve and insert information into the MySQL database. Would I be able to do so using JSP/Servlets. It would be great to have suggestions.
tagged with: java
tagged with: mysql
type: Question
tagged with: jsp
has answer: http://stackoverflow.com/a/23665611
has answer: http://stackoverflow.com/a/23664810
tagged with: servlets
score: 0
answer count: 2
has title: Exposing REST interface from a JSP/Servlet Application
tagged with: rest
type: UnansweredQuestion

http://stackoverflow.com/q/23712137
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/23712202
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36441158
type: Question
score: -2
tagged with: game-engine
has title: Is it a good Idea to use a Game Structure Coding Style to build a simple system?
answer count: 1
has answer: http://stackoverflow.com/a/23712202
favorite count: 0
upvote count: 1
has body: Yes, as what I'm trying to think is that, for example I want to create a simple library system. but my question is it is a good idea to use a game structured system using rendering? Would it give give a performance issue? Also, since I want that system to be compatible with few operating system using libGDX.
type: AnsweredQuestion

http://stackoverflow.com/comment/36428699
has text: How,about (a) checking the response and (b) closing the connection... There are a lot of things that aren't covered in the code you've posted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23704721
score: 0

http://stackoverflow.com/q/23706992
score: 8
accepted answer: http://stackoverflow.com/a/23707024
has answer: http://stackoverflow.com/a/23707038
tagged with: portability
linked to: http://stackoverflow.com/q/10525603
has comment: http://stackoverflow.com/comment/36432081
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7679366
tagged with: java
has comment: http://stackoverflow.com/comment/36432025
has title: \n and \r seem to work everywhere. Why is line.separator more portable?
has body: I was just perusing through questions, and I found System.getProperty(line.separator) used in place of \n with the author's comment that the code was "portable". Reading through various forums, I've seen two groups: People who say there's a difference between Linux's and Windows' interpretation of newline characters, and this compensates for that (with no clear evidence). People who say there's no difference by showing code and output examples, which obviously only applies to that code example and not universally. My feeling is: it's probably non-standard OS's, like for example your company's industrial scanner's OS for example, where you'll notice a difference. When am I going to see a difference between \n and line.separator? Can you show an example, please? How did you go about discovering where the variation occurs?
type: Question
has answer: http://stackoverflow.com/a/23707040
has comment: http://stackoverflow.com/comment/36431861
linked to: http://stackoverflow.com/q/18741776
tagged with: newline
downvote count: 0
possible better answer: http://stackoverflow.com/a/23707040
favorite count: 0
tagged with: linefeed
has comment: http://stackoverflow.com/comment/36431752
upvote count: 8
has answer: http://stackoverflow.com/a/23707024
answer count: 3
has comment: http://stackoverflow.com/comment/36431759

http://stackoverflow.com/q/23630428
favorite count: 0
has comment: http://stackoverflow.com/comment/36283701
has answer: http://stackoverflow.com/a/23630576
tagged with: exception
has title: understanding throw keyword in JAVA
tagged with: throw
answer count: 4
possible better answer: http://stackoverflow.com/a/23631000
downvote count: 2
type: AnsweredQuestion
score: 3
has body: While going through Exception handling exercise in JAVA, I am bit confused about various things. Basically what I don't understand is how the flow of the program is when an exception is encountered. I would like to understand how actually the flow of the program takes place in following scenario and whether my understanding of the concepts is right or wrong. public void myFunction(){ try{ //Some code...... }catch(Exception e1){ //If this Exception is occured handle it here. }catch(Exception e2){ //if this exception has occured then throw new myException("whatever message required"); } finally{ //code that has to be executed } } Now what my understanding is: 1.If no exception is occurs then the code runs smoothly and eventually the code in the finally block gets executed 2.If exception e1 occurs then it is caught in first catch block , it is handled there appropriately and then finally block gets executed. 3.But what happens if exception e2 occurs. In that catch block we throw a new exception. So the method in which I call myFunction should provide some mechanism to handle this myException? So the execution will transfer to the catch block of the calling method.Right? So what will happen to the "finally" block of myFunction() ? it won't be executed then? How the flow of program takes place? I am really finding hard what happens when we use "throw". What really happens when we use it?
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23630560
has answer: http://stackoverflow.com/a/23630606
accepted answer: http://stackoverflow.com/a/23630606
type: Question
has answer: http://stackoverflow.com/a/23631000

http://stackoverflow.com/q/23743546
type: AnsweredQuestion
score: 1
tagged with: java
has title: Can JSP and Python used together for same database?
type: Question
has answer: http://stackoverflow.com/a/23743682
tagged with: database
upvote count: 3
answer count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/23743789
has body: I'm a student who work part-time at a start-up, which runs a website made with JSP. We are planning an android app in this summer and I'm considering developing it with Python, which I'm interested in. However, the service provided by the app is supposed to be added to the website made with JSP later. I'm afraid the difference of the language would cause any obstacle. Since they will use a common database, I think using different languages to access it won't have any problem. I want to make sure that my guess is correct. Pardon my poor English. I'd appreciate your answers.
has comment: http://stackoverflow.com/comment/36501933
tagged with: jsp
has comment: http://stackoverflow.com/comment/36501557
favorite count: 0
has answer: http://stackoverflow.com/a/23743789
tagged with: android
possible better answer: http://stackoverflow.com/a/23743682
tagged with: python

http://stackoverflow.com/comment/36549015
has text: I moved the target prpht0912.exe program and components to the java directory I'm using. That solved it. But if/when I need to use multiple directories I will go the ProcessBuilder route. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/23766279
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36370521
score: 0
type: Comment
type: QuestionComment
has text: Ideally MongoClient instantiation should authenticate the credentials. For some reason, It is not happening.
comment on: http://stackoverflow.com/q/23674054

apache-zookeeper
tags question: http://stackoverflow.com/q/23644316
tag name: apache-zookeeper
type: Tag

http://stackoverflow.com/a/23616425
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23616098
has body: All the element in hardware[] are initialize to null. You will need to store the reference of an object in your case Item() and then use the setter method. for(int i = 0; i &lt;= 5; i++) { hardware[i]=new Item(); hardware[i].setItemID(itemID[i]); hardware[i].setItemName(itemName[i]); hardware[i].setInStore(inStore[i]); hardware[i].setPrice(price[i]); }

http://stackoverflow.com/a/23718840
has body: This intersection_Union a= new intersection_Union(); should be List_intersection a= new List_intersection(); Logic in your List_intersection.Intersection seems to be correct.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23718798

http://stackoverflow.com/comment/36273448
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23624733
type: Comment
has text: Thanks! It works even as nested enum(at least compiles)

http://stackoverflow.com/comment/36364482
comment on: http://stackoverflow.com/q/23670266
type: QuestionComment
type: Comment
has text: Yes it is true that we can not overload operators in java. But some told me that it can be achieved with native methods. Does some one has any idea about it
score: 0

http://stackoverflow.com/comment/36536026
type: AnswerComment
has text: How do you check if window.SetVisible()?
type: Comment
comment on: http://stackoverflow.com/a/23760156
score: 0

http://stackoverflow.com/q/23775950
has comment: http://stackoverflow.com/comment/36564010
tagged with: android
type: AnsweredQuestion
has body: I'm designing function using AlertDialog to act like a InputBox in VB6. However using the code below, AlertDialog won't return values. Seems that the function returns before the user makes the input. public String InputBox(Context srcpage, String Msg, String Title, String InputDataType_TXT_or_NUM) { ResetReturnText(); AlertDialog.Builder dlgAlert = new AlertDialog.Builder(srcpage); dlgAlert.setMessage(Msg); dlgAlert.setTitle(Title); // Set an EditText view to get user input final EditText inputTxt = new EditText(srcpage); //Set the input type of the EditText //------------------------------------------------------- if(InputDataType_TXT_or_NUM=="TXT") inputTxt.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); else if(InputDataType_TXT_or_NUM=="NUM") inputTxt.setInputType(InputType.TYPE_CLASS_NUMBER); else return "Invalid Data Type"; //------------------------------------------------------- dlgAlert.setView(inputTxt); dlgAlert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { ReturnText = inputTxt.getText().toString(); } }); dlgAlert.setNegativeButton("Cancel",null); dlgAlert.create().show(); return ReturnText; } I Want these code to return values with function calls like: String NewProvince=""; NewProvince = InputBox(this, "Province:", "Add/Edit Province", "TXT"); Log.w("Input:",NewProvince); Can I ask you guys to help me with fixing this problem? Thanks!
tagged with: java
has answer: http://stackoverflow.com/a/23776807
type: Question
has title: AlertDialog with EditText, wait for user response
tagged with: eclipse
score: 0
accepted answer: http://stackoverflow.com/a/23776807
answer count: 1

http://stackoverflow.com/comment/36418627
has text: Double-tap the spacebar? Who said that? It would be a single press when the button has focus. This is standard desktop UI behavior, regardless of the language it's written in (Swing, Visual Basic, etc.). I'm not sure how standard out-of-the-box functionality (that's industry standard) would be confusing.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23700214
score: 0

http://stackoverflow.com/q/23712410
possible better answer: http://stackoverflow.com/a/23712471
tagged with: java
has answer: http://stackoverflow.com/a/23712471
type: Question
tagged with: performance
has title: Calling the function twice vs. storing the output and using it in Java
has answer: http://stackoverflow.com/a/23715893
has comment: http://stackoverflow.com/comment/36442021
score: 0
linked to: http://stackoverflow.com/q/375913
has answer: http://stackoverflow.com/a/23712588
tagged with: function-calls
answer count: 4
has answer: http://stackoverflow.com/a/23712440
accepted answer: http://stackoverflow.com/a/23712440
type: AnsweredQuestion
has body: Suppose that I have a boolean function isCorrect(Set&lt;Integer&gt;). The parameter of the function is calculated by another function buildSet(). Which one is better in terms of both time and space efficiency? Set&lt;Integer&gt; set = buildSet(); if(isCorrect(set)) doSomethingWith(set); or if(isCorrect(buildSet())) doSomethingWith(buildSet());
has comment: http://stackoverflow.com/comment/36441924

http://stackoverflow.com/q/23718297
has title: Filling Binary Tree Row by Row from Array
has body: How would one go about adding nodes to a binary tree row by row from an array? It's easy enough when elements are added in their proper position based on a key value of some sort, and I have attempted to assign keys to the values in the array in order to do the row by row adding, but I feel like there must be a more elegant way to do this. To clarify, what I want is to take an array and convert it into a tree like this _ _ _ 0 _ _ _ _ 1 _ _ _ 2 _ 3 _ 4 _ 5 _ 6 where the numbers represent the indices the values had in the initial array
type: Question
answer count: 1
downvote count: 0
tagged with: sorting
score: 1
accepted answer: http://stackoverflow.com/a/23750914
favorite count: 0
has comment: http://stackoverflow.com/comment/36453284
tagged with: binary-tree
has comment: http://stackoverflow.com/comment/36453255
has comment: http://stackoverflow.com/comment/36453222
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23750914
tagged with: java

http://stackoverflow.com/comment/36339673
type: Comment
comment on: http://stackoverflow.com/q/23658512
has text: I just restarted eclipse. It's working now. Thanks anyway.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36503456
has text: You are aware that the op asked for a pdfbox solution and you provide code using iText?
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23738744

http://stackoverflow.com/comment/36315842
type: Comment
comment on: http://stackoverflow.com/a/23624437
score: 0
type: AnswerComment
has text: Yes, youhave to die one death. But the issue is that your tests should not be that complicated. There must be a way to ease them. I never got into the problems you are describing. Maybe a redesign (of the tests) helps.

http://stackoverflow.com/comment/36328261
comment on: http://stackoverflow.com/q/23652644
type: Comment
type: QuestionComment
has text: @Pappu 1. :-) have to returns back to your [1st question](http://stackoverflow.com/questions/23648646/use-enter-key-act-like-tab-key-on-jtable), 2. don't to use `KeyListener` for `JTable`, this is major issue, 3. second is strange if inside `public void keyReleased(KeyEvent e) {`, to move everything those code lines to ListSelectionListener, because those event haven't something with KeyListener, 4. again don't to confuse users, Mouse and Key Events should be the same, otherwise you have to override Mouse Events too, to try to avoid to create a mess
score: 0

http://stackoverflow.com/comment/36348462
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23655604
type: Comment
has text: @owlstead with keying option 3, all keys are the same, so strength is 56 bits (see the Wikipedia article I linked to)

http://stackoverflow.com/a/40173070
type: Answer
has body: public class LeastRecentlyUsed { public static &lt;K, V&gt; Map&lt;K, V&gt; leastRecentlyUsedCache(final int maxSize) { return new LinkedHashMap&lt;K, V&gt;(maxSize , 0.7f, true) { private static final long serialVersionUID = -3588047435434569014L; @Override protected boolean removeEldestEntry(Map.Entry&lt;K, V&gt; eldest) { return size() &gt; maxSize; } }; } public static void main(String[] args) { Map&lt;Object, Object&gt; leastRecentlyUsed = LeastRecentlyUsed.leastRecentlyUsedCache(3); leastRecentlyUsed.put("Robert", "Raj"); leastRecentlyUsed.put("Auzi", "Aiz"); leastRecentlyUsed.put("Sandy", "S"); leastRecentlyUsed.put("Tript", "tty"); System.out.println(leastRecentlyUsed); } }
has comment: http://stackoverflow.com/comment/67614407
answers question: http://stackoverflow.com/q/23772102
score: 0

http://stackoverflow.com/a/23659746
score: 1
has body: All of these classes extend A, either directly or indirectly, therefore all their instances can be added to a List&lt;A&gt; instance. What exactly is it that you are asking?
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23659645
type: Answer

http://stackoverflow.com/q/23768741
score: 0
type: AnsweredQuestion
has body: At my university there is a Sun Grid Engine where I need to perform some tests on. These tests are written in Java an therefore I have created a JAR file which, by just executing it, starts the tests. The test reads in a file and performs some computation on it and at the end writes out a txt file with some results. However, every test is having different parameters which I pass in through the Main method of the JAR. After reading in the file, the parameters will give a different output. Now I wonder, is this possible to accomplish? Can I run the same JAR multiple times knowing that they all need to read in the same (so just one) file?
tagged with: java
accepted answer: http://stackoverflow.com/a/23830675
tagged with: sungridengine
type: Question
has title: Run single JAR simultanously on Sun-Grid Engine
answer count: 1
has answer: http://stackoverflow.com/a/23830675

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

http://stackoverflow.com/comment/36483682
has text: Yes, it is. I just want to expose the foriegn key in field.So I can seialize the object easier.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23733162
type: Comment

http://stackoverflow.com/q/23740022
has comment: http://stackoverflow.com/comment/36504889
type: UnansweredQuestion
tagged with: spring
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23752912
favorite count: 0
tagged with: spring-batch
has answer: http://stackoverflow.com/a/23740325
has title: How to get the number of items read in Spring Batch ItemReadListener
has body: In a Spring Batch application, I need to improve my reading error handling for a StaxEventItemReader. So far I get: public class UserAuthorizationErrorListener extends ItemListenerSupport&lt;UserAuthorizationType, UserAuthorizationType&gt; { @Override public void onReadError(Exception ex) { ex.printStackTrace(); //TODO how to get the position in the file ? or the current index of the item that raised this exception? } } And the spring configuration : &lt;step id="readFileStep" next="moveFileToFolderDecision"&gt; &lt;tasklet&gt; &lt;chunk reader="userAuthorizationMultipleResourcesReader" processor="userAuthorizationItemProcessor" writer="userAuthorizationCompositeItemWriter" commit-interval="2"&gt; &lt;listeners&gt; &lt;listener ref="userAuthorizationErrorListener" /&gt; &lt;/listeners&gt; &lt;/chunk&gt; &lt;/tasklet&gt; &lt;/step&gt; This is quite great, I am notified when and error occured. But I need to provide clever error reporting and give the index of the item that is in error. How can I get this information? Or how can I get the number of correctly read before the error occured ? Or how can I get the line number and the column number of the error? Edit I get stack trace like that: org.springframework.oxm.UnmarshallingFailureException: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException - with linked exception: [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[20,4] Message: The element type "Action" must be terminated by the matching end-tag "&lt;/Action&gt;".] at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:794) at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:715) But is it possible to avoid casting the Exception and parsing the error message to get the [row,col]:[20,4] information?
linked to: http://stackoverflow.com/q/23705400

http://stackoverflow.com/q/23728087
score: 0
has title: How to modify a field of a field of a .... As in link.next.next.next(.next*n) n times
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/23728088
duplicate of: http://stackoverflow.com/q/23718058
favorite count: 0
linked to: http://stackoverflow.com/q/23718058
type: UnansweredQuestion
tagged with: list
upvote count: 2
tagged with: java
downvote count: 2
type: Question
has body: I have an array which holds links. Each link has a public field called next which can hold another link, which can hold any more links ect. When I want to delete things I can do array[x].next = array[x].next.next; which would delete the 2nd item. But I want to be able to delete any item, so how can I get it into a form with variables? The equation would be something along these lines: If I wanna delete item n I would do array[x](.next*(n-1)) = array[x](.next*n); Which for n = 4 would exand to array[x].next.next.next = array[x].next.next.next.next; Hopefully my question is clear. I need to know how to do it this way as I cannot set a getter or any other code into my link class, and since Im the sole owner of my code I am not going to incorectly set my the field. Java.

http://stackoverflow.com/q/23696783
answer count: 1
accepted answer: http://stackoverflow.com/a/23705440
has title: Include login methods
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
has body: I got an entity User and i want every method of every controller to have the access to the logged user without typing anything like : model.addAttribute(userDao.getuser(principal.getUsername()));
upvote count: 1
has answer: http://stackoverflow.com/a/23705440
type: Question
tagged with: java
downvote count: 0

http://stackoverflow.com/q/23736422
has answer: http://stackoverflow.com/a/69180664
tagged with: one-to-many
has answer: http://stackoverflow.com/a/79389550
tagged with: many-to-one
type: UnansweredQuestion
upvote count: 18
has answer: http://stackoverflow.com/a/23736685
answer count: 4
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
has title: JPA Composite key with ManyToOne getting org.hibernate.PropertyAccessException: could not set a field value by reflection setter of
has body: I have a composite key ContractServiceLocationPK made out of three id's (contractId, locationId, serviceId) of type long in an embeddable class. The class which uses this composite key, ContractServiceLocation, maps these ids, using @MapsId annotation, to their objects. Here's how it looks like (removed setters/getters and irrelevant properties): Contract @Entity @Table(name = "Contract") public class Contract implements Serializable { public Contract() { } @Id @GeneratedValue private long id; @OneToMany(mappedBy = "contract", cascade = CascadeType.ALL, fetch= FetchType.EAGER) Collection&lt;ContractServiceLocation&gt; contractServiceLocation; } ContractServiceLocationPK @Embeddable public class ContractServiceLocationPK implements Serializable { private long contractId; private long locationId; private long serviceId; } ContractServiceLocation @Entity @Table(name="Contract_Service_Location") public class ContractServiceLocation implements Serializable { @EmbeddedId ContractServiceLocationPK id; @ManyToOne(cascade = CascadeType.ALL) @MapsId("contractId") Contract contract; @ManyToOne(cascade = CascadeType.ALL) @MapsId("locationId") Location location; @ManyToOne(cascade = CascadeType.ALL) @MapsId("serviceId") Service service; BigDecimal price; } When attempting to persist an object of type ContractServiceLocation in any way(directly or throught contract) I get: Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.test.model.ContractServiceLocationPK.contractId at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1187) at com.test.MainTest.mai…
tagged with: jpa
score: 18
has answer: http://stackoverflow.com/a/27467933
favorite count: 0

http://stackoverflow.com/q/23761680
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/38060157
type: UnansweredQuestion
has title: NetBeans: method auto completion of the variable in expression
tagged with: text-editor
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: autocomplete
downvote count: 0
has body: I have been experiencing many difficulties using NetBeans Developer Environment, but most annoying of all that I have faced, is that new feature (I think NetBeans 7.3+), that auto completes variable with method fitting the context of expression. What I am describing, you can easily see on screenshot below. http://s13.postimg.org/uvba2pzsn/netbeans.png (not enough reputation to post raw image) This is by far the most evilest thing I can imagine. Is there any reasonable way of disabling this (non)useful feature? Also I have recently discovered another misterious force, that prevent me from writing " (quote) symbol. After pushing the quote key with shift, instead of writing ", it forces me to push another key in order for it to be displayed (usage is similar to ~ [tilde] now). I have been on the vast majority of the websited proposed by Google, looking for similar problems. None of the solutions had application for my purposes. I would be grateful if some kind soul could help me find resolution for this problem, because I am not enough for this. Thanks in advance. // edit: I am still looking for answer and I tried virtually every option. Any ideas? AP
tagged with: code-completion

http://stackoverflow.com/comment/36289138
comment on: http://stackoverflow.com/q/23633134
has text: @user3421241 Why is this information in comment and not in question? You must know that not everyone read comments so if you have information relevant to question use edit option and add it to your post.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/23662863
accepted answer: http://stackoverflow.com/a/23675153
has comment: http://stackoverflow.com/comment/36350987
type: Question
has comment: http://stackoverflow.com/comment/36348660
has comment: http://stackoverflow.com/comment/36348277
answer count: 2
has comment: http://stackoverflow.com/comment/36378394
tagged with: jpa
downvote count: 0
tagged with: jsp
has title: speed up data access in a search form
has comment: http://stackoverflow.com/comment/36353517
has comment: http://stackoverflow.com/comment/36351438
has body: In a spring mvc app using hibernate and JPA, I have a keyword class which enables users to search records in an underlying database. The JSP has a search box in a dandelion datatable, and the user types in text to reduce the number of keyword options, until the search results contain a short-enough list of keywords from which the user can select the word to use for their search. The problem is that there are 80,000 keywords in the underlying data table, and it takes 20 minutes for my app to send all those keywords to the JSP, even after I put an index on the underlying database table for the field used in the search. Is there some way to set it up so that keywords are only sent to the JSP when at least 3 characters of text has been entered into the search box? Here is my controller method: @RequestMapping(value = "/search", method = RequestMethod.GET) public String processFindForm( ConcWordKey wordkey, HttpServletRequest request, BindingResult result, Map&lt;String, Object&gt; model) { Collection&lt;ConcWordKey&gt; results = this.clinicService.findKeyWord(""); System.out.println("results.size() is: "+results.size()); model.put("selections", results); return "search"; } And here is the relevant part of the JSP: &lt;datatables:table id="keywords" data="${selections}" cdn="true" row="kw" theme="bootstrap2" cssClass="table table-striped" paginate="true" info="false" cssStyle="width: 150px;" align="left" dom="frtp"&gt; &lt;datatables:column title="Name" cssStyle="width: 150px;" display="html"&gt; &lt;spring:url value="/search?name={name}" var="searchUrl"&gt; &lt;spring:param name="name" value="${kw.name}"/&gt; &lt;/spring:url&gt; &lt;a href="${fn:escapeXml(searchUrl)}"&gt;&lt;c:out value="${kw.name}"/&gt;&lt;/a&gt; &lt;/datatables:column&gt; &lt;/datatables:table&gt; Here is the JPA method that populates the selections: @SuppressWarnings("unchecked") public Collection&lt;ConcWordKey&gt; findKeyWord(String str) { Query query = this.em.createQuery("SELECT DISTINCT wk FROM …
score: 1
has comment: http://stackoverflow.com/comment/36351673
favorite count: 0
has comment: http://stackoverflow.com/comment/36351652
has answer: http://stackoverflow.com/a/23675153
possible better answer: http://stackoverflow.com/a/23663075
has answer: http://stackoverflow.com/a/23663075
upvote count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14619498
tagged with: java

http://stackoverflow.com/comment/36283649
score: 0
type: QuestionComment
has text: This is method **overloading**, yes
type: Comment
comment on: http://stackoverflow.com/q/23630462

http://stackoverflow.com/q/23704667
has body: I have 2 routes in Apache Camel, MultimapRoute (initializes a Multimap object on the start of the program, based on the results of a database query) and UpdatingRoute (a listener for updates to the database, where the Multimap object is updated when the database is updated). I would like to ensure that the MultimapRoute runs first and all the changes from the UpdatingRoute are processed in order. I would also like to ensure that all the concurrency issues are taken care of. Here is the MultimapRoute class: public class MultimapRoute implements org.apache.camel.Processor { static Multimap&lt;String, String&gt; m = new ArrayListMultimap&lt;String, String&gt;(); static ReentrantLock l = new ReentrantLock(); public void process(Exchange exchange) throws Exception { try { l.lock(); //Query the database and fill out the map initially } finally { if (l.isHeldByCurrentThread()) l.unlock(); } } } Here is the UpdatingRoute class: public class UpdatingRoute implements org.apache.camel.Processor { public void process(Exchange exchange) throws Exception { try { l.lock(); //Update the database based on latest event } finally { if (MultimapRoute.l.isHeldByCurrentThread()) MultimapRoute.l.unlock(); } } } I'm not sure what the thread safety, or other, problem is with this approach to multithreading, or how to make the program thread-safe. But I was told this was not the right way to handle multithreading for this particular application. Thanks so much for your help.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36428630
type: UnansweredQuestion
tagged with: multithreading
has title: Preventing concurrent modification to an object
tagged with: java
has comment: http://stackoverflow.com/comment/36488987
has comment: http://stackoverflow.com/comment/36431961
type: Question
has answer: http://stackoverflow.com/a/23705161
has comment: http://stackoverflow.com/comment/36428210
tagged with: apache-camel

c++
tags question: http://stackoverflow.com/q/23738010
tags question: http://stackoverflow.com/q/23684400
tags question: http://stackoverflow.com/q/23627989
tags question: http://stackoverflow.com/q/23696873
type: Tag
tags question: http://stackoverflow.com/q/23627732
tags question: http://stackoverflow.com/q/23638794
tags question: http://stackoverflow.com/q/23744298
tags question: http://stackoverflow.com/q/23757428
tags question: http://stackoverflow.com/q/23698478
tags question: http://stackoverflow.com/q/23716064
tags question: http://stackoverflow.com/q/23721933
tags question: http://stackoverflow.com/q/23669673
tags question: http://stackoverflow.com/q/23640341
tags question: http://stackoverflow.com/q/23633511
tags question: http://stackoverflow.com/q/23629031
tags question: http://stackoverflow.com/q/23777389
tags question: http://stackoverflow.com/q/23677931
tag name: c++
tags question: http://stackoverflow.com/q/23763869

http://stackoverflow.com/q/23735163
has body: I know that this is question had been asked several time, but I saw that the answer always change in relation to the code. So, I have GameActivity that retrieve informations from a database in the global "info" variable, that is a String[]. Next I need to replace the current fragment with another fragment in relation to the button pressed (see methods "trueAnswer" and "falseAnswer"), and set two TextViews of that new fragment with the informations retrieved in the "info" string array. The problem is that I'm able to set the informations the first time, in the first fragment in the method onStart() when the activity is created, but then seems like the "info" array is empty, because the "if" in the methods "trueAnswer" and "falseAnswer" doesn't works, and when I try to set the TextViews in the new fragment with the method "changeText(String, String)", the app crashes and return a NullPointerExeption. I can't really see where is the error in the code, so I post here my methods and the logCat, hoping that may help you too. GameActivity: import java.io.IOException; import android.content.SharedPreferences; import android.database.SQLException; import android.graphics.Color; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; public class GameActivity extends ActionBarActivity { public long n = 0; public String[] info = new String[3]; DataBase myDbHelper = new DataBase(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); if (savedInstanceState == null) { …
tagged with: sqlite
has comment: http://stackoverflow.com/comment/36485390
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/23735250
has comment: http://stackoverflow.com/comment/36485467
possible better answer: http://stackoverflow.com/a/23735266
score: 0
tagged with: java
answer count: 2
has title: Android - IllegalStateException: could not execute method of the activity
has answer: http://stackoverflow.com/a/23735266
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23735250
linked to: http://stackoverflow.com/q/12739909
type: AnsweredQuestion

http://stackoverflow.com/comment/36298712
has text: What is the point of this? I mean you will most likely needed different codes for downloaded layouts. What about something like this ? http://stackoverflow.com/questions/23586899/layoutinflater-performance/23587191#23587191
type: QuestionComment
comment on: http://stackoverflow.com/q/23637615
type: Comment
score: 0

http://stackoverflow.com/a/23656201
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Please note that, as this question is extremely broad, my answer is merely a set of suggestions towards an overall design. First, we'll begin with how Jena does it. Apache Jena stores its rule files as classpath resources within its distribution jars. jena-core has a package (directory) called etc in which it stores several rules files. The reasoners that Jena has implemented are effectively just the GenericRuleReasoner with a specific rule set. For example, FBRuleReasoner#loadRules() method is used to retrieve the ruleset that this reasoner will utilize. You should look at where it is called from in order to figure out how you would use such a paradigm. In your system, I'd suggest constructing your own implementation of ReasonerFactory (let's call it MyReasonerFactory). In MyReasonerFactory, you could have a static initialization block that will register the Builtins for your domain-specific reasoner. When someone calls ReasonerFactory#create(Resource), you can load your rules from the classpath and then create a GenericRuleReasoner that utilizes those rules. Some pseudo-code (that may not compile) follows: public class MyReasonerFactory implements ReasonerFactory private static final String RULE_LOC = "/some/directory/in/my/jar/filename.extensiondoesntmatter"; static { // register your builtins } @Override public RuleReasoner create(Resource r) { final GenericRuleReasoner reasoner = new GenericRuleReasoner(this, r); reasoner.setRules(FBRuleReasoner.loadRules(RULE_LOC)); return reasoner; } @Override public String getUri() { return "urn:ex:yourReasoner"; } @Override public Model getCapabilities() { // Your capabilities are identical to GenericRuleReasoner's return GenericRuleReasonerFactory.theInstance().getCapabilities(); } }
has comment: http://stackoverflow.com/comment/36393748
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23640770
accepted answer of: http://stackoverflow.com/q/23640770

http://stackoverflow.com/comment/36303670
comment on: http://stackoverflow.com/q/23638579
type: Comment
type: QuestionComment
has text: Running the script directly from bash works. I also tried adding the full path to bash in the commandline parameter string.
score: 0

http://stackoverflow.com/q/23638689
tagged with: android
has answer: http://stackoverflow.com/a/23639812
type: AnsweredQuestion
has title: lazylist adapter issue while scrolling
has body: public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; View vi= convertView; if(convertView==null){ viewHolder = new ViewHolder(); vi = inflater.inflate(R.layout.list_row, null); viewHolder.content = (TextView)vi.findViewById(R.id.f_content); viewHolder.cat_id = (TextView)vi.findViewById(R.id.c_id); viewHolder.fact_id = (TextView)vi.findViewById(R.id.f_id); vi.setTag(viewHolder); }else{ viewHolder = (ViewHolder) convertView.getTag(); } HashMap&lt;String, String&gt; fact = new HashMap&lt;String, String&gt;(); fact = data.get(position); // Setting all values in listview viewHolder.fact_id.setText(fact.get("_id")); viewHolder.cat_id.setText(fact.get("cat_id")); viewHolder.content.setText(fact.get("fact_content")); return vi; } I have created a LazyAdapter that extends a BaseAdaper to use with ListView. The this adapter populates data in ListView. When I click on first 4 visible list items it prints the value of that item. Problem is when I scroll down the list view and click on item 5. The app crashes saying null pointer exception. Log trace is here for reference. 05-13 23:10:43.943: E/AndroidRuntime(3360): FATAL EXCEPTION: main 05-13 23:10:43.943: E/AndroidRuntime(3360): java.lang.NullPointerException 05-13 23:10:43.943: E/AndroidRuntime(3360): at com.example.facts.MainActivity$3.onItemClick(MainActivity.java:100) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.widget.ListView.performItemClick(ListView.java:3569) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1831) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.os.Handler.handleCallback(Handler.java:587) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.os.Handler.dispatchMessage(Handler.java:92) 05-13 23:10:43.943: E/AndroidRuntime(3360): at android.os.Looper.loop(Looper.java:150)…
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23639812
has comment: http://stackoverflow.com/comment/36301797
tagged with: eclipse
tagged with: listview
score: 0
answer count: 1
tagged with: listadapter
has comment: http://stackoverflow.com/comment/36301238

http://stackoverflow.com/comment/36468356
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23725944
has text: If you want to do more than just check theses stats no, you can't.
score: 0

http://stackoverflow.com/q/23715194
has comment: http://stackoverflow.com/comment/100969815
has title: java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation
type: Question
has body: Right my app reports this crash every single day and it's resulting in a lot of uninstallers, which i don't like, now I've looked everywhere and all i know is that it's a very wide spread problem and it could also be a problem on Google's side but i just haven't been able to get real answers or solutions! so this is pretty much my last chance because like i said, it happens every single day! Here's the LogCat: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.simplistic.floating_equalizer/com.simplistic.floating_equalizer.MainActivity}: java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520) at android.app.ActivityThread.access$600(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:5751) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.UnsupportedOperationException: AudioEffect: invalid parameter operation at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1244) at android.media.audiofx.Equalizer.setBandLevel(Equalizer.java:230) at com.simplistic.floating_equalizer.model.EqualizerApi.setBandLevel(EqualizerApi.java:122) at com.simplistic.floating_equalizer.model.Profile.loadSettings(Profile.java:125) at com.simplistic.floating_equalizer.MainActivity.onCreate(MainActivity.java:160) at android.app.Activity.performCreate(Activity.java:5165) at android.app.Instrumentation.callActivityOnCreat…
has comment: http://stackoverflow.com/comment/82787150
downvote count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/59875640
tagged with: equalizer
has comment: http://stackoverflow.com/comment/68898187
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/41983454
type: UnansweredQuestion
tagged with: audioeffect
upvote count: 1
tagged with: audio
has comment: http://stackoverflow.com/comment/36447096
score: 1
tagged with: java

http://stackoverflow.com/a/23686026
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23684863
has body: According to the TitledPane's Substructure, the title is a HBox. So we can lookup it and hide then: Platform.runLater(new Runnable() { @Override public void run() { Pane title = (Pane) titledPane.lookup(".title"); if (title != null) { title.setVisible(false); } } }); It should be run in Platform.runLater(...) after the scene constructed and rendered.
has comment: http://stackoverflow.com/comment/68560728
answers question: http://stackoverflow.com/q/23684863
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/36445240
type: QuestionComment
has text: I'm new to Java, so I'm not sure how to do that
type: Comment
comment on: http://stackoverflow.com/q/23714267
score: 0

http://stackoverflow.com/comment/36555513
type: Comment
type: AnswerComment
has text: Many containers require an explicit "deploy war" procedure. Others (like Tomcat and JBoss), support "automatic deploys" you can simply drag/drop the war into a "deploy" folder. Q: What's your App server? Q: What specific problems are you encountering?
comment on: http://stackoverflow.com/a/23747814
score: 0

http://stackoverflow.com/q/23677556
tagged with: weblogic
tagged with: ant
tagged with: java
has title: unable to access selected application error in weblogic console
type: Question
upvote count: 1
favorite count: 0
answer count: 0
downvote count: 0
has body: i am getting following error in weblogic.xml cvc-complex-type.2.4.a invalid content was found starting with element context-root code at error line /car this is my weblogic.xml <?xml version="1.0" encoding="UTF-8"?> <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd"> <wls:virtual-directory-mapping> <wls:local-path>/tar2data/feeds/bar</wls:local-path> <wls:url-pattern>*.csv</wls:url-pattern> </wls:virtual-directory-mapping> /car <wls:container-descriptor> <wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled> </wls:container-descriptor> </wls:weblogic-web-app> Thanks in advance.
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36406583

http://stackoverflow.com/q/23745884
score: 3
answer count: 1
downvote count: 0
has title: Odd behavior reading SSL socket Java
favorite count: 0
type: AnsweredQuestion
has body: I am trying to write a simple echo server using SSL. The first line that goes to the server is echoed exactly. When I send a second line, only the first character is echoed. The client works off of a buffered reader's read line from stdin. If I hit CR again the rest of the message comes through. The server seems to be sending all of the data. Here are output from client and server: CLIENT: Sending to server at 192.168.0.161 on port 9999 4 seasoNS echo:4 seasoNS are really good echo:a echo:re really good SERVER: server listening on 9999 has cr/lf 4 seasoNS size to send: 10 has cr/lf are really good size to send: 16 exiting... Here is the client loop: try { BufferedReader consoleBufferedReader = getConsoleReader(); sslsocket = getSecSocket(strAddress, port); BufferedWriter sslBufferedWriter = getSslBufferedWriter(sslsocket); InputStream srvrStream = sslsocket.getInputStream(); String outMsg; while ((outMsg = consoleBufferedReader.readLine()) != null) { byte[] srvrData = new byte[1024]; sslBufferedWriter.write(outMsg); sslBufferedWriter.newLine(); sslBufferedWriter.flush(); int sz = srvrStream.read(srvrData); String echoStr = new String(srvrData, 0, sz); System.out.println("echo:" + echoStr); } } catch (Exception exception) { exception.printStackTrace(); } This problem seemed so odd that I was hoping there was something obvious that I was missing.
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23746418
type: Question
linked to: http://stackoverflow.com/q/15224909
tagged with: ssl
accepted answer: http://stackoverflow.com/a/23746418

http://stackoverflow.com/a/23761103
answers question: http://stackoverflow.com/q/23760998
score: 0
has body: Try this try { if (a != null &amp;&amp; a.length != 0 &amp;&amp; b != null &amp;&amp; b.length != 0 &amp;&amp; b != null &amp;&amp; b.length != 0) { mSolution.setText(s.solve(Double.valueOf(a), Double.valueOf(b), Double.valueOf(c))); } } catch (NumberFormatException e) { e.printStackTrace(); }
type: Answer

http://stackoverflow.com/a/23732105
upvote count: 1
answers question: http://stackoverflow.com/q/23731321
type: Answer
downvote count: 0
score: 1
has body: Are you looking to put foreground images into a background image? If yes, then the following code will help: public class Image { public static void main(String args[]) throws IOException { BufferedImage bgImage = ImageIO.read(new File("1.jpg")); BufferedImage fgImage =ImageIO.read(new File("2.jpg")); BufferedImage overlayedImage = overlay(bgImage, fgImage); if (overlayedImage != null) { File outputfile = new File("3.jpg"); ImageIO.write(overlayedImage, "jpg", outputfile); } else {} } public static BufferedImage overlay(BufferedImage bgImage, BufferedImage fgImage) { Graphics2D g = bgImage.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(bgImage, 0, 0, null); g.drawImage(fgImage, 0, 0, null); g.dispose(); return bgImage; } }

http://stackoverflow.com/q/23675508
type: Question
has body: I have developed an app that uses BroadcastReceiver class to check if the Wifi state has changed. The code is given below. public class NetworkChangeReceiver extends BroadcastReceiver { public static boolean isWifiConnected = true; public static final String tag = "NETWORKCHANGERECEIVER"; @Override public void onReceive(final Context context, final Intent intent) { ConnectivityManager connec = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connec.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifi.isConnected()) { final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null &amp;&amp; !(connectionInfo.getSSID().equals(""))) { String ssid = connectionInfo.getSSID(); Log.i("SSID",ssid); } isWifiConnected = true; Log.i("wifi", "connected"); } else { Log.i("wifi", "not connected"); isWifiConnected = false; } } } I registered the receiver in manifest.xml as follows : &lt;receiver android:name=".NetworkChangeReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; Everything works perfectly as expected. Now I want that this receiver should work only when a checkbox is checked and should get disabled when it is unchecked. How do I achieve this? wifibox = (CheckBox)findViewById(R.id.checkBox1); wifibox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) { if(buttonView.isChecked()){ // The receiver should get activated now. } else{ // The receiver should get de-activated now. } }
has answer: http://stackoverflow.com/a/23676183
answer count: 2
linked to: http://stackoverflow.com/q/5624470
has title: Register a Receiver when checkbox is checked in android
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23676183
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23675784
accepted answer: http://stackoverflow.com/a/23675784
upvote count: 1
has comment: http://stackoverflow.com/comment/36372024

http://stackoverflow.com/comment/108400326
comment on: http://stackoverflow.com/a/23701589
type: AnswerComment
has text: Replay the sample online with https://repl.it/@SmaMa/DistinctListByProperty
score: 0
type: Comment

http://stackoverflow.com/a/23628860
answers question: http://stackoverflow.com/q/23628774
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36280868
has body: Prefer using the AsyncTask when programming for Android. new AsyncTask&lt;Void,Void,Void&gt;(){ @Override protected Void doInBackground(Void ... params){ doLongTask(); return null; } }.execute();

http://stackoverflow.com/q/23618361
possible better answer: http://stackoverflow.com/a/35412860
has answer: http://stackoverflow.com/a/35412860
has comment: http://stackoverflow.com/comment/36275026
accepted answer: http://stackoverflow.com/a/23618475
favorite count: 0
score: 6
has title: Using Lambda Expression in an Action Listener
tagged with: lambda
tagged with: java-8
upvote count: 6
has body: We are using some socket API in Java that use extensively ActionListeners. For example: SocketServer server = SocketFactory.create().addListener(8888, "localhost") .setHandler(new SocketHandler() { public void handle(final ServerExchange exchange) throws Exception { exchange.send("Hello World"); } }).create(); I'd like to start simplifying part of this code using Lambda expressions. So I started rewriting the above example using: SocketServer server = SocketFactory.create().addListener(8888, "localhost") .setHandler(new SocketHandler() { exchange -&gt; { exchange.send("Hello World"); } }).create(); However Eclipse (Luna with JDK1.8 support) complains that the method handle(..) is not implemented. Yet using the handle method is exactly what I'd like to avoid implementing.... Any idea how can I fix it ? Thanks! UPDATE: Thanks for your reply. Well SocketHandler is an interface, however I've wrapped it now in a functional interface as follows: @FunctionalInterface public interface SimpleFuncInterface extends SocketHandler{ void handle(ServerExchange exchange) throws Exception; } Now my code looks like this: SocketServer server = SocketFactory.create().addListener(8080, "localhost") .setHandler(doWork(() -&gt; exchange.send("Hello World"))).create(); server.start(); } private static void doWork(SimpleFuncInterface itf) { } The code seems error free now, however the compiler complains that Lambda expression signature does not match the signature of the functional interface method handle(ServerExchange). Any suggestion ?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23618475
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23687014
has title: Unexplainable behavior of a double
score: -3
type: Question
linked to: http://stackoverflow.com/q/13668007
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36397291
upvote count: 0
has comment: http://stackoverflow.com/comment/36394389
answer count: 1
has answer: http://stackoverflow.com/a/23687188
accepted answer: http://stackoverflow.com/a/23687188
has comment: http://stackoverflow.com/comment/36394246
has comment: http://stackoverflow.com/comment/36394287
favorite count: 0
type: AnsweredQuestion
has body: I currently programming some calculations and found a weird issue, which I cannot explain. I'm doing a calculation which I save in a new double field. The thing is, that the finally saved value is not the same than the solution of the formula. I made a screenshot for better understanding. When I put the whole calculation in a watch, I get the result "1.3050....." When i check the double afterwards, it has saved "2.87......." which I have no idea, where that comes from. Does anybody know, why it is behaving like this? For me thats absolutely unexplainable... Full size: https://i.sstatic.net/8nJpn.png
has comment: http://stackoverflow.com/comment/36394370
tagged with: double

http://stackoverflow.com/comment/36524193
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23742385
has text: One approach that I see is use two column layout (like 30-70), first column can be used to place web content and second column to place your portlets one below other in the order to match your requirement.
type: AnswerComment

http://stackoverflow.com/a/23639404
answers question: http://stackoverflow.com/q/23639289
has body: You can use an implementation of the List interface, like ArrayList for this case. It will resize automatically when it almost fills so you don't have to worry about figuring the right initial size. You use it like this: .... /*step 2: Tokenize all documents and create vocabulary from it*/ int i=0; List&lt;String&gt; word = new ArrayList&lt;String&gt;(); // how to do dynamic allocation here int no_of_tokens=0; .... while(st.hasMoreTokens()) { word.add(st.nextToken()); System.out.print(word.get(no_of_tokens) + "\n"); no_of_tokens++; }
score: 0
type: Answer

http://stackoverflow.com/a/23627521
answers question: http://stackoverflow.com/q/23627485
upvote count: 3
has comment: http://stackoverflow.com/comment/36278848
has comment: http://stackoverflow.com/comment/36278580
has comment: http://stackoverflow.com/comment/36278455
has comment: http://stackoverflow.com/comment/36278485
type: Answer
score: 3
downvote count: 0
has body: The Math class in Java is final and therefore you can't extend it. Since all of it's method are static, I'd suggest to import it like: import static java.lang.Math.*;
has comment: http://stackoverflow.com/comment/36278651

http://stackoverflow.com/q/23692732
has answer: http://stackoverflow.com/a/23692790
favorite count: 0
has comment: http://stackoverflow.com/comment/36405541
has answer: http://stackoverflow.com/a/23692972
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36405633
has comment: http://stackoverflow.com/comment/36405466
has answer: http://stackoverflow.com/a/23693241
answer count: 4
has comment: http://stackoverflow.com/comment/36405492
has answer: http://stackoverflow.com/a/23692830
tagged with: java
has comment: http://stackoverflow.com/comment/36405600
has comment: http://stackoverflow.com/comment/36405702
type: Question
has body: In this problem I tried to reproduce Project Euler results in Java but, ultimately I have given up after several failed attempts and hours of work. The program compiles but, I have no idea why it won't go through my if statements. This is not for a class but, for myself. Here is project Euler's Prompt: "If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23." Here is my attempt: public class MultiplesOfThreeandFive { public static void main(String [] args) { int x = 3; int y = 10; if (y &gt; 0) { if (y % x == 0) { System.out.println(y + " is a multiple of 3"); y--; } else { System.out.println(y + " is not a multiple of 3"); y--; } } } }
has comment: http://stackoverflow.com/comment/36405645
has title: New to Java and I am attempting to program a Project Euler Q with recursion
has comment: http://stackoverflow.com/comment/36406420
score: 0
has comment: http://stackoverflow.com/comment/36405551
has comment: http://stackoverflow.com/comment/36405488

http://stackoverflow.com/q/23749844
has comment: http://stackoverflow.com/comment/36513718
has comment: http://stackoverflow.com/comment/36513760
has body: I had a working eclipse configuration, but I accidentally deleted that whole eclipse set up. I tried downloading newer eclipse (seeing as I couldn't recall the eclipse version I had), and it functions, however it has a really strange, and really annoying behavior; when hit the debug button it runs right through, but when I set a break point it seems to stop at the break point, but doesn't indicate it anywhere in the program. It doesn't show the line with a green highlight as it usually should. Perhaps it has something to do with my JRE/JDK? I tried the different JRE versions 6-8. Maybe it has to do with my debug configuration. Any help on your experience with or understanding of debugging would be greatly appreciated. Here is what happens when I click the debug button:
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/36513632
tagged with: debugging
tagged with: java
has comment: http://stackoverflow.com/comment/36513812
has comment: http://stackoverflow.com/comment/36515307
has comment: http://stackoverflow.com/comment/36513675
tagged with: eclipse
score: 0
has title: Eclipse Debugging Not Showing
has comment: http://stackoverflow.com/comment/36513687
type: UnansweredQuestion

http://stackoverflow.com/comment/36549048
has text: I'm not working with classes thought, but with compilation units.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23766576
score: 1

http://stackoverflow.com/a/23734562
has comment: http://stackoverflow.com/comment/36484764
type: Answer
answers question: http://stackoverflow.com/q/23721320
has comment: http://stackoverflow.com/comment/36515658
has comment: http://stackoverflow.com/comment/36514066
has body: I am not sure about the data source... However I have tried to solve your problem As far as possible. Please change it wherever you need. try { response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("Content-Disposition", "attachment; filename="+ ReportID + ".xlsx"); String excelFileName = "C:\\Test.xlsx"; XSSFWorkbook w = new XSSFWorkbook(); System.out.println("w: " + w); XSSFSheet s = w.createSheet(ReportID); System.out.println("s: " + s); // Report Title s.createRow(0).createCell(0).setCellValue(Title); System.out.println("Title: " + Title); // Populate the worksheet int _col_cnt = HeadersLabel.length; XSSFRow row = s.createRow(_col_cnt); System.out.println("HeadersLabel: " + _col_cnt); //For Headers int headerRowNum = 2; //for App, ShortName, LongName XSSFRow currentRow = s.createRow(headerRowNum); for(int headerCol =0; headerCol &lt;_col_cnt; headerCol++){ currentRow.createCell(headerCol).setCellValue(HeadersLabel[headerCol]); } // for Date entry for(int dataRow=3;dataRow &lt; 20;dataRow++){ currentRow = s.createRow(dataRow); for(int colNum=0;colNum&lt;_col_cnt;colNum++){ XSSFCell currentCell =currentRow.createCell(colNum); if (CellDataType[c].equals("STRING") || CellDataType[c].equals("VARCHAR")) { String _l = (String) _o[c]; if (_l != null) { currentCell.setCellValue(_l); } } else if (CellDataType[c].equals("DOUBLE")) { Double _D = (Double) _o[c]; if (_D != null) { currentCell.setCellValue(_D); } } else if (CellDataType[c].equals("INTEGER")) { Integer _I = (Integer) _o[c]; if (_I != null) { currentCell.setCellValue(_I); } } else if (CellDataType[c].equals("DATE")) { Date _aDate = (Date) _o[c]; if (_aDate != null) { currentCell.setCellValue(_aDate); } } else if (CellDataType[c].equals("TIMESTAMP")) { Timestamp _aTimestamp = (Timestamp) _o[c]; Date _aDate = Timestamp2Date(_aTimestamp); if (_aDate != null) { currentCell.setCellValue(_aDate); } } } } } }
score: 0
has comment: http://stackoverflow.com/comment/36518743
has comment: http://stackoverflow.com/comment/36485743
has comment: http://stackoverflow.com/comment/36512981

http://stackoverflow.com/q/23737813
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23737847
has title: Passing null reference in a method parameter in java?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1545501
score: 4
duplicate of: http://stackoverflow.com/q/1545501
upvote count: 4
has body: When i run this code the output is "String"; if I hide the method that accepts a String parameter and run the code again then the output is "Object", so can anyone please explain me how this code works? public class Example { static void method(Object obj) { System.out.println("Object"); } static void method(String str) { System.out.println("String"); } public static void main(String args[]) { method(null); } }
has comment: http://stackoverflow.com/comment/36490545
downvote count: 0
answer count: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/a/23628782
upvote count: 2
has comment: http://stackoverflow.com/comment/36280708
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23628746
accepted answer of: http://stackoverflow.com/q/23628746
downvote count: 1
type: Answer
score: 1
has body: you can use FileFilter with FileNameExtensionFilter. here is a sample code. JFileChooser chooser = new JFileChooser("."); FileFilter type1 = new FileNameExtensionFilter("Images", "jpg", "png", "JPG", "PNG"); FileFilter type2 = new FileNameExtensionFilter("PDF Documents", "pdf"); FileFilter type3 = new FileNameExtensionFilter("All Files", "."); chooser.addChoosableFileFilter(type1); chooser.addChoosableFileFilter(type2); chooser.addChoosableFileFilter(type3); chooser.setFileFilter(type1); // Initial filter setting chooser.setFileFilter(type2); chooser.setFileFilter(type3); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); int status = chooser.showOpenDialog(this); if (status == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); lblFileName.setText(f.toString()); if (chooser.getFileFilter() == type1) { //you can add code for file type 1 } else if (chooser.getFileFilter() == type2) { //you can add code for file type 2 } }

http://stackoverflow.com/comment/36452163
type: Comment
type: AnswerComment
has text: What's the difference between this and `e.printStackTrace();`?
comment on: http://stackoverflow.com/a/23717752
score: 0

http://stackoverflow.com/comment/36303928
has text: I have added the pictures of errors which I am getting while compiling the program. I am using javac command for compiling the code
comment on: http://stackoverflow.com/q/23640196
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37101632
type: Comment
comment on: http://stackoverflow.com/a/23734797
score: 0
type: AnswerComment
has text: I'm on Windows my host file says: `127.0.0.1 localhost` and `::1 localhost` and when i try pinging localhost and 127.0.0.1 all works, so this shouldn't be the issue, also i've monitored this issue on more than one machine...

http://stackoverflow.com/comment/36420747
type: AnswerComment
has text: Are you sure that the value between ( ) is the milliseconds value ? I can get the date from milliseconds and actually i need the milliseconds only.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23701407

http://stackoverflow.com/a/23723556
has comment: http://stackoverflow.com/comment/36469036
has comment: http://stackoverflow.com/comment/36492972
has comment: http://stackoverflow.com/comment/36814477
has comment: http://stackoverflow.com/comment/36490439
has comment: http://stackoverflow.com/comment/36464250
has comment: http://stackoverflow.com/comment/36821099
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36492621
has comment: http://stackoverflow.com/comment/36999469
type: Answer
score: 3
upvote count: 3
has body: I see what the problem is, please open a JIRA issue. The issue is the CALLER_RUNS rejection policy with a 0 length queue in the executor. There is one thread that handles all IO events (usually myTaskExecutor-1); when a read event fires he queues an execution to read the data; the reader thread queues an execution to assemble the data (which will block until a complete message - in your case terminated by the CRLF - arrives). In this case, when there are no threads available, the CALLER_RUNS policy means the IO selector thread does the read, and becomes the assembler thread, which blocks waiting for data that won't arrive because he is blocked and would later have read the data after scheduling a different thread to block. Because he is blocked, he can't handle new accept events. Here is a log from my test showing the issue... TRACE: [May-18 10:43:38,923][myTaskExecutor-1] tcp.connection.TcpNioServerConnectionFactory - Port 60000 SelectionCount: 2 DEBUG: [May-18 10:43:38,923][myTaskExecutor-1] tcp.connection.TcpNioConnection - localhost:58509:60000:bdc36c59-c31b-470e-96c3-6270e7c46a2f Reading... DEBUG: [May-18 10:43:38,924][myTaskExecutor-1] tcp.connection.TcpNioConnection - localhost:58509:60000:bdc36c59-c31b-470e-96c3-6270e7c46a2f Running an assembler TRACE: [May-18 10:43:38,924][myTaskExecutor-1] tcp.connection.TcpNioConnection - localhost:58509:60000:bdc36c59-c31b-470e-96c3-6270e7c46a2f Nio message assembler running... DEBUG: [May-18 10:43:38,926][myTaskExecutor-1] tcp.serializer.ByteArrayCrLfSerializer - Available to read:0 The second line shows the selector thread being used to do the read; he detects that an assembler is needed for this socket, and becomes the assembler, blocking, waiting for data. Do you really believe there will be an issue using an unbounded task executor? These events are generally pretty short lived so threads will be recycled pretty quickly. Increasing the executor's queue capacity above 0 should help too, but it won't completely assure…
has comment: http://stackoverflow.com/comment/36489628
accepted answer of: http://stackoverflow.com/q/23716830
has comment: http://stackoverflow.com/comment/36493148
has comment: http://stackoverflow.com/comment/36822321
answers question: http://stackoverflow.com/q/23716830

http://stackoverflow.com/comment/36571502
has text: IIRC, the row style won't apply to cells with content in - what happens if you also set that style on your cells as well?
score: 3
comment on: http://stackoverflow.com/q/23778189
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36512153
comment on: http://stackoverflow.com/q/23748242
type: QuestionComment
score: 0
has text: I would recommend that you put some log statements with if else condition just before you hit the for loop. Also add a log statement just inside the for loop again in a if else condition. Lost of times when we think our code is working certain way it's not. I hope it helps :)
type: Comment

http://stackoverflow.com/a/23664836
has body: Use the array lengths and String lengths in your for loops to avoid going past the boundaries: for(int i=0; i &lt; st.length &amp;&amp; i &lt; st1.length; i++) { for(int j=0;j&lt; st[i].length() &amp;&amp; j &lt; st1[i].length(); j++){ if(st[i].charAt(j)!= st1[i].charAt(j)) x++; } }
score: 0
answers question: http://stackoverflow.com/q/23664142
type: Answer

http://stackoverflow.com/q/23748976
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36512632
has comment: http://stackoverflow.com/comment/36512190
tagged with: quicksort
has comment: http://stackoverflow.com/comment/36512480
accepted answer: http://stackoverflow.com/a/23749499
has title: Simple QuickSort implementation with first element pivot and brute-force counting comparisons
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36512590
tagged with: java
has comment: http://stackoverflow.com/comment/36512074
has comment: http://stackoverflow.com/comment/36512684
has answer: http://stackoverflow.com/a/23749499
has comment: http://stackoverflow.com/comment/36512649
has comment: http://stackoverflow.com/comment/36512507
has comment: http://stackoverflow.com/comment/36512273
has body: I'm using this simple implementation. I just want to count the comparisons. Below the code actually works. The list is [3, 9, 8, 4, 6, 10, 2, 5, 7, 1]. The answer for comparison count is 25 but I'm getting 30. I can't figure out why. What causes this code to do "more work" than it is supposed to? Thanks in advance! public void sort(int[] values){ int length = values.length; if(values == null || length == 0){ return; } quicksort(values, 0, length-1); } private int partition(int arr[], int left, int right){ int i = left+1; int pivot = arr[left]; for(int j=(left+1); j&lt;=right; j++){ comparisonCount++; if(arr[j] &lt; pivot){ swap(arr,i,j); i++; } } swap(arr,left, i-1); return i; } private void quicksort(int arr[], int left, int right) { int index = partition(arr, left, right); if (left &lt; index - 1){ quicksort(arr, left, index-1); } if (index &lt; right){ quicksort(arr, index, right); } } private void swap(int[] arr, int i, int j){ int tmp; tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; }
type: Question

http://stackoverflow.com/comment/36301371
comment on: http://stackoverflow.com/q/23638552
type: Comment
type: QuestionComment
has text: Debug the read loop and see what it's actually reading (or at least, how many bytes it read on each iteration)
score: 0

http://stackoverflow.com/q/23635749
possible better answer: http://stackoverflow.com/a/44368594
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/44368594
type: Question
answer count: 2
downvote count: 2
accepted answer: http://stackoverflow.com/a/23637242
has body: I am currently learning LWJGL(LightWeight Java Game Library), the OpenGL-Java port, and am trying to figure out how to draw a circle using VBOs. When I search for code samples concerning my problem (I search OpenGL b/c the syntax of OpenGL &amp; LWJGL are quite similar), all I find is people using glBegin(GL_QUADS) and such, which I don't like due to its poor performance and its insufficiency. I know it uses thing like Math.PI and such(I've taken Geometry, the math is not the hard part in my opinion). I want to know how I would get the X and Y values I receive from using Math.cos &amp; Math.sin into the VBO, b/c when using glDrawArrays, you have to specify the number of vertices.
favorite count: 0
has comment: http://stackoverflow.com/comment/36294818
has answer: http://stackoverflow.com/a/23637242
upvote count: 4
type: AnsweredQuestion
score: 2
has title: How to draw a circle with OpenGL(LWJGL specifically) using VBOs

http://stackoverflow.com/q/23683349
downvote count: 0
possible better answer: http://stackoverflow.com/a/23685068
favorite count: 0
has answer: http://stackoverflow.com/a/23685068
has comment: http://stackoverflow.com/comment/36389762
accepted answer: http://stackoverflow.com/a/23685065
score: 1
has comment: http://stackoverflow.com/comment/36389739
has comment: http://stackoverflow.com/comment/36389752
upvote count: 1
has comment: http://stackoverflow.com/comment/36389178
type: AnsweredQuestion
has body: I have this type of records present inside my collection { "_id": { "$oid": "537470dce4b067b395ba47f2" }, "symbol": "CMC", "tvol": 76.97 } While retrieving results , i am unable to map to to my custom object This is my client program public class Data { public static void main(String[] args) { try { String textUri = "mongodb://admin:password1@ds043388.mongolab.com:43388/stocks"; MongoURI uri = new MongoURI(textUri); Mongo m = new Mongo(uri); DB db = m.getDB("stocks"); DBCollection table = db.getCollection("stock"); BasicDBObject searchQuery = new BasicDBObject(); DBCursor cursor = table.find(searchQuery); while (cursor.hasNext()) { Security sec = (Security) cursor.next(); System.out.println(sec.getSymbol()); } } catch (UnknownHostException e) { e.printStackTrace(); } catch (MongoException e) { e.printStackTrace(); } } } Security.java package com; import com.mongodb.BasicDBObject; public class Security extends BasicDBObject { public Security() { } private String symbol; public String getSymbol() { return symbol; } public void setSymbol(String symbol) { this.symbol = symbol; } } This is the exception i am getting . Exception in thread "main" java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to com.Security at com.Data.main(Data.java:25)
has comment: http://stackoverflow.com/comment/36387661
tagged with: java
has title: Unable to map from mongodb results to java custom object
type: Question
tagged with: mongodb
answer count: 2
has answer: http://stackoverflow.com/a/23685065

http://stackoverflow.com/q/23719637
answer count: 2
has answer: http://stackoverflow.com/a/23719707
has body: I came across below behavior from intern() method , confused, any thoughts? Case 1: String test3=new String("hello"); test3.intern(); String test4=new String("hello"); test4.intern(); if(test3==test4){ System.out.println("same obj refered for test3 and test4 "); } else{ System.out.println("new obj created for test4"); } Output: new obj created for test4 Case 2: String test3=new String("hello").intern(); //test3.intern(); String test4=new String("hello").intern(); //test4.intern(); if(test3==test4){ System.out.println("same obj referred for test3 and test4 "); } else{ System.out.println("new obj created for test4"); } Output: same obj referred for test3 and test4
upvote count: 2
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/36455839
has answer: http://stackoverflow.com/a/23719653
linked to: http://stackoverflow.com/q/1855170
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36456001
duplicate of: http://stackoverflow.com/q/1855170
score: 1
has title: intern() method for strings
tagged with: string
has comment: http://stackoverflow.com/comment/36455876
favorite count: 0
type: Question

http://stackoverflow.com/q/23722359
has comment: http://stackoverflow.com/comment/36468548
possible better answer: http://stackoverflow.com/a/23722463
has comment: http://stackoverflow.com/comment/36465644
has answer: http://stackoverflow.com/a/23722463
accepted answer: http://stackoverflow.com/a/23725657
has body: Hi i want to use jstl variable in scriplet i I want to print a "hello" when num==3 it tried get the following code but value of i remains zero. I want get the value of num and increment it by 1 then check if num==3 then print hello once condition is true reassign value again to zero. <c:set var="num" value="0"></c:set> <c:forEach items="${requestScope.Products}" var="emp" begin="0" end="${size}" > <c:if test="${num==3}"> hello </c:if> <%! int var=0;%> <% var=Integer.parseInt(pageContext.getAttribute("num").toString());%> <% System.out.println(var); var=var+1;%> <c:out value="${num}"></c:out> Title ${emp.title} Price ${emp.price} </c:forEach> EDIT I want to display max 3 records in a row like if i 15 records then there will be 5 rows,. and with in row there will be 3 columns problem is when i write like this ${tile} price in a for loop it shows first record 3 times but i want new record in each column. Here is my modified code: <% int size=Integer.parseInt(request.getAttribute("size").toString()); %> <%= size%> <c:set var="num" value="0"></c:set> <c:forEach items="${requestScope.Products}" var="emp" begin="0" end="${size}" varStatus="loop"> <c:choose> <c:when test="${num==3}"> <c:set var="num" value="0"></c:set> </c:when> <c:otherwise> Title ${emp.title} Price ${emp.price} </c:otherwise> </c:choose> <c:set var="num" value="${num + 1}" /> <c:out value="${num}"></c:out> </c:forEach>
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36467428
has comment: http://stackoverflow.com/comment/36468015
has comment: http://stackoverflow.com/comment/36468109
has comment: http://stackoverflow.com/comment/36464223
has comment: http://stackoverflow.com/comment/36468500
tagged with: java
linked to: http://stackoverflow.com/q/14783572
has comment: http://stackoverflow.com/comment/36467296
has comment: http://stackoverflow.com/comment/36477017
has comment: http://stackoverflow.com/comment/36468751
type: Question
has comment: http://stackoverflow.com/comment/36467330
tagged with: jstl
has comment: http://stackoverflow.com/comment/36477142
has title: Accessing JSTL variable in Scriplet
has answer: http://stackoverflow.com/a/23725657
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36467365
has comment: http://stackoverflow.com/comment/36467459
tagged with: jsp
has comment: http://stackoverflow.com/comment/36467985
has comment: http://stackoverflow.com/comment/36467876
has comment: http://stackoverflow.com/comment/36468093
has comment: http://stackoverflow.com/comment/36467264
tagged with: el
has comment: http://stackoverflow.com/comment/36467956
has comment: http://stackoverflow.com/comment/36468468
has comment: http://stackoverflow.com/comment/36468483

http://stackoverflow.com/q/23767763
tagged with: netbeans
downvote count: 0
possible better answer: http://stackoverflow.com/a/23769923
tagged with: swing
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23767872
accepted answer: http://stackoverflow.com/a/23767872
has title: JList adding and removing items (Netbeans)
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23769923
has body: I'm trying to add and remove items from my jList (jList1), but It doesn't work. I've searched on stackoverflow for other people with the same problem, but when their problem is solved, I keep getting errors. So this is how I declared the jList: jList1.setModel(new javax.swing.AbstractListModel() { String [] strings = lijstItems; public int getSize() { return strings.length; } public Object getElementAt (int i) { return strings[i]; } }); So now I made these buttons to add and remove items from the list: private void addHostActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: DefaultListModel model = (DefaultListModel) jList1.getModel(); model.add(2, "item"); // THIS DOES NOT WORK... } And private void deleteHostActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } I've tried so many things, but they don't work! Can anyone help me please? Thanks!
score: 4
answer count: 3
tagged with: jlist
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/64740352

http://stackoverflow.com/comment/36512369
comment on: http://stackoverflow.com/q/23730062
has text: Ah yes, that's it. OK, here comes the answer...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36589072
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23686016
has text: I've just notice [this answer to another question](http://stackoverflow.com/a/16776155/372643), which might be useful.
score: 0

http://stackoverflow.com/comment/36266901
has text: Where have you defined toString() for list?
comment on: http://stackoverflow.com/q/23621342
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23637460
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23638774
has body: I have a eclipse plugin which implements BundleActivator,IStartup. I need to log the error that occur in earlyStartup(), I need the .log file to be updated for every error. I am unable to find any logging facility for earlyStartup eclipse plugin. If anyone has any ideas about the same,please suggest.
score: 0
answer count: 1
tagged with: eclipse-plugin
has title: Logger in Eclipse plugin with earlyStartup
has answer: http://stackoverflow.com/a/23638774

http://stackoverflow.com/comment/116433506
type: Comment
score: 2
has text: IMO, this is definitely the most "type-safe" solution as the other proposed options pass a string of "hasRole('MY_ROLE')" which I would hardly consider to be type safe.
type: AnswerComment
comment on: http://stackoverflow.com/a/54713712

http://stackoverflow.com/comment/36515772
type: Comment
comment on: http://stackoverflow.com/a/23750705
has text: No need for the call to `getDate`. A DateTime object includes an [`isEqual`](http://www.joda.org/joda-time/apidocs/org/joda/time/base/AbstractInstant.html#isEqual(org.joda.time.ReadableInstant)) method.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36464175
type: Comment
has text: I'm somewhat confused by your first part; you have two identical subclasses but then say you are going to make them unique. At which point it makes sense
type: QuestionComment
comment on: http://stackoverflow.com/q/23723877
score: 0

http://stackoverflow.com/q/23689248
tagged with: java
tagged with: twitter
downvote count: 0
has body: Ok, I've muddled through the OAuth for Twitter and am nearly done. Basically, I'm unable to post a tweet on behalf of a user through a webapp. To the best of my knowledge the webapp is configured properly through the twitter web gui. I'm doing 3-legged authorization so a user can sign into twitter and authorize my app: https://dev.twitter.com/docs/auth/3-legged-authorization. This seems to be working, I'm redirecting, signing in and authorizing my app. The bothersome bit however is that on authorization, one of the messages twitter says is that my app cant post tweets on behalf of the user. I'm pretty sure this is what I need to do and what I was under the impression all this authorization was for. Here's the copy/pasted message from the twitter redirect found at https://api.twitter.com/oauth/authorize: This application will not be able to: Follow new people. Update your profile. Post Tweets for you. Access your direct messages. See your Twitter password. Anyway, this gives me a oauth_verifier, I then use the verifier to get oauth_token and oauth_token_secret so that I can properly sign the request for the final call to update.json. Which ultimately fails. I'm using the same methods to sign and send the other requests so I'm fairly confident in the code thus far. Like I said, that message in authorization leads me to believe I'm following the wrong flow. Any ideas, on where I'm going wrong? For completeness, here's the complete http log for the entire flow, from request token to the final update.json call: CookieSpec selected: best-match Auth cache not set in the context Connection request: [route: {s}->//api.twitter.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] Connection leased: [id: 3][route: {s}->//api.twitter.com:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] Opening connection {s}->//api.twitter.com:443 Connecting to api.twitter.com/199.16.156.231:443 Connection established 192.168.0.149:40378&lt…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23705521
score: 1
favorite count: 0
tagged with: oauth
type: Question
has title: Issues with Twitter oauth for /1/statuses/update.json returning 401
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36293327
has text: But I want it to work like the `tearDown()` method. Using `try{...} catch (...) {...}` makes me write the code for every test, and I don't want that.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23634993
type: QuestionComment

http://stackoverflow.com/q/23711430
type: Question
tagged with: android-arrayadapter
has answer: http://stackoverflow.com/a/23711487
score: 0
has comment: http://stackoverflow.com/comment/36440270
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36440051
has body: error: 05-17 11:27:39.986: E/AndroidRuntime(5172): FATAL EXCEPTION: main 05-17 11:27:39.986: E/AndroidRuntime(5172): Process: com.example.yevsnap, PID: 5172 05-17 11:27:39.986: E/AndroidRuntime(5172): java.lang.NullPointerException 05-17 11:27:39.986: E/AndroidRuntime(5172): at com.example.yevsnap.MessageAdapter.getView(MessageAdapter.java:46) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.AbsListView.obtainView(AbsListView.java:2240) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.ListView.makeAndAddView(ListView.java:1790) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.ListView.fillDown(ListView.java:691) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.ListView.fillFromTop(ListView.java:752) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.ListView.layoutChildren(ListView.java:1630) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.AbsListView.onLayout(AbsListView.java:2091) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.View.layout(View.java:14817) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.ViewGroup.layout(ViewGroup.java:4631) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.View.layout(View.java:14817) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.ViewGroup.layout(ViewGroup.java:4631) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.widget.FrameLayout.onLayout(FrameLayout.java:388) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.View.layout(View.java:14817) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.view.ViewGroup.layout(ViewGroup.java:4631) 05-17 11:27:39.986: E/AndroidRuntime(5172): at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1589) 05-17 11:27:39.986: E/Andro…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36440345
has comment: http://stackoverflow.com/comment/36440239
has title: App crashes when trying to implement a custom list Adapter ( NullPointerException )
accepted answer: http://stackoverflow.com/a/23711487

http://stackoverflow.com/comment/36362716
type: Comment
score: 0
has text: @user3631848 You need to import java.util.Map.Entry
type: AnswerComment
comment on: http://stackoverflow.com/a/23655368

http://stackoverflow.com/comment/36536373
type: Comment
has text: Thanks. but I know this. and I want to implement it using java-api.
score: 0
comment on: http://stackoverflow.com/a/23761756
type: AnswerComment

http://stackoverflow.com/comment/36524249
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23754732
has text: @DavidWallace public void? public void deliverExcelReport_xlsx(String ReportID, String Title, String Criteria, String[] HeadersLabel, String[] CellDataType, List Cells) {
score: 0

http://stackoverflow.com/a/23735266
downvote count: 0
has body: You're creating a new fragment and immediately calling changeText() on it. The fragment transaction that creates the fragment view, calling the lifecycle callbacks such as onCreateView(), has not yet been run. Consider passing arguments to your fragmens using a bundle and not call fragment methods directly outside fragment lifecycle.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23735163

http://stackoverflow.com/q/23690494
favorite count: 0
has comment: http://stackoverflow.com/comment/36403313
tagged with: windows
tagged with: windows-server-2008
has comment: http://stackoverflow.com/comment/36401495
has comment: http://stackoverflow.com/comment/40023467
has comment: http://stackoverflow.com/comment/36404479
upvote count: 1
has answer: http://stackoverflow.com/a/23691392
accepted answer: http://stackoverflow.com/a/23691392
type: AnsweredQuestion
has body: Our code is unexpectedly appending &amp;#13 to the end of the lines created by the following routine: public String getNotation(ClientMessage TransactionMessage) { StringBuffer sb = new StringBuffer(); String lineSeparator = System.getProperty("line.separator"); String osName = System.getProperty("os.name").toLowerCase(); sb.append(getNotationTitle(TransactionMessage)); sb.append(lineSeparator); sb.append(lineSeparator); The "line.separator" seems to be getting translated to the string &amp;#13 only when the code is run on a Windows Server 2008 box. It runs fine when we run the same on Windows 7 or UNIX. Has any one encountered this issue, and if so is there any logical explanation and a solution to correct this?
has comment: http://stackoverflow.com/comment/36401371
score: 1
tagged with: java
tagged with: ascii
type: Question
has title: Java code unexpectedly appending "&#13" to line endings
tagged with: newline
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23695761
has comment: http://stackoverflow.com/comment/36410041
duplicate of: http://stackoverflow.com/q/2688629
type: Question
has answer: http://stackoverflow.com/a/23695884
linked to: http://stackoverflow.com/q/1003026
has answer: http://stackoverflow.com/a/23695875
answer count: 4
score: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36410016
has comment: http://stackoverflow.com/comment/36410132
has body: Is this thread safe? Do I need the lock? public class Load { //private final Object lock = new Object(); private final Map&lt;String, String&gt; confs = new HashMap&lt;String, String&gt;(); public void addValue(String key, String value) { //synchronized (lock) confs.put(key, value); } public String getValue(String key) { //synchronized (lock) return confs.get(key); } } I think it's thread safe without lock. when I do new Load(), there will be new hashmap instance. is this correct?
tagged with: thread-safety
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23695886
has title: Is this thread safe
has answer: http://stackoverflow.com/a/23695919
linked to: http://stackoverflow.com/q/2688629
has comment: http://stackoverflow.com/comment/36410034

http://stackoverflow.com/a/23728269
accepted answer of: http://stackoverflow.com/q/23728264
has body: You should use name attribute instead of id to send parameters to the server. &lt;input type="text" id="userName" name="username" /&gt;
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36473183
upvote count: 2
answers question: http://stackoverflow.com/q/23728264
type: Answer
score: 2

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/23742098

http://stackoverflow.com/a/23617360
has comment: http://stackoverflow.com/comment/36260326
answers question: http://stackoverflow.com/q/23617239
has body: I hope this code help you: import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class JMenuTest extends JFrame { /** * */ private static final long serialVersionUID = 1L; public JMenuTest() { JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu connectionMenu = new JMenu("Connection"); menuBar.add(connectionMenu); JMenuItem menuItemConnect = new JMenuItem("Connect"); menuItemConnect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println("Connected"); } }); connectionMenu.add(menuItemConnect); JMenuItem menuItemDisconnect = new JMenuItem("Disconnect"); menuItemDisconnect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println("Disconnected"); } }); connectionMenu.add(menuItemDisconnect); JMenuItem menuItemExit = new JMenuItem("Exit"); menuItemExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); connectionMenu.add(menuItemExit); JMenu mnNewMenu_1 = new JMenu("New menu"); menuBar.add(mnNewMenu_1); this.setVisible(true); this.setSize(300, 300); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } /** * @param args */ public static void main(String[] args) { new JMenuTest(); } }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36263333
score: 2
upvote count: 2

http://stackoverflow.com/q/23668818
score: 0
has comment: http://stackoverflow.com/comment/36359388
has comment: http://stackoverflow.com/comment/36359489
has title: Playing .Wav Files
has comment: http://stackoverflow.com/comment/36359396
possible better answer: http://stackoverflow.com/a/23668978
type: AnsweredQuestion
has body: im using String comspec = System.getenv().get("ComSpec"); String fileToPlay = "/path/to/wav/file.wav"; Runtime.getRuntime().exec(comspec, new String[]{"/c", "start", fileToPlay}) ; and I keep on getting an error all i need it to do is just play a .wav file
tagged with: java
has answer: http://stackoverflow.com/a/23669731
accepted answer: http://stackoverflow.com/a/23669731
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23668978
tagged with: wav

http://stackoverflow.com/comment/36373467
has text: @dipali , yest weight is fix. if 75 gave input in weight edittext field, check the previous age group condition. if match true otherwise false return.
comment on: http://stackoverflow.com/q/23676297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23625115
accepted answer of: http://stackoverflow.com/q/23624985
has comment: http://stackoverflow.com/comment/36283845
has comment: http://stackoverflow.com/comment/73026068
has body: Each test runs in its own transaction and rollbacks at the end. You can tune that by adding @Rollback(false) to your first test. The problem now is that the transaction of insertDataTest has completed so you should remove what it has created manually. To do that, the class you extends from has several utility methods such as deleteFromTables or deleteFromTableWhere. This should go ideally in an @AfterClass or something. But that's not what I would do. I would factor out the data that are inserted by insertDataTest in a shared utility. That way, you could call it again in your second test and remove the dependsOnMethods. Having such dependency is not recommended as you can't run that test in isolation.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23624985
type: Answer
has comment: http://stackoverflow.com/comment/36273932

http://stackoverflow.com/comment/36519866
type: Comment
comment on: http://stackoverflow.com/a/23752908
score: 0
type: AnswerComment
has text: have you checked the last edit. This will help to reslove this problem @Sophie

http://stackoverflow.com/comment/123334428
has text: in this case you may use optional.ofNullable(), this have to be handled outside OptionalConsumer in example above I just used Optional.of(i) because am sure that value is not going to be null but in other case if you could get value as null you have to use optional.ofNullable()
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29395324

http://stackoverflow.com/a/23650656
has body: I finally got it running...I didn´t declare my Lock to be static...thus it was possible that several threads entered the critical code block.
type: Answer
answers question: http://stackoverflow.com/q/23632761
score: 0

http://stackoverflow.com/q/23651713
tagged with: maven
has body: I have a good(ish) understanding of using Maven for Java/WebApp projects but only to the point of following the default goals/lifecycle. However I now have a Backup project which is not a Java project at all. I was thinking of configuring it with Maven to keep some consistency but am not sure how I override the main Maven goals/phases for my bespoke processing. The Backup project needs to do the following: 'build' - initially, the backup outputs will be a mysql database dump file and a zip exported from an existing WebApp. But I want it to be flexible so calling an ant file to do the actual work (creating the dump, calling the WebApp, or doing whatever in the future) seems sensible. The output files could then be copied into the target directory. 'install' - publish the output files to a local repository, preferably providing a datetimestamp version number instead of the usual 1.0.0-SNAPSHOT version. I'd like to think that Maven can cope with an artefact being a collection of files, rather than a single jar/war, but not sure on this. My pom.xml declares the packaging as 'pom' as 'jar' and 'war' dont seem appropriate here. I then want other projects to be able to have a dependency on this Backup project so they can get the lastest backup artefacts if required. 1) how do I override the maven 'compile' goal to call an ant build file? 2) how do I override the maven 'install' goal to publish all files in the target directory but as a single artefact? Any help/guidance appreciated.
score: 4
tagged with: java
type: Question
tagged with: ant
has answer: http://stackoverflow.com/a/23652071
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
has title: Using Maven for non-Java projects (overriding clean/compile/install goals)
type: UnansweredQuestion

http://stackoverflow.com/comment/36436025
has text: Perhaps you should read http://jorge.fbarr.net/2014/01/19/introduction-to-strace/ which tells you how to use it with some simple examples.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23676693

http://stackoverflow.com/a/23665682
score: 0
type: Answer
has body: I found out the cause: some .jar files I put at /Library/Java/Extensions directory yesterday caused InteliJ to be unable to import maven projects. After removing those problematic jar files from /Library/Java/Extensions, IntelliJ import works again!! thanks everyone
answers question: http://stackoverflow.com/q/23660161

http://stackoverflow.com/a/23685806
has comment: http://stackoverflow.com/comment/36417570
has body: You can give every node a timestamp property with its creation time (which can be obtained using the Cypher timestamp() function). Then, you can match the last 50 created using this subquery (which can be placed before your actual query): MATCH (n) ORDER BY n.timestamp DESC LIMIT 50 WITH n // Place your actual query here. The variable 'n' will be a collection of the last 50 nodes created. Unfortunately, this will not be very quick, since neo4j will iterate through every node to find the ones with the highest timestamp value. If you only need certain nodes to have the timestamp, you should consider adding a label (say, 'Timestamped') to all of those nodes and change MATCH (n) to MATCH (n:Timestamped).
has comment: http://stackoverflow.com/comment/36422746
answers question: http://stackoverflow.com/q/23678766
score: 0
type: Answer

http://stackoverflow.com/comment/36428212
comment on: http://stackoverflow.com/q/23705063
type: Comment
type: QuestionComment
has text: I have been led to believe that OpenGL places 0,0 at the bottom right unlike you would normally expect for computers. The above code seems to confirm this, however my screen seems to be in the negative portion of the y axis.....
score: 0

http://stackoverflow.com/q/23645878
has answer: http://stackoverflow.com/a/30442758
has comment: http://stackoverflow.com/comment/48967805
answer count: 4
has comment: http://stackoverflow.com/comment/36315652
has comment: http://stackoverflow.com/comment/36315635
downvote count: 0
linked to: http://stackoverflow.com/q/978061
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/36314651
score: 5
has comment: http://stackoverflow.com/comment/36314629
has body: I am making the following curl request successfully to my API: curl -v -X GET -H "Content-Type: application/json" -d {'"query":"some text","mode":"0"'} http://host.domain.abc.com:23423/api/start-trial-api/ I would like to know how can i make this request from inside JAVA code. I have tried searching through Google and stack overflow for the solution. All i have found is how to send data through a query string or how to send JSON data through a POST request. Thanks
has title: Send JSON data in an HTTP GET request to a REST API from JAVA code
has answer: http://stackoverflow.com/a/23647402
has answer: http://stackoverflow.com/a/23647747
favorite count: 0
tagged with: curl
has comment: http://stackoverflow.com/comment/36315763
upvote count: 5
tagged with: rest
has answer: http://stackoverflow.com/a/60209647
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36314413

http://stackoverflow.com/q/23619540
has comment: http://stackoverflow.com/comment/36263850
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36263602
has comment: http://stackoverflow.com/comment/36263588
tagged with: paintcomponent
has title: Java thread and graphics2d
favorite count: 0
has answer: http://stackoverflow.com/a/23620125
tagged with: multithreading
has answer: http://stackoverflow.com/a/23619963
tagged with: swing
has comment: http://stackoverflow.com/comment/36264401
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23619963
has comment: http://stackoverflow.com/comment/36263800
downvote count: 1
has comment: http://stackoverflow.com/comment/36263777
type: Question
answer count: 2
has body: i need a hint how to make my program to work properly. I created a class that extends from JComponent. I also managed to make the whole panel of white colors. Now i am trying to make that my thread Wolf will be painted on the JCOmponent and will move one time. Unfortunately my code dont works and i think its because wolf is not being painted on the white board. How to change the program to make it work. I will be grateful for help. public class Plansza extends JComponent implements ActionListener { static int width = 500; static int height = 500; Ellipse2D wolf; Ellipse2D hare; // size of frame n x m (width,height) public Dimension getPreferredSize(){ return new Dimension(width,height); } protected void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; //draw a background g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); } class Wilk implements Runnable{ private int x; private int y; //when creating a thread we get a first position of wolf Wilk(int posx, int posy){ x=posx; y=posy; } protected void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; //draw a wolf g.setColor(Color.BLUE); wolf = new Ellipse2D.Double(x,y, 10, 10); g2.fill(wolf); } public void run() { x=x+5; y=y+5; repaint(); } } public static void main( final String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame window = new JFrame("Wilki vs Zajace"); Plansza p = new Plansza(); window.add(p); window.pack(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setLocationRelativeTo(null); window.setVisible(true); // Timer t = new Timer(10,p); //action listener referred to Plansza(1 cycle every 100miliseconds) // t.start(); Wilk wolf = new Wilk(10,10); Thread myWolf = new Thread(wolf); myWolf.start(); } }); } @Override public void actionPerformed(ActionEvent e) { } }
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/23620125
has comment: http://stackoverflow.com/comment/36263974
has comment: http://stackoverflow.com/comment/36263912
has comment: http://stackoverflow.com/comment/36263559

http://stackoverflow.com/comment/36364456
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671465
has text: @Rohit I just wondering why Spring MVC test framework doesn't take into acount dispatcher servlet. I mean dispatcher servlet maps only `dispatcher/*` paths, but simple test feel allright with `/` path

http://stackoverflow.com/q/23619508
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36263319
has answer: http://stackoverflow.com/a/23619591
accepted answer: http://stackoverflow.com/a/23619591
has comment: http://stackoverflow.com/comment/36263330
upvote count: 1
favorite count: 0
has title: Program doesn't run in Eclipse
has answer: http://stackoverflow.com/a/23619564
has comment: http://stackoverflow.com/comment/36263426
possible better answer: http://stackoverflow.com/a/23619564
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1944468
downvote count: 0
score: 1
tagged with: java
has body: I'm learning Java and one of the examples of the book runs perfectly from command line, but throws an error from Eclipse. The script is this: /** * This program displays a greeting from the authors. * @version 1.20 2004-02-28 * @author Cay Horstmann */ public class Welcome { public static void main(String[] args) { String[] greeting = new String[3]; greeting[0] = "Welcome to Core Java"; greeting[1] = "by Cay Horstmann"; greeting[2] = "and Gary Cornell"; for (String g : greeting) System.out.println(g); } } The error I get in Eclipse is 'Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error, 'for each' statements are only available if source level is 1.5 or greater' The book says I would get an error in that line (the for) if the JDK was too old, but then why does it run well from the command line? Thanks

http://stackoverflow.com/a/23632983
has comment: http://stackoverflow.com/comment/36289712
has comment: http://stackoverflow.com/comment/36290089
score: 4
answers question: http://stackoverflow.com/q/23631980
has comment: http://stackoverflow.com/comment/36320907
has comment: http://stackoverflow.com/comment/36292084
downvote count: 0
has comment: http://stackoverflow.com/comment/36291278
type: Answer
upvote count: 4
has body: You're not adding the image to the panel. Create a JLabel with the image inside and then add the label to jPanel3: try { JLabel imgLabel = new JLabel(new ImageIcon(this.getClass().getResource( "/resource/images/cd-dvd-icon.png"))); jPanel3.add(imgLabel); jPanel3.revalidate(); jPanel3.repaint(); }catch (Exception ex){ ex.printStackTrace(); }

http://stackoverflow.com/q/23619070
has answer: http://stackoverflow.com/a/23659912
tagged with: java
tagged with: oracle-coherence
type: Question
has body: I have a model object which has javax.script.CompiledScript as member variable. I am trying to put the model objects in Oracle Coherence distributed cache and am getting below exception (Wrapped) java.io.NotSerializableException: com.sun.script.javascript.RhinoCompiledScript at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210) at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConverterValueToBinary.convert(DistributedCache.CDB:3) at com.tangosol.util.ConverterCollections$ConverterCacheMap.put(ConverterCollections.java:2433) at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ViewMap.put(DistributedCache.CDB:1) at com.tangosol.coherence.component.util.SafeNamedCache.put(SafeNamedCache.CDB:1) at com.tangosol.net.cache.CachingMap.put(CachingMap.java:939) at com.tangosol.net.cache.CachingMap.put(CachingMap.java:898) at com.tangosol.net.cache.CachingMap.put(CachingMap.java:810) at com.coname.caching.CoherenceCacheProvider.putAll(CoherenceCacheProvider.java:98) at com.coname.caching.CacheService.putAll(CacheService.java:91) at com.coname.model.modelname.configuration.MetadataConfigurationService.loadTheCache(MetadataConfigurationService.java:32) I see other questions which suggest using Portable Object Format (POF) Serialization. But I don't know the internal object representation of com.sun.script.javascript.RhinoCompiledScript so I don't know how to implement PofSerializer interface. How can I put javax.script.CompiledScript to Oracle Coherence distributed cache?
has title: How can I put javax.script.CompiledScript in Oracle Coherence distributed cache?
tagged with: distributed-caching
accepted answer: http://stackoverflow.com/a/23659912
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23644257
possible better answer: http://stackoverflow.com/a/23644257
type: AnsweredQuestion

http://stackoverflow.com/comment/36358607
has text: Deleted my answer, sorry, its not applicable for plain Java.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23668269
score: 0

http://stackoverflow.com/q/23767136
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36547090
has comment: http://stackoverflow.com/comment/36546942
accepted answer: http://stackoverflow.com/a/23767443
tagged with: java
tagged with: swing
has body: Im not sure what goes where. Im using a GUI Jframe textarea. I want to print into the textarea a changing int based on player score. If you need elaboration please let me know. private void scoreComponentAdded(java.awt.event.ContainerEvent evt) { // TODO add your handling code here: score.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent documentEvent) { printIt(Jscore); } @Override public void insertUpdate(DocumentEvent documentEvent) { printIt(documentEvent); } @Override public void removeUpdate(DocumentEvent documentEvent) { printIt(documentEvent); } private void printIt(DocumentEvent documentEvent) { DocumentEvent.EventType type = documentEvent.getType(); //your code } private void printIt(int Jscore) { printIt(Jscore); } }); }
type: Question
type: AnsweredQuestion
tagged with: jtextarea
has title: Confused on DocumentListener and printing to textarea
score: 0
has answer: http://stackoverflow.com/a/23767443

http://stackoverflow.com/comment/36329984
comment on: http://stackoverflow.com/a/23653921
type: Comment
has text: At this case I should mock A and after test mock.
score: 0
type: AnswerComment

peek
tags question: http://stackoverflow.com/q/23620822
tag name: peek
type: Tag
tags question: http://stackoverflow.com/q/23690060

http://stackoverflow.com/q/23667626
has title: How to deploy JavaFX + JPA Persistence (JSE) inside web browser (not web start)?
has body: I have deployed a java hello world "inside a browser" on http://www.applesweet.net/home.htm just to show that things are working fine. You can try it by just typing the url. The package is built using Netbeans. Therefore, I try to deploy something more complicated using the same method. It's actually a client application I developed with JSE(1.8) + JavaFX8 + Persistence(Eclipse lib). You can try it with this link http://www.applesweet.net/dist/ProjCostTracking.html. It gives me the following error in the Java console. java.security.AccessControlException: access denied ("java.util.PropertyPermission" "eclipselink.persistencexml" "read") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at sun.plugin2.applet.FXAppletSecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPropertyAccess(Unknown Source) at java.lang.System.getProperty(Unknown Source) at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:275) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:150) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:135) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at ProjCostTracking.KYdb.getEntityManagerFactory(KYdb.java:69) at ProjCostTracking.KYdb.(KYdb.java:31) at ProjCostTracking.Main.start(Main.java:161) at com.sun.javafx.applet.FXApplet2$2.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) a…
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/36547411
has comment: http://stackoverflow.com/comment/36358151
linked to: http://stackoverflow.com/q/14650010
tagged with: javafx-8
tagged with: jpa

http://stackoverflow.com/a/23745388
has comment: http://stackoverflow.com/comment/36505093
accepted answer of: http://stackoverflow.com/q/23745356
downvote count: 1
has comment: http://stackoverflow.com/comment/36505200
answers question: http://stackoverflow.com/q/23745356
has comment: http://stackoverflow.com/comment/36504877
upvote count: 9
has comment: http://stackoverflow.com/comment/36505183
type: AcceptedAnswer
score: 8
has body: You can setPrettyPrinting() on your gson instance Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println(gson.toJson(yourObject));
has comment: http://stackoverflow.com/comment/36505166
has comment: http://stackoverflow.com/comment/36504861
type: Answer
has comment: http://stackoverflow.com/comment/36504819

opennlp
type: Tag
tags question: http://stackoverflow.com/q/23760613
tags question: http://stackoverflow.com/q/23615716
tags question: http://stackoverflow.com/q/23618059
tags question: http://stackoverflow.com/q/23724377
tag name: opennlp

http://stackoverflow.com/a/23758332
accepted answer of: http://stackoverflow.com/q/23758227
upvote count: 2
type: Answer
score: 2
has body: Boards has a raw type, because of that it is unclear, what object types should be inside ArrayList ids. So, you should either cast result of boards.getIds().get(0) explicitly: ((Id) boards.getIds().get(0)).getPrice() or generify Boards class: public class Boards&lt;E&gt; { public List&lt;E&gt; ids = new ArrayList&lt;E&gt;(); //region GETTERS-SETTERS public void setIds(ArrayList&lt;E&gt; temp){ this.ids = temp; } public List&lt;E&gt; getIds(){ return ids; } // endregion } You can read about generics here
has comment: http://stackoverflow.com/comment/36529477
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23758227

http://stackoverflow.com/a/23659441
has body: I have a few suggestions for improving your current code. Rather than defining a List of Objects to hold your lists, you can type it more strongly by using the following syntax: ArrayList&lt; ArrayList&lt;? extends ItemProperties&gt; &gt; lists = new ArrayList&lt;&gt;(); So now when you loop through your list you don't have to type cast your elements in the for-each loop. for (ArrayList&lt;? extends ItemProperties&gt; o : lists) { // Do something }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36364143
accepted answer of: http://stackoverflow.com/q/23658512
type: Answer
answers question: http://stackoverflow.com/q/23658512
has comment: http://stackoverflow.com/comment/36341738
has comment: http://stackoverflow.com/comment/36341642
has comment: http://stackoverflow.com/comment/36384217
downvote count: 1
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/36364795

http://stackoverflow.com/q/23721931
has title: How can we create a folder and file using RandomAccessFile in a single statement?
tagged with: randomaccessfile
has comment: http://stackoverflow.com/comment/36465702
tagged with: io
tagged with: directory
has answer: http://stackoverflow.com/a/23724370
favorite count: 0
has comment: http://stackoverflow.com/comment/36465819
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36460533
score: 3
has body: When we write RandomAccessFile r =new RandomAccessFile("file.txt","rw"); how can I create this file in a folder named home on the desktop.. Again it should be a single statement!
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36464946
has comment: http://stackoverflow.com/comment/36462501
tagged with: file
has comment: http://stackoverflow.com/comment/36460211
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/36417079
has text: Are your sure your current approach is working? I think `takeInventory` always prints out zeroes.
score: 0
comment on: http://stackoverflow.com/q/23699478
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23766941
has body: You have to remove previous view first: ((ViewGroup)yourchildview.getParent()).removeView(yourchildview);
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23764824
answers question: http://stackoverflow.com/q/23764824
has comment: http://stackoverflow.com/comment/36551503
has comment: http://stackoverflow.com/comment/36712631
upvote count: 2

http://stackoverflow.com/comment/36488630
type: Comment
has text: Thank you user1803551 and Andrew Thompson !! Very helpful material ! learnt a lot !
comment on: http://stackoverflow.com/a/23730095
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36275012
type: Comment
comment on: http://stackoverflow.com/a/23625692
type: AnswerComment
has text: i am always working on black and white pictures , also the resizeImage(extractedImage, type ,w*2 , h*2) , i wanted to calculate a coefficient instead of "2"
score: 0

http://stackoverflow.com/comment/52731251
has text: Are you sure `@PreMatching` annotation is needed in NameBinding example?
comment on: http://stackoverflow.com/a/23657244
score: 6
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23773762
tagged with: contains
has comment: http://stackoverflow.com/comment/36559403
has body: I'm working on a project that takes in a string, and it creates a file with the string name, But I want it to ban certain words. how would I do this? String fname = scanner(System.in); //check if it contains explicit words if (fname.contains("THE BAD WORD HERE")) { System.out.println(fname + " contains inappropriate words and is not accepted."); } else { System.out.println(fname + " is all good"); //create file createFile(fname); } do I have to use a for loop and go through every char? or is there a simpler way? please help.
tagged with: string
score: 0
has answer: http://stackoverflow.com/a/23773843
has answer: http://stackoverflow.com/a/23773815
possible better answer: http://stackoverflow.com/a/23773843
has comment: http://stackoverflow.com/comment/36559397
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23773815
type: Question
has title: Java Search String for explicit words
answer count: 2

http://stackoverflow.com/comment/36616065
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23776626
type: Comment
has text: Sorry, you are correct, I did not see the colon. But then again, I am also correct; "Cost".length() does equal 4. ;P

http://stackoverflow.com/comment/36515726
comment on: http://stackoverflow.com/q/23750412
score: 0
has text: Also check out this one which has more details on how multiple installed JDKs work: http://stackoverflow.com/questions/17885494/how-can-i-change-mac-oss-default-java-vm-returned-from-usr-libexec-java-home
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23647987
score: 0
has body: Normally in ListView are used in android,but how many items can totally load in list view ? Is it possible to load more than 10,000 items ?
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36319263
has answer: http://stackoverflow.com/a/23648860
has comment: http://stackoverflow.com/comment/36318550
has title: In List view how many list items can load in android
tagged with: java
has comment: http://stackoverflow.com/comment/36318751
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36318505
has comment: http://stackoverflow.com/comment/36318486
has answer: http://stackoverflow.com/a/23649061

http://stackoverflow.com/comment/36445778
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23714486
score: 0
has text: Yes, you are right, but my class AI will handle many operations for lots of creatures, so there would have been hundreads of `creature.` calls.

storage
tag name: storage
tags question: http://stackoverflow.com/q/23746672
type: Tag
tags question: http://stackoverflow.com/q/23626488

http://stackoverflow.com/a/55867426
has body: Most of the answers here just provided algorithms to solve the task but not answering author original question. "Why is there only 5 pairs of car and not 6 ?" That is because cars (2,1) never pass each other. Here is quick visualization of problem.
downvote count: 0
answers question: http://stackoverflow.com/q/23774985
has comment: http://stackoverflow.com/comment/132335985
type: Answer
score: 41
upvote count: 41

http://stackoverflow.com/a/23677914
has comment: http://stackoverflow.com/comment/36377603
has comment: http://stackoverflow.com/comment/50477601
type: Answer
upvote count: 27
has comment: http://stackoverflow.com/comment/50478496
has comment: http://stackoverflow.com/comment/36377046
has comment: http://stackoverflow.com/comment/36377712
answers question: http://stackoverflow.com/q/23677808
has comment: http://stackoverflow.com/comment/50476608
has comment: http://stackoverflow.com/comment/36377161
has comment: http://stackoverflow.com/comment/50477035
has body: Just run the main method which is in the class SampleWebJspApplication. Spring Boot will take care of all the rest (starting the embedded tomcat which will host your sample application).
downvote count: 0
score: 27

http://stackoverflow.com/q/23645700
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36314293
has body: I have a servlet that initiates a JDBC call via Type4 driver (jdbc:db2://localhost:50000). I'm using Fiddler to capture traffic and I'm able to capture the request and response to the servlet but I'm not able to fetch any communication between the java program and database. Is it possible to do it with Fiddler? If not then how else?
tagged with: localhost
has title: Is it possible to capture traffic between processes on localhost
tagged with: java
type: Question
tagged with: fiddler
has comment: http://stackoverflow.com/comment/36342134
tagged with: network-traffic
has answer: http://stackoverflow.com/a/23660182
score: 0
answer count: 1

http://stackoverflow.com/comment/36342134
type: Comment
comment on: http://stackoverflow.com/q/23645700
score: 0
type: QuestionComment
has text: Did Wireshark start capturing localhost traffic at some point?

http://stackoverflow.com/comment/36393497
has text: @publ1c_stat1c take a look to the code above.thks
comment on: http://stackoverflow.com/q/23686292
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36569988
score: 0
type: Comment
has text: how can tell me i tried but seems like both are same can you provide explain how is working
comment on: http://stackoverflow.com/a/23778244
type: AnswerComment

http://stackoverflow.com/q/23659414
has comment: http://stackoverflow.com/comment/36341042
score: -1
upvote count: 0
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/36341196
has title: swt.widgets.List returns empty
accepted answer: http://stackoverflow.com/a/23660000
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36341261
tagged with: java
tagged with: swt
has answer: http://stackoverflow.com/a/23660000
downvote count: 1
type: Question
has body: I have developed an eclipse plugin with few wizard pages. In one of the pages, am using org.eclipse.swt.widgets.List My code goes as follows: public void createControl(Composite parent){ // few lines of code List classesList = new List(someComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); if(hugeList!=null) { for (int j = 0; j &lt; hugeList.size(); j++){ String a= hugeList.get(j); classesList.add(a); System.out.println("Inside loop: " + classesList); } System.out.println("Outside loop: " + classesList); } classesList.addListener(SWT.Selection, this); // lines of code } Here, based upon the size of hugeList the Inside loop: keeps printing the data. But, for Outside loop: the list is empty :( I couldn't understand the reason. Can someone please help.

http://stackoverflow.com/q/23771934
has comment: http://stackoverflow.com/comment/36556612
tagged with: garbage-collection
has title: Does major garbage collection require memory outside of the JVM?
has comment: http://stackoverflow.com/comment/36556637
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36556535
has comment: http://stackoverflow.com/comment/36556525
has body: During major garbage collection, does the machine require memory outside of the JVM allocated amount? The reason I'm asking is we have a box with 6 gigs of ram, running 2 jvm's that use around 2.6 gigs of heap/memory each. Sometimes right before major garbage collection(concurrent mark sweep and compact) there is only a few hundred megs of free memory throughout the entire ram. I was just wondering if more ram is required in these kind of situations, theoretically.
upvote count: 1
has comment: http://stackoverflow.com/comment/36556795
has answer: http://stackoverflow.com/a/23784950
accepted answer: http://stackoverflow.com/a/23784950
answer count: 1
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/36556622

http://stackoverflow.com/comment/36434870
type: AnswerComment
comment on: http://stackoverflow.com/a/23697564
score: 0
type: Comment
has text: You are right! The problem was in the objects. I solved the issue in JGR Deducer by: rm(list=ls()) #Delete objects save.image() #save workspace Close and restart JGR Deducer

http://stackoverflow.com/comment/36363244
type: AnswerComment
type: Comment
has text: thanks, this one works. I just imported java.util.* at before. I didn't know still have to import java.util.Map.Entry
comment on: http://stackoverflow.com/a/23655368
score: 0

http://stackoverflow.com/a/23658068
has comment: http://stackoverflow.com/comment/36338530
has comment: http://stackoverflow.com/comment/36338535
has comment: http://stackoverflow.com/comment/36339105
accepted answer of: http://stackoverflow.com/q/23658045
has comment: http://stackoverflow.com/comment/36338224
type: Answer
has body: In Java web applications, third party libraries go in WEB-INF/lib folder. Copy the jar inside this folder and redeploy your application. Do this in case your application should support these libraries on every application server (Tomcat, Jetty, JBoss, GlassFish, etc.) it will be deployed.
has comment: http://stackoverflow.com/comment/36338804
has comment: http://stackoverflow.com/comment/36338158
has comment: http://stackoverflow.com/comment/36338738
has comment: http://stackoverflow.com/comment/36363432
has comment: http://stackoverflow.com/comment/36338515
has comment: http://stackoverflow.com/comment/36338585
upvote count: 1
has comment: http://stackoverflow.com/comment/36338162
has comment: http://stackoverflow.com/comment/36338104
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23658045

http://stackoverflow.com/comment/36518927
type: QuestionComment
comment on: http://stackoverflow.com/q/23748547
type: Comment
has text: Yes, you'll need a thirdparty library. You can use JavaMail-Crypto as mentioned in the answer, or use our SecureBlackbox.
score: 0

http://stackoverflow.com/comment/36493167
has text: will that also list the user names as it is shown in the task manager?
comment on: http://stackoverflow.com/q/23739143
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36514249
comment on: http://stackoverflow.com/q/23750147
type: QuestionComment
type: Comment
score: 0
has text: Does this question: ["Servlet mapping / vs /*"](http://stackoverflow.com/questions/4140448/servlet-mapping-vs) answer your question?

http://stackoverflow.com/q/23710857
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23839563
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36671644
upvote count: 1
has answer: http://stackoverflow.com/a/28442885
tagged with: runtime
has answer: http://stackoverflow.com/a/23837272
has answer: http://stackoverflow.com/a/28270300
tagged with: jvm
favorite count: 0
has title: Java applications don't start via .apps in Finder
has answer: http://stackoverflow.com/a/28043711
has body: I have Mac OS 10.9.3 installed, and when entering java -version in the Terminal it shows: 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) My problem is that applications which use Java don't work when double-clicking on the .app folders. For example, TuxGuitar just does nothing, and Eclipse gives the No Java virtual machine error. When launching them with the command open TuxGuitar.app open Eclipse.app .. they work both. What could be the problem?
answer count: 5
tagged with: macos

http://stackoverflow.com/comment/36398216
has text: @jww The first handshake got to the ChangeCipherSpec message, which is a success. My question is why the re-handshake.
score: 0
comment on: http://stackoverflow.com/q/23642951
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37134011
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23766949
type: Comment
has text: The new/old class strings were read from a file, they were never types. The TypeDeclaration was obtained from parsing the source code.

http://stackoverflow.com/comment/36421158
type: QuestionComment
has text: you forget () is not scala xD
comment on: http://stackoverflow.com/q/23701593
score: 0
type: Comment

http://stackoverflow.com/q/23642553
downvote count: 0
has comment: http://stackoverflow.com/comment/36308267
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: floating-point
type: Question
duplicate of: http://stackoverflow.com/q/8253789
linked to: http://stackoverflow.com/q/8253789
upvote count: 1
has comment: http://stackoverflow.com/comment/36321923
tagged with: floating-point-precision
favorite count: 0
has title: Java float numbers
has body: consider having a float number in java like this: float f = 2000000000f; After addition of number 64 the result is the same number: System.out.println(String.format("%.0f", (f+64f))); Result: 2000000000 After addition of number 65 the result is completely different: System.out.println(String.format("%.0f", (f+65f))); 2000000128 can somebody explain to me why does this work like this? thanks
answer count: 0

http://stackoverflow.com/a/23735301
has comment: http://stackoverflow.com/comment/50738794
type: Answer
answers question: http://stackoverflow.com/q/23734818
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23734818
has comment: http://stackoverflow.com/comment/36489407
has body: While you can add both JARs to the classpath, by default Java will use first JAR it finds containing a given class, which, depending how you construct your classpath can have undesirable effects on your system. To avoid this situation Gradle (like Maven before it) resolve dependency conflicts at build time. With Gradle, the default dependency resolution uses the newest dependency, which in your case means Velocity 1.7. With Maven dependency resolution is achieved by using the closest dependency to your project, which in your case, as your project declares a dependency on Velocity 1.7, means it is that version that would be used. With both approaches, whether your system (or rather ReportNG) will work with Velocity 1.7 is down to you to test.
has comment: http://stackoverflow.com/comment/36486387
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36491080

http://stackoverflow.com/comment/36535934
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23761558
has text: I get your point, but IMHO "depends" is not a good answer, especially in this context where I don't think the op wants to download and store billions of hashed password, rainbow tables and stuff like that.

http://stackoverflow.com/q/23710312
tagged with: java
upvote count: 1
tagged with: jpa
answer count: 1
favorite count: 0
has title: Why Sleep Solves "No Transaction is currently active" JPA
downvote count: 0
type: UnansweredQuestion
score: 1
has body: I have a web service method that uses EclipseLink JPA. This method basically inserts data into the database. Something like : public void insert(parameters....) { em.getTransaction().begin(); em.persist(employee); em.getTransaction().commit(); // em.close(); } Now at the client end, i have a loop that performs inserts per iteration : for(......) { websrvice.insert(parameters...) } After the first iteration, i get a "No transaction is currently active" exception. Then i thought of putting a Thread.sleep(2000) after each iteration which solves the problem. So intuitively, this could be because another transaction is trying to commit before the latter is completed which causes the error. But then again i think, why would the second insert even start when the first isn't completed ? confused.
type: Question
has answer: http://stackoverflow.com/a/23710368

http://stackoverflow.com/comment/36288854
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23631612
has text: yes, GetElements.suffix_replacement_map was the cause of the problem -- the map values weren't trimmed before adding in. Thank you.

http://stackoverflow.com/comment/36343843
type: Comment
comment on: http://stackoverflow.com/a/23655547
score: 0
has text: Use the constructor of GridLayout like this: contentPane.setLayout(new GridLayout(rows, cols, 0, 0)); You can put 0 in number of rows and 3 in number of cols.
type: AnswerComment

http://stackoverflow.com/comment/36462953
comment on: http://stackoverflow.com/q/23722762
has text: Please paste the xml code of the layout
score: 0
type: Comment
type: QuestionComment

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/23617179

http://stackoverflow.com/a/23767262
score: 8
has comment: http://stackoverflow.com/comment/36547929
accepted answer of: http://stackoverflow.com/q/23767056
has body: Note here I'm assuming regular CLR - no AOT etc. At the IL level: there is one definition of Foo&lt;T&gt;; the IL is identical (shared) no matter the T. At the JIT level: the type is jitted (per generic parameter) once for all (shared) reference-type parameters, and once each (separately) value-type parameters. So the JIT for Foo&lt;string&gt; and Foo&lt;List&lt;...&gt;&gt; is shared, and a separate JIT for each of Foo&lt;int&gt; and Foo&lt;bool&gt;. The number of objects/instances created is identical to the number of new Foo&lt;...&gt;(...) calls (or Activator.CreateInstance(...) etc).
upvote count: 8
answers question: http://stackoverflow.com/q/23767056
has comment: http://stackoverflow.com/comment/36547644
has comment: http://stackoverflow.com/comment/36547679
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36547723
type: Answer

http://stackoverflow.com/a/23622370
has comment: http://stackoverflow.com/comment/60112456
has body: The inner lock serves no function, in this case. Java uses recursive mutexes, so a thread that holds a lock on a given mutex can lock it again, and a lock count is kept. Only when the last synchronized block is exited, is the mutex actually unlocked.
upvote count: 4
has comment: http://stackoverflow.com/comment/36269065
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36268909
accepted answer of: http://stackoverflow.com/q/23622359
score: 4
has comment: http://stackoverflow.com/comment/60058241
answers question: http://stackoverflow.com/q/23622359
type: Answer

http://stackoverflow.com/comment/36302447
has text: @user3558352 google or search on stackvoerflow with **Unable to add window -- token null is not for an application** and you find many similar posts and to know when to use what look at the post i linked to in my post
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23639698

http://stackoverflow.com/q/23702721
type: Question
answer count: 2
has body: First, thanks for the time, and also some patience since I´m a noob in this subject... I have a PublicKey object: Sun RSA public key, 2048 bits modulus: 18077203024541758363929020498733829335491380051700307922133794962061975747420394877143889885945336305414295314139507244695177887549094887061986620463327220586346030432731550617421168238140740600157137764348364595070740870977422155213465409492752709350141858141989090093641680035205975043549124382974765930336756768548921056751935659732417661594872253800976031104054204421629711597470770033907934006101453865340621763385927121144139876123093050849040638804744781745077880021130241262817005818066815987603380244330904985993553253768481242544555268132089382269330678737161421709242927983939704722774178497866252217753513 public exponent: 65537 and I need to get it like this: [binary] (For what I get that is a correct example) I really don´t know how to handle this kind of object so I really don´t know if it´s something pretty dumb or hard to achieve. Edit: (Further Explanation) In this case I´m dealing with a PublicKey Object that I get working with the net.ripe.commons.certification library since I need to parse the fields of an End Entity Certificate. When I get the Public Key I get it with the .getPublicKey() of a X509cert, and I see as it is show in the first code posted. I need to store it in a field in a database, if I for instance use .getEncode().toString(), it gives my something that is not right. I already know for other application in the web that the second code (which is how I want to save it in the db) corresponds to the first one. Thanks
score: 0
accepted answer: http://stackoverflow.com/a/23760349
has comment: http://stackoverflow.com/comment/36423506
has comment: http://stackoverflow.com/comment/36423947
possible better answer: http://stackoverflow.com/a/23704970
type: AnsweredQuestion
has title: Dealing with a PublicKey object in Java
has answer: http://stackoverflow.com/a/23704970
tagged with: java
tagged with: rsa
has answer: http://stackoverflow.com/a/23760349

http://stackoverflow.com/comment/36300806
type: Comment
comment on: http://stackoverflow.com/a/23636273
score: 0
type: AnswerComment
has text: the skip don't seem to be manage in that case. I also try to put it to true in the child1 project but it didn't work.

http://stackoverflow.com/q/23626127
has body: I have to deploy my signed applet in several clients and whith java 1.7.0.55 it's necessary to include in manifest the attribute Caller-Allowable-Codebase with the caller domain. Before this version I can indicate an * to indicate any domain. More info https://blogs.oracle.com/thejavatutorials/entry/jdk_8u5_and_jdk_7u55 I Want sign the applet when I distribute it. Are there any way to sign applets by java code? One way is call jarsigner in console from java code, but I don't like this solution. I´m thinking in do it by code, for example calling a class or implementing signature with BouncyCastle. It's possible? Thanks a lot
duplicate of: http://stackoverflow.com/q/21684419
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36277175
linked to: http://stackoverflow.com/q/21684419
upvote count: 1
tagged with: java-7
has title: Sign applets from code
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/36324345
downvote count: 0
answer count: 0
tagged with: jarsigner
type: UnansweredQuestion

http://stackoverflow.com/comment/36562960
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23775476
has text: hi deviantfan , you are right.

http://stackoverflow.com/q/23616436
upvote count: 5
has answer: http://stackoverflow.com/a/23616497
has title: Java RegEx back slash Number
has body: What does it mean to have a \number in a regex in java. Let's say I have something like \1 or \2. What does this mean and how is it used? An example would be really helpful. Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23616482
favorite count: 0
has comment: http://stackoverflow.com/comment/36258229
type: Question
has comment: http://stackoverflow.com/comment/36258095
tagged with: regex
score: 4
linked to: http://stackoverflow.com/q/8624345
accepted answer: http://stackoverflow.com/a/23616482
tagged with: numbers
has comment: http://stackoverflow.com/comment/36258263
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/36257663
duplicate of: http://stackoverflow.com/q/8624345
downvote count: 1
has comment: http://stackoverflow.com/comment/36258370
possible better answer: http://stackoverflow.com/a/23616497
has comment: http://stackoverflow.com/comment/36257645

http://stackoverflow.com/comment/36430348
score: 0
type: Comment
has text: Oops, my above comment should say: "I'm NOT saying...".
type: AnswerComment
comment on: http://stackoverflow.com/a/23701143

http://stackoverflow.com/comment/85852614
type: Comment
has text: Thank you. It is easy suggest. But it works for all cases! I have found config redefinition by log :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23648010

http://stackoverflow.com/q/23688674
type: AnsweredQuestion
upvote count: 2
score: 1
accepted answer: http://stackoverflow.com/a/23831791
has comment: http://stackoverflow.com/comment/36410862
tagged with: java
has comment: http://stackoverflow.com/comment/36668467
has comment: http://stackoverflow.com/comment/36668481
downvote count: 1
type: Question
has title: Trouble with setting RoundingMode on DecimalFormat
has comment: http://stackoverflow.com/comment/36410303
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36397675
has body: This might be kind of a dumb question, but I'm stuck on it. I'm trying to set the RoundingMode on a DecimalFormat. DecimalFormat df = new DecimalFormat("###.##"); df.setRoundingMode(RoundingMode.HALF_UP); However, the code looks fine to me and it looks the same as many examples I have seen. The error on setRoundingMode() is: ***The method setRoundingMode(RoundingMode) is undefined for the type DecimalFormat*** It suggests to cast df to an Object, but that doesn't solve anything... Any suggestions? EDIT I am using ver. 1.7 Below I changed the compliance level to 1.6 yet no difference. Thank you in advance for the help!
answer count: 1
has comment: http://stackoverflow.com/comment/36397585
has comment: http://stackoverflow.com/comment/36410833
favorite count: 0
has comment: http://stackoverflow.com/comment/36397686
has comment: http://stackoverflow.com/comment/36668358
has comment: http://stackoverflow.com/comment/36398142
has answer: http://stackoverflow.com/a/23831791
tagged with: decimalformat

http://stackoverflow.com/comment/54863795
has text: @LyubomyrShaydariv So you see a different question in this post? Really? And *"This does not really answer the question."* is obviously nonsense. If you want this post to be deleted during review, then use a proper comment for this.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33539224
type: Comment

http://stackoverflow.com/comment/36465667
score: 8
comment on: http://stackoverflow.com/q/23724661
type: Comment
type: QuestionComment
has text: Wouldn't it be easier to just use `if (!yourString.contains("test"))`

http://stackoverflow.com/comment/36544014
type: QuestionComment
has text: I think you need to clarify why you think different concrete classes needing varied parameters to their constructors is a problem at all. If it was a method on the interface that needed various parameters depending on the concrete implementation, that would be an issue, but on the constructor? Without more information, it seems fine to me
comment on: http://stackoverflow.com/q/23761950
score: 0
type: Comment

http://stackoverflow.com/q/23666972
has answer: http://stackoverflow.com/a/23667014
answer count: 2
has comment: http://stackoverflow.com/comment/36355891
downvote count: 0
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
tagged with: swing
has body: I'm a super Java noob and need some help. I am trying to write a code that shows the word "on" on the JPanel for 5 (or however long I pass into y variable) seconds then changes the word to "off" on the same JPanel. Think of a stoplight that shows green for a period of time then goes to red. The code I have written below opens up two separate JFrames to display the different words. Any help or ideas would be greatly appreciated. import javax.swing.*; public class practice extends JFrame implements Runnable { int x; int y; JLabel show = new JLabel("on"); JLabel show2 = new JLabel("off"); boolean yes; public practice(boolean on, int x){ x=y; yes = on; setTitle("Stoplight"); setSize(500, 500); setResizable(true); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void test(){ try { Thread.sleep(y); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (yes == true){ add(show2); }else if (yes == false) add(show); } public void run() { test(); } public static void main (String[] args){ Thread t1 = new Thread(new practice(true, 50000)); Thread t2 = new Thread(new practice(false, 0)); t1.start(); t2.start(); } }
type: Question
has title: Dynamic JLable Text
has answer: http://stackoverflow.com/a/23667132
tagged with: jpanel

http://stackoverflow.com/q/23703822
upvote count: 3
tagged with: java
has body: I am new to perl but have done some programming in java facing a problem in running the perl script present in the jar file . I am using windows and I have written a perl script to convert one type of file to another type . I have checked the perl script with the java program using the Runtime and I am able to run the same as required and i am getting the output converted files as well (using the cmd line) I have created a GUI in java to get the files to convert to the target files . I am able to run the file from netbeans IDE as will . But when I am trying to run the jar file . I am using URL to get the URL to the perl script . URL url = this.getClass().getResource("/com/MyProject/FileConverter/fileconverter.pl"); and Runtime for Executing the script : String[] cmd = {"perl",path,input_file,output_file}; process = Runtime.getRuntime().exec(cmd); Please help in resolving the issue . Basically i do need to know how we can run the perl script present in the same jar file that we are executing.
possible better answer: http://stackoverflow.com/a/23704794
type: Question
has title: Running the perl script file present in the jar file
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23704794
score: 3
has answer: http://stackoverflow.com/a/23703905
accepted answer: http://stackoverflow.com/a/23703905
answer count: 2
tagged with: perl
downvote count: 0
tagged with: executable-jar
favorite count: 0
linked to: http://stackoverflow.com/q/4764347

http://stackoverflow.com/q/23697516
has answer: http://stackoverflow.com/a/23712812
tagged with: gwtp
tagged with: gwt
tagged with: java
has body: Here is the full code public class CrawlServlet implements Filter{ public static String getFullURL(HttpServletRequest request) { StringBuffer requestURL = request.getRequestURL(); String queryString = request.getQueryString(); if (queryString == null) { return requestURL.toString(); } else { return requestURL.append('?').append(queryString).toString(); } } @Override public void destroy() { // TODO Auto-generated method stub } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; String fullURLQueryString = getFullURL(httpRequest); System.out.println(fullURLQueryString+" what wrong"); if ((fullURLQueryString != null) && (fullURLQueryString.contains("_escaped_fragment_"))) { // remember to unescape any %XX characters fullURLQueryString=URLDecoder.decode(fullURLQueryString,"UTF-8"); // rewrite the URL back to the original #! version String url_with_hash_fragment=fullURLQueryString.replace("?_escaped_fragment_=", "#!"); final WebClient webClient = new WebClient(); WebClientOptions options = webClient.getOptions(); options.setCssEnabled(false); options.setThrowExceptionOnScriptError(false); options.setThrowExceptionOnFailingStatusCode(false); options.setJavaScriptEnabled(false); HtmlPage page = webClient.getPage(url_with_hash_fragment); // important! Give the headless browser enough time to execute JavaScript // The exact time to wait may depend on your application. webClient.waitForBackgroundJavaScript(20000); // return the snapshot //String originalHtml=page.getWebResponse().getContentAsString(); //System.out.println(originalHtml+" +++++++++"); System.out.println(page.asXml()+" +++++++++"); PrintWriter out = response.getWriter(); out.println(page.asXml()); //out.println(originalHtml); } else { try { // not an _escaped_fragment_ URL, so move up the chain of servlet (filters) chain.doFilter(request, response); } catch (Servle…
type: Question
tagged with: htmlunit
has title: Why HTMLUnit always shows the HostPage no matter what url I type in (Crawlable GWT APP)?
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/13997424
type: UnansweredQuestion

http://stackoverflow.com/a/23645328
score: 1
has body: It's not allowed. As a workaround you could do this public &lt;T&gt; ArrayList&lt;T&gt; parseXML(Class&lt;T&gt; cls) throws ... ... T currentQuestion = cls.newInstance(); ...
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23645291

http://stackoverflow.com/comment/36538150
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23762730
has text: This is dependent on how your application is written. If the preferences are saved somewhere, there will likely be a file somewhere but you'll have to look for it. If it is in a file, you could try something like 'ls -Rlt' to list the files modified in your working directory and sub directories (ordered by timestamp).

http://stackoverflow.com/comment/135877551
type: Comment
comment on: http://stackoverflow.com/a/47212318
score: 0
type: AnswerComment
has text: Won't the call to stackOrder.removeElement be 0(N)

http://stackoverflow.com/comment/36452850
comment on: http://stackoverflow.com/a/23718086
type: AnswerComment
type: Comment
has text: Sounds stupid but I want to do this without adding any cody to the link class. I want to be able to modify it from the array. Deleting an item by just doing array[any].next = array[any].next.next is extremely easy, so surely there is one way to make me be able to have any number of .nexts'??
score: 0

http://stackoverflow.com/comment/36404606
type: Comment
has text: yeah that's what i'm already doing now. but it doesn't have a neat little drop down feature that can hide show groups stuff like that. oh well
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23685562

http://stackoverflow.com/comment/36547951
has text: @Kme drop this constructor, drop context field from the class and invoke DBHelper in the following way: `private SqlOpenHelper DBHelper = DBHelper = new SqlOpenHelper(this)`
comment on: http://stackoverflow.com/a/23767509
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23666145
score: -1
has comment: http://stackoverflow.com/comment/36354662
has comment: http://stackoverflow.com/comment/36354699
downvote count: 1
has body: I'm quite new to arrays and methods, and I've been seeing this error recurring through several programs: error '[' expected. In each occasion, it seems to correct itself as I adjust something else, but in this particular case, I am completely stumped. By the way, I am using several methods and arrays to create a quiz (before you ask, yes, this is an assignment and I agree, a list is a better way to handle this data - but that is not an option). It is possible that I am not passing the arrays correctly between methods, as I'm a little muddy on that process. From my understanding, in order to send/receive (i.e. import/export) an array or other variable between methods, I must declare that variable/array in the method header parameters. import java.util.Scanner; public class H7pseudo { public static void main(String[] args) { //call getAnswerkey method getAnswerkey(answerkey[i]); //call getAnswers method getAnswers(answers[i]); //call passed method? necessary or no? boolean passed = passed(answerkey[i], answers[i], qMissed[i], points); //Print results of grading if (passed) { System.out.println("Congratulations! You passed."); } else { System.out.println("Try again, sucka. You FAILED."); } //call totalPoints totalIncorrect(points); //call questionsMissed questionsMissed(qMissed[i]); } //get answer key (create answerkey array &amp; export) public static void getAnswerkey(answerkey[i]) { //create answerkey array here char[] answerkey; //determine number of questions (indices) answerkey = new char[20]; //input values (correct answers) for each index //for our purposes today, the answer is always 'c'. for (int i = 0; i &lt;=20; i++) { answerkey[i] = 'c'; } } //get student answers (create answers array &amp; export) public static void getAnswers(answers[i]) { //initialize scanner for user input Scanner scan = new Scanner(System.in); //create answer array here char[] answers; //determine number of questions (indices) answers = new char[20]; //prompt for user input as values …
has answer: http://stackoverflow.com/a/23667041
favorite count: 0
type: UnansweredQuestion
has title: Array in Method Header: error ']' expected (Java)
answer count: 4
upvote count: 0
tagged with: compiler-errors
tagged with: java
has comment: http://stackoverflow.com/comment/36354300
has answer: http://stackoverflow.com/a/23666162
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23666169
has comment: http://stackoverflow.com/comment/36354628
has answer: http://stackoverflow.com/a/23666166
has comment: http://stackoverflow.com/comment/36354295
tagged with: arrays

http://stackoverflow.com/a/23767231
has body: You'll need to create a PL/SQL wrapper function. Something like CREATE OR REPLACE FUNCTION myMethod( p_arg1 IN NUMBER, p_arg2 IN NUMBER ) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'MyJavaClass.MyMethod (java.lang.Integer, java.lang.Integer) return java.lang.String'; You'd then call the PL/SQL function summaryCall varchar2(20) := myMethod( 5, 3 );
answers question: http://stackoverflow.com/q/23766841
has comment: http://stackoverflow.com/comment/36989417
accepted answer of: http://stackoverflow.com/q/23766841
has comment: http://stackoverflow.com/comment/36550446
has comment: http://stackoverflow.com/comment/36550305
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/36538242
comment on: http://stackoverflow.com/q/23762017
type: Comment
type: QuestionComment
has text: Check out Jersey which is the reference implementation of the JAX-RS specification/API. The API is exceptionally easy to use, you'll probably love it. https://jersey.java.net/
score: 1

http://stackoverflow.com/q/23697944
has answer: http://stackoverflow.com/a/23701060
has comment: http://stackoverflow.com/comment/36414362
tagged with: nullpointerexception
tagged with: joptionpane
accepted answer: http://stackoverflow.com/a/23701060
tagged with: swing
type: AnsweredQuestion
has body: I could not imply the cancel option to method twice. (Both first input dialog box and second input dialog box for football) When I click cancel button, NullPointerException error occurs. Any idea? public void RandomDistribution() { String[] gametypes = {"NBA", "Euroleague", "NCAA", "NHL", "Football" }; String question = "Choose the Game"; String title = "Memory Game"; ImageIcon entry = new ImageIcon(getClass().getResource("background.jpg")); String c = (String) JOptionPane.showInputDialog(null, question, title, JOptionPane.PLAIN_MESSAGE, entry, gametypes,gametypes[4]); if (c.equals("Football")) { String[] f_level = {"Easy", "Normal", "Hard"}; String question_f = "Choose the Level"; String title_f = "Memory Game - Football"; String c2 = (String) JOptionPane.showInputDialog(null, question_f, title_f, JOptionPane.PLAIN_MESSAGE, null, f_level,f_level[2]); if (c2.equals("Easy")) { c = "Football1"; } else if (c2.equals("Normal")) { c = "Football2"; } else if (c2.equals("Hard")){ c = "Football3"; } } for (int i = 0; i &lt; 64; i++) { PicOfCells[i] = (int) (Math.random() * 64) + 1; for (int j = 0; j &lt; i; j++) { if (PicOfCells[i] == PicOfCells[j] &amp;&amp; i != j &amp;&amp; i != 0) { --i; } } } for (int i = 0; i &lt; 64; i++) { PicOfCells[i] = (PicOfCells[i] % 32); PicOfAllCells[i] = new ImageIcon(getClass().getResource(PicOfCells[i] + 1 + c +".gif")); } StartGame.doClick(); }
tagged with: java
has title: About JOptionPane CANCEL_OPTION
type: Question
score: 0
answer count: 1

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23663054
type: Tag
tags question: http://stackoverflow.com/q/23739353
tags question: http://stackoverflow.com/q/23651559
tags question: http://stackoverflow.com/q/23631158

notification-area
tags question: http://stackoverflow.com/q/23664997
type: Tag
tag name: notification-area

http://stackoverflow.com/comment/36333762
score: 0
type: Comment
type: QuestionComment
has text: Also research MockMVC using http://www.petrikainulainen.net/programming/spring-framework/integration-testing-of-spring-mvc-applications-forms/
comment on: http://stackoverflow.com/q/23655705

state
tag name: state
type: Tag
tags question: http://stackoverflow.com/q/23771898
tags question: http://stackoverflow.com/q/23733538

http://stackoverflow.com/comment/36495721
score: 0
has text: Provide more context and I'm sure you'll get plenty of answers
comment on: http://stackoverflow.com/q/23740655
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36283770
comment on: http://stackoverflow.com/a/23627778
score: 0
type: AnswerComment
has text: And Remember that Question's can't be Stupid..
type: Comment

http://stackoverflow.com/comment/36363724
type: Comment
has text: If the y-values in the dataset represent a length of time in milliseconds, then it is possible to use the [HMSNumberFormat][1] class to change the formatting to show hours, minutes and seconds. [1]: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/util/HMSNumberFormat.html
comment on: http://stackoverflow.com/a/23660191
score: 0
type: AnswerComment

http://stackoverflow.com/q/23731506
has answer: http://stackoverflow.com/a/23732015
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23731693
has answer: http://stackoverflow.com/a/23731589
tagged with: java
has comment: http://stackoverflow.com/comment/36478937
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/36479086
has comment: http://stackoverflow.com/comment/36478882
type: Question
has body: I have a simple GUI in which there are two buttons: Print and Stop. When the user presses print, an already saved number is printed continuously in a loop. When the user presses Stop, the printing stops. I am handling the printing of the number in a separate thread, because I need the thread to sleep for a millisecond before printing again. printBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Thread a= new Thread(new Runnable(){ public void run(){ textArea.setText(""); for (int i=0; i&lt;10; i++){ int result= 0; System.out.println(result+"\n"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); a.start(); } }); Now in the ActionListener of the Stop button, I want the first thread to be interrupted or stopped. How can I do that, since it needs to be interrupted from another thread?
has comment: http://stackoverflow.com/comment/36478957
tagged with: interrupt
score: 0
answer count: 3
has title: Threads: How to interrupt a thread from outside of that thread
accepted answer: http://stackoverflow.com/a/23731589
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/23731693

http://stackoverflow.com/comment/36515505
has text: That's the output of the icon's `toString`, which is apparently the image path.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23750915

http://stackoverflow.com/q/23629830
has answer: http://stackoverflow.com/a/23658879
favorite count: 0
has title: Camel FTP file automation
has comment: http://stackoverflow.com/comment/36300111
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22651690
tagged with: ftp
has body: I have two win2008 R2 server.When trying to transfer file through Apache Camel I am getting this error- 16:27:27,533 94053 [Camel (camelContext) thread #1 -ftp:// ctsftp@xxx.xxx.xxx.xxx:xx/ftproot] WARN org.apache.camel.component.file.remote.RemoteFilePollingConsumerPollStrategy - Consumer FtpConsumer[ftp:// ctsftp@xxx.xxx.xxx.xxx:xx/ftproot?disconnect=true&amp;exclusiveReadLockStrategy=%23FTPFileLockStrategy&amp;filter=%23ResAndAckFilter&amp;idempotent=true&amp;idempotentRepository=%23ResAndAckStore&amp;localWorkDirectory=C:/temp&amp;passiveMode=true&amp;password=******] could not poll endpoint: Endpoint[ftp:// ctsftp@xxx.xxx.xxx.xxx:xx/ftproot?disconnect=true&amp;exclusiveReadLockStrategy=%23FTPFileLockStrategy&amp;filter=%23ResAndAckFilter&amp;idempotent=true&amp;idempotentRepository=%23ResAndAckStore&amp;localWorkDirectory=C:/temp&amp;passiveMode=true&amp;password=******] caused by: File operation failed: 550 Permission denied Cannot change directory to: /. Code: 550 org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 550 Permission denied Cannot change directory to: /. Code: 550 at org.apache.camel.component.file.remote.FtpOperations.doChangeDirectory(FtpOperations.java:628) at org.apache.camel.component.file.remote.FtpOperations.changeCurrentDirectory(FtpOperations.java:591) at org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:53) at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:100) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) at jav…
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23632244
type: Question
tagged with: apache-camel
answer count: 2
tagged with: apache
downvote count: 0

http://stackoverflow.com/q/23737261
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
has title: How to properly import a pure simple servlet in a JSF Spring config environment?
type: Question
linked to: http://stackoverflow.com/q/10982762
tagged with: java
has answer: http://stackoverflow.com/a/23738928
tagged with: jsf-2
answer count: 2
has body: I have a project developed with JSF and Spring. My intern has to a make a kind of 'web service' to return json that he uses to make some graphics with ajax/jquery queries. We read that jsf was not the best stuff to make a web service style application. We make it work with jsf but we read that the best way was to make a simple servlet or to use JAX-RS. To be simple as possible, and to make it understand the basis, we go through a simple servlet class. So we only configure in web.xml ServletNormal com.clb.genomic.lyon.beans.ServletNormal ServletNormal /ServletNormal.do/* And then the intern a simple garbage code to test : public class ServletNormal extends HttpServlet{ private static final long serialVersionUID = 123L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("application/json"); String paramAuteur = request.getParameter( "projet" ); String message= ""; // Test with harcoded json if(paramAuteur.equals("Profile")) { message = "{\"value\":[23,58,87,115],\"Categorie\":[\"1-2013\",\"2-2013\",\"3-2013\",\"4-2013\"]}" ; } else if(paramAuteur.equals("Fake1")){ message = "{\"value\":[23,58,87,115,141,173,203],\"Categorie\":[\"1-2013\",\"2-2013\",\"3-2013\",\"4-2013\",\"5-2013\",\"6-2013\",\"7-2013\"]}" ; } else{ message = "{\"value\":[23,58,87,115,141,173,203,227,245,262,277,300],\"Categorie\":[\"1-2013\",\"2-2013\",\"3-2013\",\"4-2013\",\"5-2013\",\"6-2013\",\"7-2013\",\"8-2013\",\"9-2013\",\"10-2013\",\"11-2013\",\"12-2013\"]}" ; } PrintWriter out = response.getWriter(); out.print(message); } } Then in ajax/jquery, we called the servlet as this : /ServletNormal.do/?projet=Profile to get back json for graphics drawing. This works fine...but to be sure, Is this method is clean (exept hard coded Json)? Or is it dirty and we shouldn't do as this ? Is there a better way…
tagged with: servlet-3.0
has answer: http://stackoverflow.com/a/23737550
score: 0

http://stackoverflow.com/q/23700264
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23700627
has body: So I have incoming data that looks something like this: Applications 7 days 6 days And I'm trying to create regex that will match this line but not a line that has another column, like this: Applications 7 days 6 days 5 days The regex that I'm trying to use is: ^(.*?)(\s){4,}(.*?)(\s){4,}[^(\s){2}]+ Where [^(\s){2}]+ would mean selecting everything up to a double space. The problem with this is that it doesn't work to begin with. the second line I have would still match this. Is there any regex I can use to only match the 3 column table and not the 4 column, 5 column, etc.?
upvote count: 1
linked to: http://stackoverflow.com/q/22937618
type: Question
has comment: http://stackoverflow.com/comment/36418793
has comment: http://stackoverflow.com/comment/36418767
has answer: http://stackoverflow.com/a/23700482
answer count: 2
downvote count: 0
favorite count: 0
has title: Java regex to identify 3 column table from ascii text
accepted answer: http://stackoverflow.com/a/23700482
tagged with: regex
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23700627

http://stackoverflow.com/q/23625693
type: Question
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23625826
linked to: http://stackoverflow.com/q/16272137
answer count: 2
downvote count: 0
has body: I want to find the first request which is coming to jsp. Once a window is closed, again I want to find the first request coming to jsp, but I do not want to restart my server. I am trying this: String name=session.getAttribute("val"); if(name!=null) { //something } else { //something } It is working only for the first request. After that, I have to restart the server again and again. Moreover, I want to find the time spent on particular jsp.
tagged with: jsp
favorite count: 0
has title: how to find first request in jsp
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23626079
has answer: http://stackoverflow.com/a/23625826
upvote count: 3
linked to: http://stackoverflow.com/q/9626059
possible better answer: http://stackoverflow.com/a/23626079

http://stackoverflow.com/comment/36379298
has text: Check [Java API To Generate Java Source Files](http://stackoverflow.com/questions/121324/a-java-api-to-generate-java-source-files) and [Code Generation Techniques](http://www.onjava.com/pub/a/onjava/2003/09/03/generation.html).
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23677168

http://stackoverflow.com/a/23721279
score: 11
has body: Break the expression in parts to better understand them: int[] first = new int[]{1}; // create a new array with one element (the element is the number one) int[][] second = new int[][]{first}; // create an array of the arrays. The only element of the outer array is the array created in the previous step. int[] third = second[0]; // retrieve the first (and only) element of the array of array `second`. This is the same again as `first`. Now we will merge those expressions again. First we merge first and second: int[][] second = new int[][]{new int[]{1}}; int[] third = second[0]; OK, no big deal. However the expression second can be shortend. The following is equivalent: int[][] second = new int[][]{{1}}; int[] third = second[0]; Now we merge second and third. We can directly write: int[] third = new int[][]{{1}}[0]; And there we are.
downvote count: 0
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/23721222

http://stackoverflow.com/q/23717475
has body: I'm trying to make a little racing game for fun. So far I have two rectangles that successfully move and I have a map setup for them to race through. My map is also made up of rectangles. Now previously I made a mistake by not giving my two racers a specific objectified name. So they're just two locations that move. Now what i'm trying to do is, to make the rectangle walls actually be walls so they don't just go through them. I've heard I can cover up my mistakes if I make the walls like arrays(not sure how) so they don't go through them. Is this correct? Is there any other way to do this? Here is how it looks like so far: Thank you and here is my code. First class is the info for frames and black rectangle. Second class is the info for the blue rectangles and the walls. First Class: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; 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.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class MyGame extends JPanel implements ActionListener, KeyListener { Timer t = new Timer(5, this); int x = 0, y = 0, velx =0, vely =0, g = 0; private Color color; public MyGame() { t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } @Override public Dimension getPreferredSize() { return new Dimension(1300, 750); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(color); g.fillRect(x, y, 50, 30); } @Override public void actionPerformed(ActionEvent e) { if (x &lt; 0) //stops us from going backwards past x = 0 { velx = 0; x = 0; } if (y &lt; 0) //stops us from going to the sky { vely = 0; y = 0; } if (y &gt; 725) // stops us from going through the ground { vely = 0; y = 725; } if (x &gt; 1250) // stops us from going through the wall { velx = 0; x = 1250; } x += velx; y += vely; repaint(…
has answer: http://stackoverflow.com/a/23718402
score: 0
answer count: 1
tagged with: frame
has comment: http://stackoverflow.com/comment/36458062
has comment: http://stackoverflow.com/comment/36452044
has title: How to execute an action when x and y location enters another location?
tagged with: jframe
tagged with: contacts
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36452092
tagged with: swing
type: Question

http://stackoverflow.com/comment/36361562
type: Comment
has text: `if(line.length() > 0) {...` ? Sorry!! I didn't get you
comment on: http://stackoverflow.com/a/23669269
score: 0
type: AnswerComment

http://stackoverflow.com/q/23635263
accepted answer: http://stackoverflow.com/a/23635927
has comment: http://stackoverflow.com/comment/36294676
type: Question
tagged with: graphics
tagged with: java
has body: Is there a method like clearRect(), but clearArc() ? I want to fill all the screen except one circle, something like that: ( I'm doing that in paintComponent() ) P.S. Background is transparent
tagged with: draw
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36294249
has comment: http://stackoverflow.com/comment/36295545
has comment: http://stackoverflow.com/comment/36294027
tagged with: paintcomponent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23635927
has title: Java Graphics clear arc

http://stackoverflow.com/comment/36554943
has text: No, seriously, this is not the right way to do this. You want to use `PreparedStatement`. I'll post an answer in a little while.
comment on: http://stackoverflow.com/a/23771133
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/23677299
has body: Minimize unnecessary database call. If your fields on database is changing, you can shift from relational to NoSQL database like MongoDB. You can perform multithreading on the server side for data processing and clustering of application servers. While using multithreading use it effectively, be aware of the sychronized keyword, it will degrade the performance to some extend. Perform best practice of coding, don't use more instance variable, try to use local variable, it will make you thread safe also. You can use Mybatis for ORM also for large queries. You can perform caching on DAO layer, service layer and even in client side but be sure to sychronize with the database, you can use different caching soutions. You can do database indexing for first retrival. Do not use same service for large data querying break it down into different services which will help u to process in multithreading way. If the application is not very hard real time system you can use messaging solution also, like asychronously processing of data.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23628501

http://stackoverflow.com/q/23707566
has comment: http://stackoverflow.com/comment/36523258
tagged with: regex
linked to: http://stackoverflow.com/q/4839894
upvote count: 11
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/36432865
has answer: http://stackoverflow.com/a/23749427
has comment: http://stackoverflow.com/comment/36452560
has comment: http://stackoverflow.com/comment/36512988
has answer: http://stackoverflow.com/a/23749261
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23707627
has comment: http://stackoverflow.com/comment/36547047
has comment: http://stackoverflow.com/comment/36512253
tagged with: java
downvote count: 3
tagged with: sanitization
accepted answer: http://stackoverflow.com/a/23749261
has title: How do I sanitize input before making a regex out of it?
has comment: http://stackoverflow.com/comment/36432785
type: Question
possible better answer: http://stackoverflow.com/a/23707627
has body: I'm making a Java program that parses the user's input with a regex. For instance, if the user inputs /me eats, it should match the /me and replace it with &lt;move&gt;. However, Java isn't properly matching because / is a special character to regexes. How do I automatically replace all the various special Java regex characters with escapes? For instance: /me becomes \/me * becomes \* [ becomes \[ and so on... before it's put into Pattern.compile. This is not a command system. I am allowing users to specify how to denote a roleplaying move. If it helps, here is a mockup of how the user specifies what they consider a roleplay move:
has comment: http://stackoverflow.com/comment/36432820
has comment: http://stackoverflow.com/comment/36432837
has comment: http://stackoverflow.com/comment/36433059
answer count: 3
has comment: http://stackoverflow.com/comment/36512935

http://stackoverflow.com/comment/36540486
comment on: http://stackoverflow.com/q/23764029
type: Comment
type: QuestionComment
has text: What's wrong? Where's the question?
score: 2

http://stackoverflow.com/q/23642961
has comment: http://stackoverflow.com/comment/36309462
has title: What is best practice to declear and assign lots of TextViews
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23647426
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36309346
type: Question
has comment: http://stackoverflow.com/comment/36309259
answer count: 1
has answer: http://stackoverflow.com/a/23647426
has comment: http://stackoverflow.com/comment/36309471
has comment: http://stackoverflow.com/comment/36309408
has body: Hello so i am making an app which requires about 32 TextViews and about 32 ImageViews, Now my problem is I dont know how i can initialize and assign all of these neatly, Right now I am adding them in one by one TextView textView1; TextView textView2; TextView textView3; ... And then textView1 = (TextView)findViewById(R.id.TextView1); textView2 = (TextView)findViewById(R.id.TextView2); textView3 = (TextView)findViewById(R.id.TextView3); ... and the same with ImageView's. There must be a nicer cleaner way to do this, but i'm not quite sure how to do this. Can anyone help me out? Example of what I am doing(I blacked the images out) Thanks :) P.S I have found answers similar to my question but not quite what i'm looking for. EDIT: I ended up using a GridView as sugected by Setu and Onur, Thanks guys :)
tagged with: android

http://stackoverflow.com/a/23709611
has body: The idia is to build up the xml of message by processing the HierarchicalStreamReader. If you go down into &lt;messsage&gt; by calling reader.goDown() unfortunately reader.getValue() does not return the whole content of this element. Model @XStreamAlias("parent") @XStreamConverter(value = ParentConverter.class) public class Parent { private final String message; public Parent(final String message) { this.message = message; } public String getMessage() { return message; } } Converter public class ParentConverter implements Converter { @Override public boolean canConvert(@SuppressWarnings("rawtypes") final Class type) { return Parent.class.isAssignableFrom(type); } @Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { throw new UnsupportedOperationException("unmarshaling only"); } @Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { reader.moveDown(); if (!"message".equals(reader.getNodeName())) { throw new ConversionException("Expected message, but was " + reader.getNodeName()); } final StringBuilder message = new StringBuilder(); while (reader.hasMoreChildren()) { reader.moveDown(); buildRecursiveMessage(reader, message); reader.moveUp(); } reader.moveUp(); final Parent parent = new Parent(message.toString()); return parent; } private void buildRecursiveMessage(final HierarchicalStreamReader reader, final StringBuilder sb) { // Build start-tag final String nodeName = reader.getNodeName(); sb.append("&lt;" + nodeName); // Build attributes final int numAttributes = reader.getAttributeCount(); if (numAttributes &gt; 0) { sb.append(" "); for (int i = 0; i &lt; numAttributes; i++) { final String attributeName = reader.getAttributeName(i); final String attributeValue = reader.getAttribute(i); sb.append(attributeName + "=\"" + attributeValue + "\""); final boolean lastAttribute = (i == numAttributes - 1); if (!lastAttribute) { sb.append(", "); } } } // Build children final b…
type: Answer
answers question: http://stackoverflow.com/q/23678919
has comment: http://stackoverflow.com/comment/36445942
has comment: http://stackoverflow.com/comment/36523370
has comment: http://stackoverflow.com/comment/36522774
accepted answer of: http://stackoverflow.com/q/23678919
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23674868
score: 2
downvote count: 0
has body: Problem: After deploying to Tomcat, if I try to go to localhost:8080 page I get The requested resource (/) is not available.. But I can go through localhost:8080/dispatcher path. Accessing your controller from the Servlet Container's perspective - what you're doing when you type localhost:8080/dispatcher - requires a lot of information in the url path. For example, your HelloController is configured to be handle by the mvc-dispatcher Servlet mvc-dispatcher Servlet is declared in a web application (defined by your web.xml) there could be multiple Servlets in your web application the web application is deployed to your Servlet container (Tomcat) there could be multiple web applications in the Servlet Container There's lots of ambiguity in resolving a url when you take all this into consideration. As @san krish pointed out, and assuming you've deployed your application to Tomcat's root context, you can force everything through mvc-dispatcher and map it to /* as default, and end up serving your HelloController from localhost:8080/. Why does simple test works if we do mockMvc.perform(get("/")) instead of mockMvc.perform(get("/dispatcher"))? Accessing your controller from mockMvc in your test is pretty localized. Depending on how your test was set up, a MockMvc instance was created either from: MockMvcBuilders.standaloneSetup(controller) - here your controller is passed directly to the test for testing, therefore MockMvc knows nothing about a mvc-dispatcher and it's "/dispatcher" path. MockMvcBuilders.webAppContextSetup(webApplicationContext) - here, the test class is annotated with a @ContextConfiguration that points to your "mvc-dispatcher" xml or @Configuration class. In this situation, MockMvc would be acting on everything localized under "mvc-dispatcher" so there's no need to reference the "dispatcher" in the path.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23671465

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23736903
tags question: http://stackoverflow.com/q/23660642
tags question: http://stackoverflow.com/q/23647302
tags question: http://stackoverflow.com/q/23759059
type: Tag
tags question: http://stackoverflow.com/q/23713959
tags question: http://stackoverflow.com/q/23624228

http://stackoverflow.com/comment/36440139
comment on: http://stackoverflow.com/a/23711047
type: Comment
has text: you could change your edit method to something like this: just change the getter methods do setter methods -> `setID("value")` and get rid of this line `produits.add(p);`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/84779826
comment on: http://stackoverflow.com/a/23695159
type: Comment
score: 0
type: AnswerComment
has text: **UCDetector** does not detect the calls to methods from `.xml` files (in case of spring web-flow). So, it shows that the method is not being called from anywhere in the project, but ideally it is being called from web-flow. Is there any way where I can check the calls from web-flow as well apart from other `.java` files?

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/23647340
tags question: http://stackoverflow.com/q/23629947

http://stackoverflow.com/q/23728493
possible better answer: http://stackoverflow.com/a/23728542
accepted answer: http://stackoverflow.com/a/23728539
tagged with: ioexception
has comment: http://stackoverflow.com/comment/36473534
upvote count: 3
score: 1
tagged with: java
has body: import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.FileWriter; import java.io.BufferedWriter; import java.io.BufferedReader; /** * This program reads a text file line by line and print to the console. It uses * FileOutputStream to read the file. * */ public class Writer { public static void main(String[] args) { File file = new File("C:\\Users\\McIntosh\\Documents\\APCS_Contest\\randomGenProb1.txt"); File file2 = new File("C:\\Users\\McIntosh\\Documents\\APCS_Contest\\Letters.txt"); FileWriter fw = new FileWriter(file2); BufferedWriter bw = new BufferedWriter(fw); FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis = null; try { fis = new FileInputStream(file); // Here BufferedInputStream is added for fast reading. bis = new BufferedInputStream(fis); dis = new DataInputStream(bis); int count = 0; String str; char temp; String abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char[] list = abc.toCharArray(); // dis.available() returns 0 if the file does not have more lines. while (dis.available() != 0) { str = dis.readLine(); for(int x=0;x&lt;str.length()-1;x++) { for(int y=0;y&lt;list.length;y++) { temp = str.charAt(x); if(temp==(list[y])) { bw.write(temp); count++; } } } } System.out.println(count+" Chars found, and added"); System.out.println("Finished! Chars added to file: " + file2); // dispose all the resources after using them. fis.close(); bis.close(); dis.close(); bw.flush(); bw.close(); fw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } I keep getting the error: Error: unreported exception java.io.IOException; must be caught or declared to be thrown I'm trying to write into the file from strings from another file. I am taking info in from 2 different files and writing into …
type: Question
has comment: http://stackoverflow.com/comment/36473653
answer count: 2
has comment: http://stackoverflow.com/comment/36473558
has comment: http://stackoverflow.com/comment/36473567
tagged with: exception
has answer: http://stackoverflow.com/a/23728539
has comment: http://stackoverflow.com/comment/36473636
has comment: http://stackoverflow.com/comment/36473509
favorite count: 0
has comment: http://stackoverflow.com/comment/36473487
has answer: http://stackoverflow.com/a/23728542
downvote count: 2
tagged with: file
has title: What IOException do i use for FileWriter
has comment: http://stackoverflow.com/comment/36474163
tagged with: try-catch
type: AnsweredQuestion

http://stackoverflow.com/q/23643189
tagged with: android
has comment: http://stackoverflow.com/comment/41806239
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/31492816
linked to: http://stackoverflow.com/q/26663539
linked to: http://stackoverflow.com/q/31039257
has answer: http://stackoverflow.com/a/31492816
accepted answer: http://stackoverflow.com/a/24419696
type: AnsweredQuestion
tagged with: java
has body: I'm writing my unit tests using gradle in Android Studio. I have the tests located in: src/androidTest/java That works just fine. Now in my tests I want to access a resource that is defined in: src/androidTest/res Specifically, I want to get src/androidTest/res/layout/mylayout.xml. The problem is the R class for my test package or any package for that matter has mylayout defined. I did this on my build.gradle and it didn't make a difference: sourceSets { androidTest.resources.srcDirs = ['src/res'] } How do I supply resources to androidTest classes that is only visible to the androidTest?
type: Question
upvote count: 15
tagged with: r.java-file
has title: Android gradle src/androidTest/res/layout/mylayout.xml not found in mypackage.R
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37746617
score: 15
favorite count: 0
has answer: http://stackoverflow.com/a/24419696

http://stackoverflow.com/q/23615967
has title: Exception in thread "main": Unrecognized field
answer count: 2
has answer: http://stackoverflow.com/a/23616087
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/36381818
possible better answer: http://stackoverflow.com/a/23616087
tagged with: exception
accepted answer: http://stackoverflow.com/a/23616038
has body: After struggling with errors in my java code and resolving them I finally have proceeded to the running stage, but I get an exception error after I run it. I am trying to convert json from a weather API to java object using jackson library. I have several classes for setting and getting the java objects including: City.java, Coord.java, List1.java, Temp.java, Weather.java. I have class named as usertest.java for mapping the objects as a test. My code is as below: A sample of my getters and setters: City.java package weather.data; //import java.util.List; public class City{ private Coord coord; private String country; private Number id; private String name; private Number population; ... //getters and setters } usertest.java package weather.data; import weather.data.City; import weather.data.Coord; import weather.data.list1; import weather.data.Temp; import weather.data.Weather; import com.fasterxml.jackson.core.JsonParseException; //import com.fasterxml.jackson.annotation.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonMappingException; import java.io.File; import java.net.URL; import java.io.IOException; public class usertest { public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException { URL jsonUri = new URL("https://gist.githubusercontent.com/anonymous/4b32c7ef1ceb5dd48bf5/raw/ef1987551faa3fb61473bb0e7aad70a228dc36d6/gistfile1.txt"); ObjectMapper mapper = new ObjectMapper(); City city = mapper.readValue(jsonUri, City.class); System.out.println(city.getCoord()); } } And the error I get after running the code: Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "cod" (class weather.data.City), not marked as ignorable (5 known properties: , "coord", "country", "id", "name", "population"]) Any help would highly appreciated.
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36256286
tagged with: java
downvote count: 2
upvote count: 1
type: Question
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23616038

http://stackoverflow.com/q/23630886
tagged with: keylistener
has comment: http://stackoverflow.com/comment/36285596
has comment: http://stackoverflow.com/comment/36285758
score: 2
answer count: 1
downvote count: 0
has body: i'm making a keylistener that listens to ctrl-1 and ctrl-2. Im making a quiz for teams. Team 1 should press ctrl-1 if they want to answer. Team 2 should press ctrl-2 if they want to answer. The reason i chose for ctrl is because there are 2 control keys. So 2 teams can play against eachother on 1 keyboard. I want team 1 to use the left control and the numbers under F1-F12. And team 2 to use the right control and the numbers on the numlock. My code registrates the triggers of team 1 but not from team 2. Here is my code : public void keyPressed(KeyEvent e) { if((QuizController)getController() != null){ if(e.getKeyCode () == KeyEvent.VK_1){ if((e.getModifiers() &amp; KeyEvent.CTRL_MASK) != 0) System.out.println("Team 1"); } if(e.getKeyCode () == KeyEvent.VK_2){ if((e.getModifiers() &amp; KeyEvent.CTRL_MASK) != 0) System.out.println("Team 2"); } } } EDIT : I just did it with key bindings, gives the same problem, here is the code. AbstractAction team1 = new AbstractAction() { public void actionPerformed(ActionEvent arg0) { System.out.println("Team 1"); } }; AbstractAction team2 = new AbstractAction() { @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Team 2"); } }; getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_1, java.awt.event.InputEvent.CTRL_DOWN_MASK),"actionMap1"); getActionMap().put("actionMap1", team1); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_2, java.awt.event.InputEvent.CTRL_DOWN_MASK),"actionMap2"); getActionMap().put("actionMap2", team2); Thank you!
has comment: http://stackoverflow.com/comment/36284756
has comment: http://stackoverflow.com/comment/36284501
favorite count: 0
has comment: http://stackoverflow.com/comment/36285861
has answer: http://stackoverflow.com/a/23631875
has title: Keylistener not responding to numlock numbers
tagged with: num-lock
has comment: http://stackoverflow.com/comment/36284714
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36284589
has comment: http://stackoverflow.com/comment/36285972
tagged with: swing
type: Question
tagged with: key-bindings
has comment: http://stackoverflow.com/comment/36285633
has comment: http://stackoverflow.com/comment/36284586

http://stackoverflow.com/q/23626136
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36275714
has answer: http://stackoverflow.com/a/23626175
has answer: http://stackoverflow.com/a/23626219
tagged with: string
has comment: http://stackoverflow.com/comment/36276089
duplicate of: http://stackoverflow.com/q/6219263
has comment: http://stackoverflow.com/comment/36275867
has comment: http://stackoverflow.com/comment/36275883
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23626157
linked to: http://stackoverflow.com/q/6219263
has title: Java String manipulation query using trim() and length()
has comment: http://stackoverflow.com/comment/36275872
has comment: http://stackoverflow.com/comment/36275908
has comment: http://stackoverflow.com/comment/36276816
tagged with: trim
has comment: http://stackoverflow.com/comment/36275945
has comment: http://stackoverflow.com/comment/36276015
tagged with: java
has body: public class X { public static void main(String[] args) { String s1=" abc xyz "; System.out.println(s1.length()); s1.trim(); System.out.println(s1.length()); System.out.println(s1.trim().length()); } } O/p: 9 9 7 Kindly explain to me why s1.trim().length() is 7 and not 9 as s1 will still be pointing to the old string ie " abc xyz " ?
type: Question
linked to: http://stackoverflow.com/q/14919019
has comment: http://stackoverflow.com/comment/36275862
has comment: http://stackoverflow.com/comment/36276159

http://stackoverflow.com/comment/36490461
comment on: http://stackoverflow.com/q/23735703
score: 0
has text: @JonK Apparently it's "Why do I have to define an explicit constructor? I'm getting these errors when I don't define one".
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36339902
score: 0
type: AnswerComment
has text: thanks for your tip Kevin. i just wondering are you pointing to this loop: public static void display(char[] a) { for (int i = 0; i < a.length; i++) { System.out.print(a[i]); } System.out.println(); }
type: Comment
comment on: http://stackoverflow.com/a/23658603

http://stackoverflow.com/comment/36479896
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23732054
has text: al.remove(0) removes the element from positon 0.

http://stackoverflow.com/a/23652756
type: Answer
answers question: http://stackoverflow.com/q/23652663
upvote count: 1
has comment: http://stackoverflow.com/comment/36348455
score: 1
has body: Have you mocked ChefServiceProvider.getApi() ? Mockito is telling you that you've not passed it a mocked object. Native Mockito won't let you mock static methods. I would perhaps check out PowerMock for additional features allowing you to do this sort of stuff, and investigate inversion-of-control for the future to allow you to inject such dependencies. PowerMock is a framework that extend other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more When I've used PowerMock I've used it to create a unit test around poorly written code, and then refactored the code to a better pattern, using PowerMock to perform regression tests. Once refactored I can then use standard Mockito practises and remove the need for PowerMock.
downvote count: 0

http://stackoverflow.com/a/23724980
upvote count: 14
answers question: http://stackoverflow.com/q/23723763
type: Answer
score: 14
downvote count: 0
has body: I think its an edge case, but also a bug. A simpler example is String text = "0.000000000000000001e326"; System.out.println(Double.parseDouble(text)); System.out.println(new BigDecimal(text).doubleValue()); which prints in Java 7 update 25 and Java 8 update 5 Infinity 1.0E308 The BigDecimal parsing and convert to double shows this number is representable.
has comment: http://stackoverflow.com/comment/36466749

http://stackoverflow.com/q/23660523
has body: I receive this error in running a Java program within JDeveloper and I have no idea what to do to fix the error: javax.naming.CommunicationException: Could not obtain connection to any of these urls: 160.151.120.33:999 I know I can change the URL and port by changing the values in a jndi.properties file. I am quite new to Java, JDeveloper, EJB, and JBoss. This is a desktop app that is failing to connect. Am I supposed to deploy the EJB to a JBoss server first? How does the EJB, JBoss and a desktop Java app work and communicate with each other?
type: Question
tagged with: java
tagged with: jboss
answer count: 1
has title: JDeveloper error running java program
tagged with: jdeveloper
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23665787

http://stackoverflow.com/a/23638651
accepted answer of: http://stackoverflow.com/q/23638625
answers question: http://stackoverflow.com/q/23638625
upvote count: 11
type: AcceptedAnswer
has body: Absolutely - they can start your app from the command line rather than by double-clicking on the jar file, and any console output will be shown. Alternatively, they could write their own wrapper class which redirected System.out to a file. But fundamentally, if you have any security-sensitive information in your jar file, it will be fairly easy to extract it. It's not clear whether the password in question is something that the user has typed in, or whether it's a password embedded in the jar file - but writing it to the console at least sounds like a bad idea either way.
type: Answer
score: 11
downvote count: 0

http://stackoverflow.com/comment/36351174
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23664267
has text: Thank you! was more than a month that I could not solve the problem! WE LOVE YOU!!
score: 0

http://stackoverflow.com/q/23744467
has answer: http://stackoverflow.com/a/23744510
score: -2
favorite count: 0
linked to: http://stackoverflow.com/q/1064977
has title: how to set the background of a jframe to a picture? useing a Jlabel
tagged with: jframe
type: UnansweredQuestion
downvote count: 2
tagged with: swing
has body: i Need to create set the Background of my jframe to a picture can anyone help me? i also have a second class called FolderCreate but it dosent use the frame at all. it is gonna make it so that the layout dosent look bad. /* Conrad Rowan &amp; Hayley Cummings * Period 6 * Address book */ //change all the text fields to text areas import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.GridLayout; import java.awt.Image; import java.awt.Panel; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import javax.swing.AbstractButton; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Scanner; import javax.imageio.ImageIO; public class AddressFinal implements ActionListener, ListSelectionListener{ // The start. JLabel myLabel = new JLabel(new ImageIcon("C/Users/399430/Desktop/eagle.jpg")); //JPanels's JPanel panel = new JPanel(); JPanel panel2 = new JPanel(); String toThings = new String(); //JFrame's JFrame frame = new JFrame(); //Containers Container east = new Container(); Container south = new Container(); Container west = new Container(); Container north = new Container(); //JButtons JButton create = new JButton("Create"); JButton save = new JButton("Save"); //The Layout GridLayout grid = new GridLayout(3, 1); //Text Fields JTextArea labelsTF = new JTextArea("Enter in some information in the box to the bottom right, if you'd like!"); JTextArea finderBarTF = new JTextAr…
tagged with: java
tagged with: image
duplicate of: http://stackoverflow.com/q/1064977
has comment: http://stackoverflow.com/comment/36503340
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/a/23714469
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36447750
has body: As Karakuri said, restricting the ImageView size to 56dpx56dp doesn't mean that the entire bitmap is not loaded. First load the bitmap from the file (or resource), and shrink it. Use //For resource image.setImageBitmap(decodeSampledBitmapFromResource("android.resource://com.my.package/drawable/image_name")); //For file image.setImageBitmap(decodeSampledBitmapFromResource(filepath)); public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 2; if (height &gt;= reqHeight || width &gt;= reqWidth) { inSampleSize *= 2; } return inSampleSize; } public static Bitmap decodeSampledBitmapFromResource(String file, int reqWidth, int reqHeight) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(file, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(file, options); }
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23713608
upvote count: 1
has comment: http://stackoverflow.com/comment/36447570
downvote count: 0
answers question: http://stackoverflow.com/q/23713608

http://stackoverflow.com/q/23627255
tagged with: java
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: data-driven
has title: data driven framework with java for drop down
has answer: http://stackoverflow.com/a/23633558
tagged with: selenium-webdriver
tagged with: selenium
type: Question
has body: I am creating data in excel for DataDriven framework.I am getting problem how to use that data if there is drop down. example- for Travelling site there is drop-down list of cites in arrival list If I am keeping all cites name in excel how to use it in framework.

http://stackoverflow.com/q/23618729
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/23623045
has comment: http://stackoverflow.com/comment/36262011
has title: Java to Lua socket communication error
has body: Okay, so I have a project where I'm working with a Client (written in Lua) and a Server (written in Java). I'm using LuaSocket for the client and DatagramSockets for the server. The problem is when I send one string from the client in Lua, and receive it on the server(and convert the bytes to a string), it doesn't recognize the value of the string as equal to what it should be(I'm using .equals() for evaluation). I've printed the result and compared it to the string(everything checked out); I've even compared the bytes (using .getBytes()), they even checked out. The most annoying part of this is that when I analyze the string with .startsWith() it evaluates true, but nothing else works. I've looked into the string encoding of both languages, but I'm relatively new to sockets and this is beyond me. Edit: Upon writing some example code to demonstrate the problem, I solved it. Here is the code: Client: local socket = require "socket" local udp = socket.udp() udp:settimeout(0) udp:setpeername("localhost", 1234) udp:send("foo") Server: public class Main { public static void main(String args[]) throws Exception { DatagramSocket server = new DatagramSocket(1234); byte[] incomingBytes = new byte[512]; DatagramPacket incomingPacket = new DatagramPacket(incomingBytes, incomingBytes.length); server.receive(incomingPacket); String received = new String(incomingBytes); System.out.println(received); System.out.println(received.equals("foo")); for (byte b : received.getBytes()) { System.out.print(b + " "); } System.out.print("\n"); for (byte b : "foo".getBytes()) { System.out.print(b + " "); } System.out.print("\n"); } } The result: foo false 102 111 111 0 0 0 *I'm not going to include all but there are 506 more* 102 111 111 The string I had been examining the bytes from previously was split at several points, and that would explain why I didn't notice this.
tagged with: udp
score: 5
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/23623045
tagged with: lua
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36267154
has comment: http://stackoverflow.com/comment/36262901
type: Question

http://stackoverflow.com/comment/36348642
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23659408
score: 0
has text: And what do you mean by "junit variable java.io.tmpdir"? As far as I know, the variable java.io.tmpdir is a JVM system property, not a junit variable.

http://stackoverflow.com/comment/36339805
type: AnswerComment
has text: You really should not use `impl_*` methods under any circumstances. They are public only because the private API needs to be able to access them, and should not be considered part of the public API. They are marked deprecated to encourage you not to use them and are deliberately omitted from the API documentation. There is no guarantee they will be present even in a minor update of the JRE.
type: Comment
comment on: http://stackoverflow.com/a/23655995
score: 0

http://stackoverflow.com/comment/36291599
type: QuestionComment
comment on: http://stackoverflow.com/q/23633992
has text: Eclipse 3.2 is almost eight years old and has not been supported for very long. You will probably not find anyone interested in putting in the time to investigate this. You will need to either convince your employer to use a more modern Eclipse or put down the time yourself. Sorry.
score: 0
type: Comment

http://stackoverflow.com/q/23731034
tagged with: java
tagged with: export-to-excel
type: Question
downvote count: 0
has title: How to write data into a .SYLK File Or Convert SLK File data
tagged with: slk
favorite count: 0
answer count: 0
upvote count: 3
type: UnansweredQuestion
has body: I have a code that contains a function taking columns and rows and exporting it to an SLK file. It uses a specific style-sheet ( for example dates are shown in a certain way, and prices in another one). However, the file's representation has been written using a long string and is undocumented. I need to write the same function using java and wanted to know if there is a better way for re-writing this code , for instance using apache HSSFWorkbook class. However , i don't know what my current string representation means. So my questions are: Is there other open source classes that i can use writing this code Is there any site that can show me what each of this string represents ( which style ), so i can initilize the write one using HSSFWorkbook class Thanks Ido my current function starts like this and doesn't look good ( it's in javascript and I need to re-write it in java): function exportToSlk(columns, rows,filename, $a) { var formatMaps = { "$#,###.##":"F;P34;F$2G;", "$#0.00":"F;P34;F$2G;", "$#0.000" : "F;P34;F$2G;", "#,###":"F;P39;FI0G;", "%#0.00":"F;P14;F%2G;", "date": "F;P19;FG0G;" }; var header = 'ID;PWXL;N;E\nO;L\nP;PGeneral\nP;P0\nP;P0.00\nP;P#,##0\nP;P#,##0.00\nP;P#,##0_);;\\(#,##0\\)\nP;P#,##0_);;[Red]\\(#,##0\\)\nP;P#,##0.00_);;\\(#,##0.00\\)\nP;P#,##0.00_);;[Red]\\(#,##0.00\\)\nP;P"$"#,##0_);;\\("$"#,##0\\)\nP;P"$"#,##0_);;[Red]\\("$"#,##0\\)\nP;P"$"#,##0.00_);;\\("$"#,##0.00\\)\nP;P"$"#,##0.00_);;[Red]\\("$"#,##0.00\\)\nP;P0%\nP;P0.00%\nP;P0.00E+00\nP;P##0.0E+0\nP;P#\\ ?/?\nP;P#\\ ??/??\nP;Pm/d/yyyy\nP;Pd\\-mmm\\-yy\nP;Pd\\-mmm\nP;Pmmm\\-yy\nP;Ph:mm\\ AM/PM\nP;Ph:mm:ss\\ AM/PM\nP;Ph:mm\nP;Ph:mm:ss\nP;Pm/d/yyyy\\ h:mm\nP;Pmm:ss\nP;Pmm:ss.0\nP;P@\nP;P[h]:mm:ss\nP;P_("$"* #,##0_);;_("$"* \\(#,##0\\);;_("$"* "-"_);;_(@_)\nP;P_(* #,##0_);;_(* \\(#,##0\\);;_(* "-"_);;_(@_)\nP;P_("$"* #,##0.00_);;_("$"* \\(#,##0.00\\);;_("$"* "-"??_);;_(@_)\nP;P_(* #,##0.00_);;_(* \\(#,##0.00\\);;_(* "-"??_);;_(@_)\nP;P_(* #,##0.000_);;_(* \\(#,##0.000\\);;_(* "-"??_);;_(@_)\…
score: 3

http://stackoverflow.com/comment/78283209
type: Comment
has text: @johanson and what has it been replaced by since ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28589172

http://stackoverflow.com/q/23772932
answer count: 2
has comment: http://stackoverflow.com/comment/36558457
downvote count: 0
has title: Change ServletRequest server name programmatically
tagged with: grails
has body: I need to change the serverName of the ServletRequest object in my Grails controller. I'm having trouble figuring out how to do this since the serverName is a read-only property.
possible better answer: http://stackoverflow.com/a/23774255
has answer: http://stackoverflow.com/a/23773600
has answer: http://stackoverflow.com/a/23774255
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/23773600
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36558963
type: Question

http://stackoverflow.com/a/23741975
type: Answer
has body: Answer is: Somehow overriding the TabelCellRenderer also overrides to getColumnClass of the DefaultTabelModel that I have overriden. Solution is to make the renderer: spelbordTabel.getColumn("Title 1").setCellRenderer( new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); ((JLabel) cell).setIcon((Icon) value); ((JLabel) cell).setText(""); ((JLabel) cell).setHorizontalAlignment(JLabel.CENTER); return cell; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.fillOval(30, 30, 20, 20); } } );
accepted answer of: http://stackoverflow.com/q/23700756
upvote count: 1
answers question: http://stackoverflow.com/q/23700756
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/36324955
has text: Seems like someone edited the value of **i** here. It does not return i:1 first in Eclipse, but i:0.
score: 0
comment on: http://stackoverflow.com/q/23651180
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23718448
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23718058
type: Answer
has body: As mentioned in other answers, what you're implementing is a linked list and you'd probably be best served to leverage Java's libraries. To address the question as you posed it, a function that gives you a reference to the nth hop is probably what you're asking for Link getLink(Link link, int hops){ Link retVal = link; for (int i = 0; i &lt; hops; i++){ if (link == null){ //hops is too large. Do something to indicate error } else{ retVal = retVal.next; } } return retVal; } Then you could execute getLink(array[x],2).next = getLink(array[x],4); Or if you wanted to use reflection (not recommended since reflection is relatively expensive), then you could do something like Link myLink = array[x]; Field next = Link.class.getField("next"); //assume proper error handling for (int i = 0; i &lt; hops; i++){ myLink = (Link) next.getObject(myLink); //assume proper error handling }

http://stackoverflow.com/q/23734354
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23734853
type: Question
has body: public static void main(String[] args) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); Source Folder File source = new File("D:\\A1\\"); File dest = new File("D:\\A2\\"); File[] files = source.listFiles(); for (File file: source.listFiles()){ String x=(source+"\\"+file.getName()); String y=(dest + "\\"+ file.getName()); File f1 = new File(x); f1.renameTo(new File(y)); } This code is moving the file from source to destination folder but i want when file moved to destination folder . it appends the the system date with its name Please Help
accepted answer: http://stackoverflow.com/a/23734952
has comment: http://stackoverflow.com/comment/36484286
has comment: http://stackoverflow.com/comment/36484057
has comment: http://stackoverflow.com/comment/36484052
upvote count: 2
possible better answer: http://stackoverflow.com/a/23734512
answer count: 3
has comment: http://stackoverflow.com/comment/36484214
has answer: http://stackoverflow.com/a/23734512
has comment: http://stackoverflow.com/comment/36484514
has title: How to append date and time in multiple file in a folder while moving it to another folder
tagged with: java
has answer: http://stackoverflow.com/a/23734952
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/27872852
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/81639575
has comment: http://stackoverflow.com/comment/77782005
has comment: http://stackoverflow.com/comment/66397719
has comment: http://stackoverflow.com/comment/123412056
has comment: http://stackoverflow.com/comment/99721132
has comment: http://stackoverflow.com/comment/83992026
type: Answer
has comment: http://stackoverflow.com/comment/77024035
has comment: http://stackoverflow.com/comment/65204315
has comment: http://stackoverflow.com/comment/76378340
has comment: http://stackoverflow.com/comment/137033737
has comment: http://stackoverflow.com/comment/52658497
has comment: http://stackoverflow.com/comment/93097445
has comment: http://stackoverflow.com/comment/97376216
has comment: http://stackoverflow.com/comment/72662470
has comment: http://stackoverflow.com/comment/77038775
upvote count: 948
has comment: http://stackoverflow.com/comment/94157433
has comment: http://stackoverflow.com/comment/65184101
has comment: http://stackoverflow.com/comment/78070194
has comment: http://stackoverflow.com/comment/72670504
has comment: http://stackoverflow.com/comment/84017017
downvote count: 6
accepted answer of: http://stackoverflow.com/q/23699371
has comment: http://stackoverflow.com/comment/66347303
has comment: http://stackoverflow.com/comment/99722501
has comment: http://stackoverflow.com/comment/78110287
has comment: http://stackoverflow.com/comment/124219861
answers question: http://stackoverflow.com/q/23699371
score: 942
has comment: http://stackoverflow.com/comment/81633763
has comment: http://stackoverflow.com/comment/94633750
has body: Consider distinct to be a stateful filter. Here is a function that returns a predicate that maintains state about what it's seen previously, and that returns whether the given element was seen for the first time: public static &lt;T&gt; Predicate&lt;T&gt; distinctByKey(Function&lt;? super T, ?&gt; keyExtractor) { Set&lt;Object&gt; seen = ConcurrentHashMap.newKeySet(); return t -&gt; seen.add(keyExtractor.apply(t)); } Then you can write: persons.stream().filter(distinctByKey(Person::getName)) Note that if the stream is ordered and is run in parallel, this will preserve an arbitrary element from among the duplicates, instead of the first one, as distinct() does. (This is essentially the same as my answer to this question: Java Lambda Stream Distinct() on arbitrary key?)

http://stackoverflow.com/comment/36346040
type: Comment
score: 0
has text: everytime the user doubles clicks on a contact from their contact list in the main client a instance of the chat client is created, so there could be many instances of the chat client open. how would i use globals to allow these instances to be accessed from other classes? im sorry im so puzzled.
type: AnswerComment
comment on: http://stackoverflow.com/a/23661771

http://stackoverflow.com/comment/36451760
score: 4
type: Comment
type: QuestionComment
has text: and what is your question?
comment on: http://stackoverflow.com/q/23717554

http://stackoverflow.com/a/67908418
downvote count: 0
type: Answer
has body: Unicode code point number Every character defined in Unicode has a unique integer number assigned to it. Determine the number for your desired character. The COPYRIGHT SIGN is decimal 169, hexadecimal A9. Create a single-character string. int copyrightSymbolCodePoint = 169 ; String s = Character.toString( copyrightSymbolCodePoint ) ; Or, append using a StringBuilder. StringBuilder sb = new StringBuilder( "Copyright symbol is " ) ; an.appendCodePoint( copyrightSymbolCodePoint ) ; String output = sb.toString() ;
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23732876

http://stackoverflow.com/q/23744440
tagged with: android
answer count: 1
has title: Android Proguard - Reflection java.lang.reflect call not working
favorite count: 0
tagged with: proguard
has answer: http://stackoverflow.com/a/23747333
type: UnansweredQuestion
has body: I'm using the follow method to force stacked tabs on my Android ActionBar. When I come to use proguard, the Class manipulation no longer works work. No error messages are received, I just don't get the stacked tab ActionBar. This is what I have in my proguard rules. Is there anything clear I'm missing? -keepattributes Signature -keepattributes *Annotation* -keep class java.lang.reflect.** { *; } -keep class com.company.myapplication1.SetStackedTabs.** { *; } _ public static void SetStackedTabs(Object inActionBar, final boolean inHasEmbeddedTabs){ // get the ActionBar class Class&lt;?&gt; actionBarClass = inActionBar.getClass(); // if it is a Jelly Bean implementation (ActionBarImplJB), get the super class (ActionBarImplICS) if ("android.support.v7.app.ActionBarImplJB".equals(actionBarClass.getName())) { actionBarClass = actionBarClass.getSuperclass(); } // if Android 4.3 &gt; if ("android.support.v7.app.ActionBarImplJBMR2".equals(actionBarClass.getName())){ actionBarClass = actionBarClass.getSuperclass().getSuperclass(); } try { // try to get the mActionBar field, because the current ActionBar is probably just a wrapper Class // if this fails, no worries, this will be an instance of the native ActionBar class or from the ActionBarImplBase class final Field actionBarField = actionBarClass.getDeclaredField("mActionBar"); actionBarField.setAccessible(true); inActionBar = actionBarField.get(inActionBar); actionBarClass = inActionBar.getClass(); } catch (IllegalAccessException e) {} catch (IllegalArgumentException e) {} catch (NoSuchFieldException e) {} try { // now call the method setHasEmbeddedTabs, this will put the tabs inside the ActionBar // if this fails, you're on you own &lt;img class="wp-smiley" alt=";-)" src="http://www.blogc.at/wp-includes/images/smilies/icon_wink.gif"&gt; final Method method = actionBarClass.getDeclaredMethod("setHasEmbeddedTabs", new Class[] { Boolean.TYPE }); method.setAccessible(true); method.invoke(inActionBar, new Object[]{ inHasEmbedde…
upvote count: 1
tagged with: reflection
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/74723707
has text: this is a highly-upvoted answer, but does it really work for people? It doesn't seem to be for me. There is also a [bug entry](https://bugs.openjdk.java.net/browse/JDK-8044609) that these options wouldn't actually work.
comment on: http://stackoverflow.com/a/30104610
score: 5
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36515365
type: Comment
has text: @Supuhstar Yes, you have a small typo in your regex. :) The `?` in your `.*?` makes the dot-star lazy, so it will not bother to match anything after the lookbehind succeeds. See the [updated demo](http://ideone.com/feZMxj) where I removed the `?` And also you can check it interactively on [regex101](http://regex101.com/r/aT7vT0), here with the `?` it doesn't match, remove the `?` and it will match. Other than that, glad to hear it's working for you. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/23749261
score: 0

http://stackoverflow.com/q/23680750
favorite count: 0
tagged with: xa
has comment: http://stackoverflow.com/comment/36382153
tagged with: jdbc
has body: I am getting the following exception: db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (C:\IBM\SQLLIB\BIN\db2jcct2.dll is not a valid Win32 application. ): ERRORCODE=-4472, SQLSTATE=null DSRA0010E: SQL State = null, = -4 472 while trying to connect to DB2 using com.ibm.db2.jcc.DB2XADataSource as datasource , but with com.ibm.db2.jcc.DB2Driver the connection works fine. com.ibm.db2.jcc.DB2XADataSource is created on WebShpere 8.5.5 Note 1>with was8.5.5 is 64 bit db2 64 bit OS is 64 bit windows7 - com.ibm.db2.jcc.DB2XADataSource fails db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (C:\IBM\SQLLIB\BIN\db2jcct2.dll is not a valid Win32 application. ): ERRORCODE=-4472, SQLSTATE=null DSRA0010E: SQL State = null, = -4 472 com.ibm.db2.jcc.DB2Driver also fails same exception as above . 2>with was8.5.5 is 64 bit db2 32 bit OS is 64 bit windows7 - com.ibm.db2.jcc.DB2Driver works – com.ibm.db2.jcc.DB2XADataSource fails with with was8.5.5 is 64 bit db2 64 bit OS is 64 bit windows7 - com.ibm.db2.jcc.DB2XADataSource fails db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (C:\IBM\SQLLIB\BIN\db2jcct2.dll is not a valid Win32 application. ): ERRORCODE=-4472, SQLSTATE=null DSRA0010E: SQL State = null, = -4 472 Full error log R java.sql.SQLException: [jcc][10389][12245][3.65.77] Konekielisen kirjaston lataus on epäonnistunut db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2 (C:\IBM\SQLLIB\BIN\db2jcct2.dll is not a valid Win32 application. ): ERRORCODE=-4472, SQLSTATE=null DSRA0010E: SQL State = null, Error Code = -4 472 [15.5.2014 21:09:48:639 EEST] 000000d3 SystemErr R at com.ibm.db2.jcc.am.cd.a(cd.java:682) [15.5.2014 21:09:48:639 EEST] 000000d3 SystemErr R at com.ibm.db2.jcc.am.cd.a(cd.java:60) [15.5.2014 21:09:48:639 EEST] 000000d3 SystemErr R at com.ibm.db2.jcc.am.cd.a(cd.java:94) [15.5.2014 21:09:48:639 EEST] 000000d3 SystemErr R at com.ibm.db2.jcc.t2.a.a(a.java:37) [15.5.2014 21:09:48:639 EEST] 000000d3 SystemErr R at com.ibm.db2.jcc.t2.T2Configuration.&lt;clinit&gt;(T2Con…
downvote count: 0
has comment: http://stackoverflow.com/comment/36382239
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36395047
has comment: http://stackoverflow.com/comment/36383190
has answer: http://stackoverflow.com/a/35920210
has title: DB2 connectivity error with type 2 driver
has comment: http://stackoverflow.com/comment/36386740
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36443368
tagged with: websphere
has comment: http://stackoverflow.com/comment/36382401
upvote count: 1
has comment: http://stackoverflow.com/comment/36382298
answer count: 1
has comment: http://stackoverflow.com/comment/36382806
tagged with: db2
has comment: http://stackoverflow.com/comment/36382133
has comment: http://stackoverflow.com/comment/36382969

http://stackoverflow.com/q/23778131
has answer: http://stackoverflow.com/a/30906218
answer count: 4
score: 8
favorite count: 0
has answer: http://stackoverflow.com/a/26806610
type: UnansweredQuestion
tagged with: android
has title: Navigation Drawer onNavigationDrawerItemSelected called before MainActivity onCreate?
tagged with: android-intent
has body: I have setup a new project with the template implementation of Navigation Drawer Fragment and a MainActivity. It provides me with the following relevant methods: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = getIntent(); token = intent.getStringExtra(EXTRA_TOKEN); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mNavigationDrawerFragment.activityMain = this; mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); } My MainActivity is started by a splash activity which gets a saved access token via the EXTRA_TOKEN. This is the override of the Navigation Drawer item select listener in the MainAcitivity: @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getSupportFragmentManager(); onSectionAttached(position + 1); switch(position) { case 0: fragmentManager.beginTransaction() .replace(R.id.container, FeedFragment.newInstance(token, "")) .commit(); break; case 1: fragmentManager.beginTransaction() .replace(R.id.container, PeopleFragment.newInstance("", "")) .commit(); break; case 2: if(qbloggedin) { fragmentManager.beginTransaction() .replace(R.id.container, MessagesFragment.newInstance(token, "")) .commit(); } break; default: break; } } It starts three different fragments depending on which item is selected in the NavDrawer. While instantiating the new fragments, the token string is passed into its constructor, which is saved in the fragment's class for further use. On the first start of the App however, it seems that onNavigationDrawerItemSelected is called before onCreate! This results me passing a null value token into the fragments, causing them to be all messed up. How is this possible? As …
has answer: http://stackoverflow.com/a/23778945
tagged with: android-fragments
downvote count: 0
tagged with: java
upvote count: 8
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/32479666

http://stackoverflow.com/comment/36530800
type: Comment
has text: I used the line "Set<Character> set = new HashSet<Character>();" and its giving me a red box over "HashSet"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23758657

http://stackoverflow.com/q/23631930
has body: I am reading a file which has multiple lines, example of the content of this file is: Reader : INFO - LOOP with sapces : 1 Reader : INFO - LOOP with sapces : 2 Reader : INFO - LOOP with sapces : 17 Reader : INFO - LOOP with sapces : 201 What I am trying to do is to get my program to read the number of lines that contains LOOP with spaces. Here is my code: Scanner fileScan = new Scanner(file); int iterated = 0; while (fileScan.hasNext()) { String somestring = fileScan.next(); if (somestring.matches(".*LOOP\\swith\\sspaces.*")) { iterated++; } } } System.out.println("number of times found is: "+iterated); My issue is that my program is 0 for int iterated.
has comment: http://stackoverflow.com/comment/36287251
accepted answer: http://stackoverflow.com/a/23632041
tagged with: regex
type: AnsweredQuestion
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/23632106
tagged with: java
has answer: http://stackoverflow.com/a/23632106
type: Question
has answer: http://stackoverflow.com/a/23632041
has title: check substring with spaces in scanner
score: 0
answer count: 2

http://stackoverflow.com/comment/36599261
type: AnswerComment
has text: I've never used swipeview and you don't have any example code using it, just a pageAdapter, which I have also never used. So it's hard to help you there. Can you show me the code where you are trying to start the new activity and the errors you are getting?
type: Comment
comment on: http://stackoverflow.com/a/23772870
score: 0

http://stackoverflow.com/q/23672319
has answer: http://stackoverflow.com/a/23755365
has comment: http://stackoverflow.com/comment/36367324
has comment: http://stackoverflow.com/comment/36367770
answer count: 1
favorite count: 0
score: 6
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/36366253
tagged with: spring
has body: I'd like to develop a vaadin application with spring. A user should be able to login and see uer-specific pages. I he comes to the site from a different browser window, it would be handy if the user is still logged in, so preserves the session. Now I wonder which scope to use for this purpose? Vaadin and Spring offer a @Scope("session"), @Scope("ui") and a @Scope("prototype"). Should I just place all of my *View and *Presenter classes in the session scope? Or would it be better to have the view annoted with prototype, so that each time a pages is changed the page is recreated with updated data? In this case, should then the presenters be still session scope, or also prototye? Or should I at all use the ui scope that's provided by vaadin4spring boot addon? This would then create a new "uiSession" for every new tab. @Scope("session") class MyPresenter { //each view should be wired to a presenter @Autowired private MyView view; } @Scope("prototype") //"session", "ui"? class MyView extends VerticalLayout { @PostConstruct public void init() { addComponent(new Label("time is: " + new Date())); } }
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/23755365
has comment: http://stackoverflow.com/comment/36367415
type: Question
has comment: http://stackoverflow.com/comment/36463632
has title: Which scope to use with vaadin and spring?
tagged with: session
upvote count: 6

http://stackoverflow.com/a/23630901
downvote count: 0
answers question: http://stackoverflow.com/q/23630668
has body: I will suggest instead of using a 3D array, you shall create a Student Class that will hold all the information for a student and A Class for SchoolClass that will hold a list of students in the class and name of class and you can maintain an Array of SchoolClass to serve the purpose. This way you will be able to manage it better. Hope this helps
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/36405573
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23692790
has text: I'm just trying to get it to go through a loop and it seems very difficult to get the program to do this.
score: 0

http://stackoverflow.com/comment/36524767
type: QuestionComment
has text: BOBYQA will take search steps proportional to the RHO parameter, which will start at RHOBEG and finish at around RHOEND. If you start at approximately optimum, BOBYQA is likely to take a rather big step away from that point, and might not be able to return as RHO decreases. What happens if you **do not** start at (near) optimum?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23755482

http://stackoverflow.com/comment/36343957
comment on: http://stackoverflow.com/q/23652289
score: 0
type: QuestionComment
type: Comment
has text: This is similar to http://stackoverflow.com/questions/11825643/configure-jpa-to-let-postgresql-generate-the-primary-key-value. The key thing here is @Column(updatable=false) which seems to be the only way forcing hibernate not to assign id itself.

http://stackoverflow.com/q/23699343
has comment: http://stackoverflow.com/comment/36417482
favorite count: 0
answer count: 3
tagged with: regex
has answer: http://stackoverflow.com/a/23700001
has title: REGEX Expression to exclude toll-free numbers
upvote count: 1
has answer: http://stackoverflow.com/a/23699388
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23699384
tagged with: java
has answer: http://stackoverflow.com/a/23699384
type: Question
has body: I have this regex expression written that should extract toll-free numbers but when there is a number like 1-800-343-2432 (when there is a 1 before the 800 stuff) it doesn't work (?!(\$|#|800|855|866|877|888))\(?[\\s.-]*([0-9]{3})?[\\s.-]*\)?[\\s.-]*[0-9]{3}[\\s.-]*[0-9]{4} how can i modify this expression to not take numbers like 1-866-343-1232 too ?!
downvote count: 0
accepted answer: http://stackoverflow.com/a/23699388
score: 1

http://stackoverflow.com/comment/36526227
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23678722
score: 0
has text: The scenario we are handling is that a task was scheduled on server A and later on a user modified it. So, we will have to stop the task on server A first. After that it doesn't matter which server schedule the new task.

http://stackoverflow.com/comment/36523278
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23735645
has text: @Absurd-Mind. I want to pass e.g the jenkins github credentials to the application.
type: Comment

http://stackoverflow.com/a/23696279
type: AcceptedAnswer
score: 1
has body: An array out of bounds exception is 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. This is coming from if (generated.get(round) == 1) because previously you call generated.clear(); which removes all elements of your arraylist. This means you are trying to access an index in your array which does not exist.
type: Answer
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23695985
answers question: http://stackoverflow.com/q/23695985

http://stackoverflow.com/a/23622377
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36268960
has body: Everything you did is correct. "0c05aa56405c447e6678b7f3127febde5c3a9238" is the correct output. I would suspect MySQL is being updated between reads. My suggestion would be, check if the value "0c05aa56405c447e6678b7f3127febde5c3a9238" is actually being saved to MySQL. Break the workbench open and access the row to check its value. If the value in MySQL is correct then it is in the transformation from RDBMS -> Java. If you defined the attribute password as a String then Hibernate (or whatever you are using) should leave the field as is.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23622239
accepted answer of: http://stackoverflow.com/q/23622239

http://stackoverflow.com/comment/36409296
has text: The documentation (as in - not the demo page but the actual manual) on the primefaces datagrid component should be able to tell you that. Meanwhile I found this related question that should answer your question: http://stackoverflow.com/questions/13434703/how-to-have-full-controll-of-primefaces-pdatagrid-pagination-with-the-backing-b
comment on: http://stackoverflow.com/q/23693728
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36374042
score: 0
type: AnswerComment
has text: I post my newlogcat in the question. can you see something strange in my code?
type: Comment
comment on: http://stackoverflow.com/a/23674036

http://stackoverflow.com/a/23680315
score: 1
upvote count: 1
downvote count: 0
has body: I found the answer by myself. It should be if(key.equals(key2))
answers question: http://stackoverflow.com/q/23679454
type: Answer

http://stackoverflow.com/a/23673012
has comment: http://stackoverflow.com/comment/36387420
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23670516
has comment: http://stackoverflow.com/comment/36409040
answers question: http://stackoverflow.com/q/23670516
upvote count: 8
type: Answer
score: 8
has body: Did you realize that your binary data is the binary represantation of an OLE Automation date value? So instead of getting long, you should get a double value from your array. var b = new byte[8]; b[0] = 0x20; b[1] = 0x64; b[2] = 0xa8; b[3] = 0xac; b[4] = 0xb6; b[5] = 0x65; b[6] = 0xe4; b[7] = 0x40; var dbl = BitConverter.ToDouble(b, 0); var dt = DateTime.FromOADate(dbl); Console.WriteLine("{0:s}", dt); Result is : 2014-05-14T17:00:21 I think the valid question should be: What is the equivalent of DateTime.FromOADate() in Java ? Answer is: public static Date fromDoubleToDateTime(double OADate) { long num = (long) ((OADate * 86400000.0) + ((OADate &gt;= 0.0) ? 0.5 : -0.5)); if (num &lt; 0L) { num -= (num % 0x5265c00L) * 2L; } num += 0x3680b5e1fc00L; num -= 62135596800000L; return new Date(num); }

http://stackoverflow.com/a/23788935
downvote count: 0
has comment: http://stackoverflow.com/comment/37946988
type: Answer
upvote count: 3
has body: The cause for this problem isn't so much a bug, but a lack of robustness in JMockit when mocking a class that contains a static initializer. The next version of JMockit (1.9) will be improved on this point (I already have a working solution). Also, the problem would not have occurred if Cobertura marked its generated methods (four of them with names starting with "__cobertura_", added to every instrumented class) as "synthetic", so that JMockit would have ignored them when mocking a Cobertura-instrumented class. Anyway, fortunately this won't be necessary. For now, there are two easy work-arounds which avoid the problem: Make sure any class to be mocked was already initialized by the JVM by the time the test starts. This can be done by instantiating it or invoking a static method on it. Declare the mock field or mock parameter as @Mocked(stubOutClassInitialization = true). Both work-arounds prevent the NPE that would otherwise get thrown from inside the static class initializer, which is modified by Cobertura (to see these bytecode modifications, you can use the javap tool of the JDK, on classes under the target/generated-classes directory).
score: 3
accepted answer of: http://stackoverflow.com/q/23761091
answers question: http://stackoverflow.com/q/23761091
type: AcceptedAnswer

http://stackoverflow.com/q/23714671
answer count: 0
tagged with: java
tagged with: hibernate
has body: How can I get a list of dirty fields from managed entity? I know I can do such a thing when I use hibernate events public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) but I would like to get this without any special persistence operation on my entity. Comparing field by field with original object is also bad idea.
type: Question
score: 4
has comment: http://stackoverflow.com/comment/36450130
upvote count: 4
linked to: http://stackoverflow.com/q/19656882
has comment: http://stackoverflow.com/comment/36450708
has comment: http://stackoverflow.com/comment/36450699
tagged with: jpa
has comment: http://stackoverflow.com/comment/36450645
downvote count: 0
has title: List of dirty fields from managed entity
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/36450876

http://stackoverflow.com/q/23700612
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: taglet
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question
tagged with: tags
has body: I'm trying to use the Taglet or Tag for my project because I need to create new kind of tags in my javadoc. But I'm not finding any example useful to start. What do I need to know is if exist any good example of the usage. I'm not finding videos teaching about it. Just the documentation at Oracle API - http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#tag. Any tip will be helpful.
has title: How to use Taglet or Tag in Eclipse with Java
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23705164
has answer: http://stackoverflow.com/a/23705164

http://stackoverflow.com/comment/36373377
type: Comment
comment on: http://stackoverflow.com/a/23674036
has text: Then why are you saying there is problem in foreign key?
type: AnswerComment
score: 0

http://stackoverflow.com/q/23682644
tagged with: java
upvote count: 1
answer count: 0
downvote count: 0
linked to: http://stackoverflow.com/q/10172787
type: UnansweredQuestion
tagged with: spring-transactions
has comment: http://stackoverflow.com/comment/36386409
score: 1
favorite count: 0
type: Question
has title: Spring Transaction management - How to know the API is executed in one transaction or not?
tagged with: spring
has body: How to know if my particular flow or API is getting executed in one transaction or not ? I am using the JPATransactionManager &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" p:entityManagerFactory-ref="entityManagerFactory" /&gt; I am using @Transactional annotation at API to declare the transactional boundaries. I am trying hard to find out clear transaction boundaries in my application and know when particular transaction is getting started, when particular transaction is ended.. I also tried logs for JPATranscationManager at Trace level but didn't help much.
tagged with: transactions

http://stackoverflow.com/q/23658623
tagged with: java
tagged with: swt
has comment: http://stackoverflow.com/comment/36342764
type: Question
has comment: http://stackoverflow.com/comment/36339242
has comment: http://stackoverflow.com/comment/36342253
tagged with: parent-child
score: 0
tagged with: shell
type: UnansweredQuestion
has body: I have a shell (SWT) and it's child. The child overlaps it's parent, so I can't fill some data there. How do I make it possible to switch between parent and child without them overlapping each other? Which style constant should I use when I create the child? I tried to find the appropriate one but I failed. Are there other ways to deal with the problem?
has comment: http://stackoverflow.com/comment/36342947
has title: Java SWT How to prevent shell child from overlapping it's parent?
answer count: 0
has comment: http://stackoverflow.com/comment/36342580

http://stackoverflow.com/a/23709720
has body: Change "class= com.example.android.rssfeed.MyListFragment" to "com.example.com.example.android.rssfeed.MyListFragment" And your problem will be solved out
type: Answer
answers question: http://stackoverflow.com/q/23709303
score: 0

http://stackoverflow.com/comment/36449307
type: Comment
comment on: http://stackoverflow.com/a/23716029
score: 0
type: AnswerComment
has text: i followed your logic but I did it slightly different. Sets doesn't allows duplicates. Lets say instead of objectSet.add(n.toString())) I want to do objectSet.add("ten")) to let the user know that those numbers are multiples of ten. How would you allow such duplication?

http://stackoverflow.com/comment/36360495
comment on: http://stackoverflow.com/a/23668155
has text: Yeah it happens... just try to understand the concepts, don't cram!!
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23730434
has comment: http://stackoverflow.com/comment/36477536
has comment: http://stackoverflow.com/comment/36477638
score: 3
has comment: http://stackoverflow.com/comment/36477556
downvote count: 0
has comment: http://stackoverflow.com/comment/36476976
has comment: http://stackoverflow.com/comment/36477657
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23730416
has body: Java switch/case will work only with primitives(byte, short, char, and int), Enums(from java 5) and String(from java 7) data types only. Check oracle tutorial here Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer (discussed in Numbers and Strings). You can use like following switch(type.getName()){ case ("java.lang.String"): //... break; ... }

http://stackoverflow.com/comment/36409230
has text: Does this example help? https://gist.github.com/quidryan/5449155
comment on: http://stackoverflow.com/q/23692747
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36308902
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23642734
has text: David Wallace: Yes, just updated.
score: 0

http://stackoverflow.com/comment/36498731
type: Comment
has text: Yeah.. using labels can get very messy, it gets hard to recognize the flow of the program.
comment on: http://stackoverflow.com/a/23742258
type: AnswerComment
score: 0

jpanel
tags question: http://stackoverflow.com/q/23664129
tags question: http://stackoverflow.com/q/23665889
tags question: http://stackoverflow.com/q/23666972
tags question: http://stackoverflow.com/q/23667639
tags question: http://stackoverflow.com/q/23663308
tags question: http://stackoverflow.com/q/23711107
tags question: http://stackoverflow.com/q/23620472
tags question: http://stackoverflow.com/q/23631980
tags question: http://stackoverflow.com/q/23645729
tags question: http://stackoverflow.com/q/23642276
tags question: http://stackoverflow.com/q/23699886
type: Tag
tags question: http://stackoverflow.com/q/23771846
tags question: http://stackoverflow.com/q/23728160
tags question: http://stackoverflow.com/q/23767429
tags question: http://stackoverflow.com/q/23666955
tags question: http://stackoverflow.com/q/23728276
tags question: http://stackoverflow.com/q/23646526
tags question: http://stackoverflow.com/q/23747894
tags question: http://stackoverflow.com/q/23714245
tags question: http://stackoverflow.com/q/23675806
tags question: http://stackoverflow.com/q/23667819
tags question: http://stackoverflow.com/q/23668631
tags question: http://stackoverflow.com/q/23687897
tags question: http://stackoverflow.com/q/23748399
tags question: http://stackoverflow.com/q/23706064
tags question: http://stackoverflow.com/q/23767449
tags question: http://stackoverflow.com/q/23726935
tags question: http://stackoverflow.com/q/23636984
tags question: http://stackoverflow.com/q/23767286
tags question: http://stackoverflow.com/q/23721981
tags question: http://stackoverflow.com/q/23646297
tags question: http://stackoverflow.com/q/23722081
tags question: http://stackoverflow.com/q/23768368
tags question: http://stackoverflow.com/q/23679321
tags question: http://stackoverflow.com/q/23726416
tags question: http://stackoverflow.com/q/23628492
tags question: http://stackoverflow.com/q/23728761
tag name: jpanel
tags question: http://stackoverflow.com/q/23689910
tags question: http://stackoverflow.com/q/23689400
tags question: http://stackoverflow.com/q/23665607
tags question: http://stackoverflow.com/q/23739314

http://stackoverflow.com/a/42518890
downvote count: 0
has body: @templatetypedef public LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) accessOrder - the ordering mode - true for access-order, false for insertion-order
upvote count: 2
answers question: http://stackoverflow.com/q/23772102
type: Answer
score: 2

http://stackoverflow.com/a/23656018
has comment: http://stackoverflow.com/comment/36364363
type: Answer
has body: You could pass a system property from the job to the JVM when launching the project: ...whatever... -Dconfig=test_existing_api and retrieve it in your classes with: System.getProperty("config")
has comment: http://stackoverflow.com/comment/36373864
has comment: http://stackoverflow.com/comment/36364137
score: 0
answers question: http://stackoverflow.com/q/23655554
has comment: http://stackoverflow.com/comment/36372998

http://stackoverflow.com/comment/36443329
comment on: http://stackoverflow.com/q/23713281
score: 0
type: Comment
type: QuestionComment
has text: Try `JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m`

http://stackoverflow.com/q/23756276
has body: I am new to Maven, I run my pom.xml through "maven install". Every thing is working fine and also build is getting succeed but HTML reports are not getting generated. I read some article that Run "mvn site" to generate this html report. But How can I run my tests by mvn site. Can any one explain why we use and how to use the "mvn site".
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/36526999
has title: Issue with generating JUnit HTML report?
has comment: http://stackoverflow.com/comment/36526912
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/36526061
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23758055
score: 0

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/23719085
tags question: http://stackoverflow.com/q/23709774

http://stackoverflow.com/comment/36541404
comment on: http://stackoverflow.com/a/23763951
type: Comment
has text: i want them in this format : title: A New Way for Hierarchical and Topological Clustering. authors: Ammar Mechouche , Nathalie Abadie , Emeric Prouteau ,Sbastien Mustire –
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36266121
comment on: http://stackoverflow.com/q/23620746
score: 0
type: Comment
has text: Did you just edit the question to make it a different question?
type: QuestionComment

http://stackoverflow.com/q/23712232
has comment: http://stackoverflow.com/comment/36441365
has comment: http://stackoverflow.com/comment/36441702
downvote count: 1
tagged with: draw
type: Question
tagged with: graphics
answer count: 1
tagged with: lines
score: 0
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23712372
favorite count: 0
has body: In fact, we want to code a Bridge Constructor Game and the user must be able to draw these lines to make the bridge.. Already answered : I've been trying to create a class would allow me to draw lines on an existing layout, but the app crashed when we try to launch the activity "Game" (by pressing the button in the Main Menu). The LogCat told us that : "FATAL EXCEPTION : main" and that we have a NullPointerException. [EDIT] : We search now how to get back all the lines we've created as individual objects (we suppose there are the bitmaps that the canvas created), but we really don't know how to get these Bitmaps... Here is the code of the activity "CustomView" (Use to draw the lines) : package com.g70.buildmybridge; import java.util.LinkedList; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.view.MotionEvent; import android.view.View; public class CustomView extends View { private Paint mPaint; private Bitmap mBitmap; private Canvas mCanvas; private Path mPath; private Paint mBitmapPaint; private LinkedList&lt;Path&gt; paths = new LinkedList&lt;Path&gt;(); public CustomView (Context context) { super(context); setFocusable(true); setFocusableInTouchMode(true); mPath = new Path(); mCanvas = new Canvas(); mBitmapPaint = new Paint(); mPaint = new Paint(); mPaint.setColor(Color.BLACK); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.BEVEL); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(6); paths.add(mPath); } @Override protected void onDraw(Canvas canvas) { for (Path p : paths){ canvas.drawPath(p, mPaint); } } private float mX, mY; private static final float TOUCH_TOLERANCE = 4; // à la touche posée private void touch_start(float x, float y) { x=Math.round(x/100)*100; y=Math.round(y/100)*100; mPath.reset(); // deplacement du path et positionnement en x,y mPath.moveTo(x, y); mX = x; mY…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36441234
linked to: http://stackoverflow.com/q/8287949
has title: How to draw lines in an existing activity?
tagged with: java

http://stackoverflow.com/comment/36326711
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23652017
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)
type: Comment

http://stackoverflow.com/comment/36422090
comment on: http://stackoverflow.com/a/23701794
type: AnswerComment
score: 0
type: Comment
has text: I don't know what are you doing. Store in some where else in static variable once set and access from there.

http://stackoverflow.com/comment/36468937
has text: What you're conceptually talking about is a "queue", a first-in/first-out list. Unfortunately, the available queue implementations in Java is a weird set, so it's hard to pick, but using a LinkedList using `addFirst` and `peekLast`/`removeLast` will probably come close to what you want. There are other queue implementations that have various multi-threading features, if you feel you need that.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23726144
score: 0

http://stackoverflow.com/a/23653940
has comment: http://stackoverflow.com/comment/36337858
type: AcceptedAnswer
downvote count: 0
has body: There are several things wrong... Avoid KeyListener, there are a swagger of problems associated with using KeyListeners which the key bindings API fixes You select the row by using table.setRowSelectionInterval(rowCount-1,rowCount-1);, but rowCount is no longer valid, as you've added a new row transferFocus is used to transfer focus to the next focusable component, which will mean that the JTable would mostly likely lose focus, pretty sure this isn't what you want. For example... import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; public class TestTable { public static void main(String[] args) { new TestTable(); } public TestTable() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } DefaultTableModel model = new DefaultTableModel(4, 4); JTable table = new JTable(model); InputMap im = table.getInputMap(); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "CellAction"); ActionMap am = table.getActionMap(); am.put("CellAction", new CellAction(table)); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(table)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class CellAction extends AbstractAction { private JTable table; public CellAction(JTable table) { this.table = table; } @Override public void actionPerformed(ActionEvent e) { …
answers question: http://stackoverflow.com/q/23652644
type: Answer
accepted answer of: http://stackoverflow.com/q/23652644
has comment: http://stackoverflow.com/comment/36334379
score: 1
upvote count: 1

http://stackoverflow.com/q/23725479
has answer: http://stackoverflow.com/a/23725527
has body: I have a TreeMap defined like this private TreeMap &lt;String,Enclavament&gt; a_enclavaments;. I want to work with every Enclavament of the TreeMap, so I made a for look to run a method on them, this is what I mean: for(int i = 0; i &lt; a_enclavaments.size(); i++) modify(a_enclavaments.get(i)); modify requires an items from the class Enclavament. However, when I start, I get this error: Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at java.lang.Integer.compareTo(Unknown Source) at java.util.TreeMap.getEntry(Unknown Source) at java.util.TreeMap.get(Unknown Source) I don't understand why. I've read the java APIs and it says get(Object key) Returns the value to which the specified key is mapped, or if this map contains no mapping for the key. Isn't it supposed to return the first, then second, then third... Enclavament from the TreeMap? EDIT: Can it be because I have the first, let's say, parameter on the TreeMap set as a String and it has to be an Integer?
has comment: http://stackoverflow.com/comment/36467153
has title: How to acces an item from a TreeMap using an int index?
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/36467150
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23725497
tagged with: java
upvote count: 1
tagged with: treemap
type: Question
has answer: http://stackoverflow.com/a/23725497
answer count: 2
possible better answer: http://stackoverflow.com/a/23725527
has comment: http://stackoverflow.com/comment/36467217
has comment: http://stackoverflow.com/comment/36467183
has comment: http://stackoverflow.com/comment/36467319
score: 0

http://stackoverflow.com/comment/36505281
type: Comment
has text: actually this wronge coz always isPlay = true, so it's gonna go to if statement always
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23745551

polymorphism
tags question: http://stackoverflow.com/q/23645753
tags question: http://stackoverflow.com/q/23617188
tags question: http://stackoverflow.com/q/23650393
type: Tag
tag name: polymorphism

http://stackoverflow.com/comment/78283549
type: Comment
comment on: http://stackoverflow.com/a/32150208
type: AnswerComment
score: 2
has text: I got the same problem, but after I remove CascadeType, it gives me `MySQLNonTransientConnectionException: No operations allowed after statement closed.`, any idea?

webbrowser-control
type: Tag
tags question: http://stackoverflow.com/q/23732512
tag name: webbrowser-control

http://stackoverflow.com/comment/36549952
type: Comment
comment on: http://stackoverflow.com/q/23768270
score: 0
type: QuestionComment
has text: @LuiggiMendoza I was interested in a way that's more elegant than `public static getPrimesBetween1000and5000(int i)`. I also asked for the rationale behind this question -- i.e. what benefits does it give to the compiler? But oh well, I'll move on.

http://stackoverflow.com/comment/36462214
comment on: http://stackoverflow.com/q/23722133
type: Comment
has text: you are supposed to post a new question for a new problem. this has completely changed the question to the one i answered which is not right. the view pager is in activity layout
score: 0
type: QuestionComment

http://stackoverflow.com/a/24078733
answers question: http://stackoverflow.com/q/23750637
upvote count: 1
has body: I managed to solve this problem by using HashMap instead. In a for loop, Map map = new HashMap(); ... map.put(response.getMerchants().get(i).getCategory_name(), response.getMerchants().get(i).getCategory_id()); ... To put it in my adapter: for (Object o : map.entrySet()) { Map.Entry entry = (Map.Entry) o; HomeMerchantsModel hms = new HomeMerchantsModel(); hms.setCategory_id(String.valueOf(entry.getValue())); hms.setCategory_name(String.valueOf(entry.getKey())); arrCategory.add(hms); } Since HashMap stores unique key-value, this is useful. Now moving on to calculate the counts.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/23742663
tagged with: hashmap
tagged with: java
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23742861
has answer: http://stackoverflow.com/a/23742729
has title: Is there a way to add a key Value Pair directly to all the Hashes in Nested HashMaps
has answer: http://stackoverflow.com/a/23742699
has body: I have nested HashMaps: Map&lt;String, Map&lt;String, String&gt;&gt; nestedMap; I want to execute map.put("Hello","All") on each HashMap in nestedMap. Is there a way to do it without iterating over nestedMap?
type: UnansweredQuestion

http://stackoverflow.com/q/23626194
has answer: http://stackoverflow.com/a/23633519
tagged with: semantic-web
score: 5
answer count: 3
accepted answer: http://stackoverflow.com/a/23633519
downvote count: 0
has comment: http://stackoverflow.com/comment/36276199
has comment: http://stackoverflow.com/comment/36280169
favorite count: 0
has body: I'm querying an OWL ontology using SPARQL, but the results show links as well as data. I only want the data. How can I remove the link and show on the data? The output I'm getting is: --------------------------------------------------------------------------------------------------------------------------- | Email | ind | ind1 | =========================================================================================================================== | "5"^^<http://www.w3.org/2001/XMLSchema#decimal> | my:HotelCityPark | "Hotel"^^<http://www.w3.org/2001/XMLSchema#string> | --------------------------------------------------------------------------------------------------------------------------- The output I desire is (note that parts like ^^<http://www.w3.org/2001/XMLSchema#decimal> are no longer present. --------------------------------- | Email | ind | ind1 | ================================= | 5 | HotelCityPark | Hotel | --------------------------------- Here is my Java code and my OWL ontology: class jena_testing { public static void main(String[] args) { String filename="modified2.owl"; Model model=ModelFactory.createDefaultModel(); OntModel model1=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,model); try { File file=new File(filename); FileInputStream reader=new FileInputStream(file); model.read(reader,null); String query1="PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+ "PREFIX my: <http://www.semanticweb.org/rohit/ontologies/2014/4/untitled-ontology-20#>"+ "SELECT ?Email ?ind ?ind1"+ " WHERE {"+ " ?ind rdf:type my:Accomodation ."+ "?ind my:hasStarRating ?Email."+ "?ind my:hasType ?ind1."+ "FILTER regex(str(?ind),'HotelCityPark')"+ "}"; com.hp.hpl.jena.query.Query query=QueryFactory.create(query1); QueryExecution exe=QueryExecutionFactory.create(query, model1); ResultSet RES=exe.execSelect(); ResultSetFormatter.out(System.out, RES, query); }catch(Exception e) { e.printStackTrace(); …
has title: Removing datatypes from literals in SPARQL results
tagged with: sparql
has answer: http://stackoverflow.com/a/69160814
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/36280454
has comment: http://stackoverflow.com/comment/36276105
type: Question
possible better answer: http://stackoverflow.com/a/23629716
tagged with: jena
upvote count: 5
has answer: http://stackoverflow.com/a/23629716
tagged with: java

http://stackoverflow.com/a/23698331
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23698156
score: 2
downvote count: 0
has body: Use a different constructor fh = new FileHandler("%h/TorrentDownloader.log", true);

http://stackoverflow.com/q/23737051
has body: I want to place an error.jsp page in META-INF/resources folder of a JAR, so that my web-applications may get redirected to this common error page. Though, I am able to redirect the applications to this error.jsp page, but the page can't access the implicit exception object, so as to print stack-trace. While, the exception implicit object is null in this page. I've already added the &lt;%@ page isErrorPage="true"%&gt; tag in error.jsp. Is there any other way around to access the Exception object from this jsp page ?
score: 0
has answer: http://stackoverflow.com/a/23737341
has title: How to access Exception object in a jsp page placed at 'META-INF/resources' folder of jar?
has comment: http://stackoverflow.com/comment/36489357
has answer: http://stackoverflow.com/a/23739035
has comment: http://stackoverflow.com/comment/36489219
possible better answer: http://stackoverflow.com/a/23737341
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36489255
accepted answer: http://stackoverflow.com/a/23739035
answer count: 2
tagged with: jar
tagged with: jsp

http://stackoverflow.com/comment/36302448
comment on: http://stackoverflow.com/q/23639760
type: Comment
type: QuestionComment
has text: Why are you using `getApplicationContext()` in the first place? That is rarely the right answer. http://www.doubleencore.com/2013/06/context/
score: 0

http://stackoverflow.com/q/23683933
has title: DB2 Java Stored Procedure NoSuchMethodError
has answer: http://stackoverflow.com/a/23684806
has body: I am currently working with IBM DB2 v10.1 Enterprise Edition. I need to create a Java Stored Procedure, that connects to a remote TCP Server (again in Java). Therefore, I have coded the following class in Java (file name is SystemClient.java): import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class SystemClient { public static void callSystemML(String serverIPAddress, Integer serverPort, String script, String args) throws IOException, ClassNotFoundException { Socket socket = new Socket(serverIPAddress, serverPort); PrintWriter writer = new PrintWriter(socket.getOutputStream(), true); BufferedReader reader = new BufferedReader( new InputStreamReader(socket.getInputStream())); writer.println(script + "|" + args); String line = reader.readLine(); writer.close(); reader.close(); socket.close(); } } So, I create a Jar file for the class above with the following commands: javac SystemClient.java jar cvf SystemClient.jar SystemClient.class and then from the DB2 command line I invoke the following command: db2 "call sqlj.install_jar('file:/path/to/jar/SystemClient.jar','SYSTEM_ML_CLIENT_JAR', 0) After that, I verify that my JAR has been correctly registered by executing: db2 "select jar_id from sysibm.sysjarcontents" and checking that the new Jar has been registered. Then, I have the following script for creating my SQL Stored Procedure (file name: create-system-call.sql): CREATE OR REPLACE PROCEDURE DB2INST1.ML_CLIENT_CALL( IN serverIPAddress VARCHAR(255), IN serverPort INTEGER, IN script VARCHAR(255), IN args VARCHAR(255)) LANGUAGE java PARAMETER STYLE java FENCED THREADSAFE EXTERNAL NAME 'SYSTEM_ML_CLIENT_JAR:SystemClient.callSystemML(java.lang.String, java.lang.Integer, java.lang.String, java.lang.String)'; And again, I execute the following script to verify that my procedure has been created: db2 "select routinename from syscat.routines where language='JAVA'" and I see…
type: AnsweredQuestion
tagged with: stored-procedures
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
tagged with: db2
accepted answer: http://stackoverflow.com/a/23684806
favorite count: 0

http://stackoverflow.com/q/23764537
tagged with: web-services
has body: I need to implement a webservice that uses the first query parameter to identify the operation, i.e. the client call would be something like: http://localhost:8080/ws/operation?info or http://localhost:8080/ws/operation?create&amp;name=something. It seems that I cannot distinguish the methods using the @Path annotation as the distinguishing characteristic is in the query parameters. And the following example is throwing exceptions as well: package com.example.ws; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; @Path("/operation") public class Operation { @GET public String info(@QueryParam("info") String info) { return "info"; } @GET public String create(@QueryParam("create") String create) { return "create"; } } Is there a way to specify methods to be used depending on query parameters? Or do I really have to define one method and check within that one whether certain query parameters are set?
linked to: http://stackoverflow.com/q/10799198
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23809887
has title: Jersey method selection by query parameters
type: Question
tagged with: jersey
possible better answer: http://stackoverflow.com/a/31277628
downvote count: 0
has answer: http://stackoverflow.com/a/31277628
linked to: http://stackoverflow.com/q/538097
answer count: 3
accepted answer: http://stackoverflow.com/a/23809887
has answer: http://stackoverflow.com/a/23764866
has comment: http://stackoverflow.com/comment/36558291
has comment: http://stackoverflow.com/comment/36561311
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/23740170
answers question: http://stackoverflow.com/q/23739314
has body: Make a custom inner class that extends JPanel and then override the onPaintComponent method. Draw the Board there. Create a new BoardPanel instead of a JPanel.
score: 0
type: Answer

http://stackoverflow.com/q/23708178
tagged with: swing
has comment: http://stackoverflow.com/comment/36435088
has body: I need to create a layout like this: ------------------------------ | | | line1(right) | | |line2(left) | | | line3 | | | | ------------------------------ where line3 is more than a line - it's a matrix of buttons. The size of the matrix needs to be fixed not like in GridLayout. How to do that? I came with a question:How to put the button on the front line?(Now he is in the middle) Container contentPane = this.getContentPane(); contentPane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); JButton button = new JButton("Button 1"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; contentPane.add(button, c);
tagged with: java
has comment: http://stackoverflow.com/comment/36434003
type: Question
has title: Layout Swing alignment
score: 0
has answer: http://stackoverflow.com/a/23712788
answer count: 1
has comment: http://stackoverflow.com/comment/36433981
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36434072
has comment: http://stackoverflow.com/comment/36434842

http://stackoverflow.com/q/23667072
has comment: http://stackoverflow.com/comment/36356099
tagged with: parsing
tagged with: android-json
has comment: http://stackoverflow.com/comment/36356554
type: UnansweredQuestion
tagged with: android
has title: JSON parse Android - object in object
has comment: http://stackoverflow.com/comment/36356085
tagged with: java
has comment: http://stackoverflow.com/comment/36356240
type: Question
has comment: http://stackoverflow.com/comment/36356299
has answer: http://stackoverflow.com/a/23670188
has comment: http://stackoverflow.com/comment/36356316
has body: How to parse this json? I want get data from title, field_place and brothers fields. { "events": [ { "event": { "title": "BITUMIX Martyna Jastrz\u0119bska", "field_place": "Nowe Miejsce Al Jerozolimskie 51 lok.2", "field_zdjecie": "http:\/\/wybierzkulture.waw.pl\/sites\/default\/files\/styles\/post\/public\/martyna_jastrzebska_bitumix_2.jpg?itok=nd2O5U5z" } }, { "event": { "title": "Wiecz\u00f3r Komedii Improwizowanej - D\u017cem Impro!", "field_place": "", "field_zdjecie": "http:\/\/wybierzkulture.waw.pl\/sites\/default\/files\/styles\/post\/public\/dzem_17_maja.jpg?itok=bfgDYxKq" } }, ... I tried: JSONObject itemm = jArray.getJSONObject(i); JSONObject oneObject = itemm.getJSONObject("event"); String title = oneObject.getString("title"); String field_place = oneObject.getString("field_place"); ... but it doesn't work.
has answer: http://stackoverflow.com/a/23670133
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36356266

http://stackoverflow.com/q/23711648
tagged with: security
has answer: http://stackoverflow.com/a/23711730
has comment: http://stackoverflow.com/comment/36440274
has comment: http://stackoverflow.com/comment/36441501
type: UnansweredQuestion
has body: I am searching for a way that help me to secure cookies by encrypting them for example. I searched a lot and I got confused. Thus, I am seeking your help to find an easy way to do that. Actually my aim is only to show that I can secure my cookies in Java for sensitive data such as password.
downvote count: 0
tagged with: cookies
score: 1
tagged with: java
has title: What is the best and easiest way to secure cookies
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23684790
has answer: http://stackoverflow.com/a/23685291
answer count: 1
tagged with: jsp
tagged with: jdbc
has title: Jsp to my sql connection error.
score: 0
type: UnansweredQuestion
type: Question
has body: This error please help: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 14 in the jsp file: /select.jsp localhost cannot be resolved 14: connection = DriverManager.getConnection(localhost, "root", "apurva"); ;
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/36389808
tagged with: sql

http://stackoverflow.com/comment/36457074
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23719939
has text: I imported android archive into adt eclipse. now there is no src folder in any app and any project cannot run . Do you have any idea why ?
type: AnswerComment

http://stackoverflow.com/q/23751189
score: 0
has title: Not able to read a POST value from a drop down
has comment: http://stackoverflow.com/comment/36516065
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/36516229
tagged with: java
has comment: http://stackoverflow.com/comment/36516250
has body: I am trying to select a value from a dropdown list in an HTML form. This is a snippet from my page: Upload file CSV or TXT file: Delimiter Enter your delimiter: Select delimiter pipe tab space I am trying to read the entered delimiter value in my Servlet code using the below code: String delimiter=request.getParameter("yourDelimiter"); But the selected value is never coming in the delimiter String. It is always coming as null. I am new to Web Projects. Can someone please help me to get this correct.
type: Question
linked to: http://stackoverflow.com/q/15729777
tagged with: servlets

http://stackoverflow.com/comment/36477239
comment on: http://stackoverflow.com/q/23730507
score: 0
type: Comment
type: QuestionComment
has text: I want the user to be able to enter a bunch of numbers on a single line, and I want to catch any that are nonnegative integers. The way I differentiate is by whether or not the sequence is both preceded and followed by another digit. I can use the Scanner class's findInLine method, which requires a Pattern defined by a regular expression.

http://stackoverflow.com/a/23623517
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36330569
has body: In java, threads are free to have local copies of variables independent from the heap. This fact is independent of both static variables and package semantics. When thinking about the java memory model, I like to think of each thread having its own copy of memory, and this copy is synchronized with global state only when you force it to. This is not entirely accurate, but you'll never be wrong thinking this way and just absorbing that will help you understand how different the Java memory model is from C/C++. To re-cap your situation: You have a memory location set from one thread You're reading that memory from another thread Java does not guarantee this is the same memory location In your case, commenters have suggested adding volatile to the variable. This is not the same as C++ volatile. I mean, not really the same. What's happening in java is that accesses to a volatile variable use memory barriers to implement a happens-before relationship between the reader and writer. A handy way is to think that a write to a volatile variable "publishes" the new value to all reader threads. A write to a non-volatile variable does not. Adding this will fix the thread that's spinning on the value b/c it will see the change immediately. (More properly, it will see the change in reference held by the variable.) However, spinning is an uncommon pattern in Java, because java has tons of easy to use locks sitting around (on every object!!) and reliable wait/notify implementations. So a java programmer might do this in your case: class Foo { private static String value; // synchronized keyword on a static method locks Foo.class public static synchronized getValue() { while(value == null) Foo.class.wait(); // can wait only when you hold the lock return value; } public static synchronized setValue(String v) { value = v; Foo.class.notifyAll(); // can notify only when you hold the lock } } The "static synchronized" method is locking the monitor on Foo.class. This is actually not a bad …
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23619936

http://stackoverflow.com/a/34173977
has body: You can take a look at this test project @gelnyang built. And this is the class for publishing EMS message specifically. Under the project, you can find other EMS related functionalities as well.
answers question: http://stackoverflow.com/q/23650060
score: 0
type: Answer

http://stackoverflow.com/q/23683126
type: Question
has comment: http://stackoverflow.com/comment/36386714
has comment: http://stackoverflow.com/comment/36387506
has comment: http://stackoverflow.com/comment/36387115
has comment: http://stackoverflow.com/comment/36527025
has body: I want to write a few arguments in a .txt file and I want to sort them. To do that I want to go to the next line for every groop of arguments but I dont know how to do that.I have tried the: x.nextLine(); statement, but that is only for scanning and not for formatting. How can I go to the next line of a file while formatting? Is there another statement for that? This is the code I created: try{ w = new Formatter("data.txt"); } catch(Exception e){ JOptionPane.showMessageDialog(null, "Fatal Error, please Reboot or reinstal program", "Error", JOptionPane.PLAIN_MESSAGE); } w.format("%s,%s,%s,%s%n", book,code,author,editor); w.close();
downvote count: 3
has comment: http://stackoverflow.com/comment/36386910
answer count: 1
favorite count: 0
score: -3
tagged with: file
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36387076
has answer: http://stackoverflow.com/a/23683475
accepted answer: http://stackoverflow.com/a/23683475
tagged with: java
tagged with: filewriter
tagged with: formatting
has comment: http://stackoverflow.com/comment/36386674
has title: How to write on the second line in a .txt file (java)

http://stackoverflow.com/comment/36490149
score: 0
type: QuestionComment
type: Comment
has text: [Related](http://stackoverflow.com/questions/155243/why-is-it-impossible-without-attempting-i-o-to-detect-that-tcp-socket-was-grac?lq=1) [questions](http://stackoverflow.com/questions/151590/java-how-to-detect-a-remote-side-socket-close) which discuss how to detect that socket was closed (or actually why it is not possible to detect reliably).
comment on: http://stackoverflow.com/q/23737362

http://stackoverflow.com/q/23659645
has comment: http://stackoverflow.com/comment/36342640
has comment: http://stackoverflow.com/comment/36341770
has answer: http://stackoverflow.com/a/23659746
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36342392
upvote count: 0
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/23659740
has answer: http://stackoverflow.com/a/23659792
type: Question
has comment: http://stackoverflow.com/comment/36341241
has comment: http://stackoverflow.com/comment/36342064
score: -1
tagged with: inheritance
has comment: http://stackoverflow.com/comment/36341406
tagged with: class
tagged with: arraylist
answer count: 3
has title: List objects from different class in Java
has body: Assuming I have following classes: class B extends A class C extends A class D extends B List: List&lt;A&gt; mylist, And objects from different class: A b = new B(); A c = new C(); B d = new D(); B b2 = new B(); Which of the following is correct? And why? mylist.add(b); mylist.add(c); mylist.add(d); mylist.add(b2); What is the difference between these two way of declare: B b2 = new B() and A b = new B(); The reference type of object b and c are A, so I think these two lines of code are correct, am I right? What about the other two? The reason I ask this question is because I want to implement this function: //calculate method in different class will do different calculation. class A{ int calculate(int parameter1, int parameter2){ return parameter1*parameter2; } } class B extends A{ int calculate(int parameter1, int parameter2){ return parameter1+parameter2; } } class C extends A{ int calculate(int parameter1, int parameter2){ return parameter1-parameter2; } } class D extends B{ int calculate(int parameter1, int parameter2){ return parameter1/parameter2; } } A b = new B(); A c = new C(); B d = new D(); B b2 = new B(); List&lt;A&gt; mylist; mylist.add(b); mylist.add(c); mylist.add(d); mylist.add(b2); // TODO hundreds of objects from subclass of A are added into this list Iterator&lt;A&gt; iterator = mylist.iterator(); while(iterator.hasNext()){ System.out.println(iterator.calculate(2,1)); }
downvote count: 1

http://stackoverflow.com/q/23638181
type: AnsweredQuestion
has body: I have no idea what I am doing wrong. I want to create a path variable in my Android project, but everytime I get a NoClassDefFoundError. test = test + ".turns"; //This is a simple String List&lt;String&gt; turnlist = new ArrayList&lt;String&gt;(); Path testfile = (Path) Paths.get(test); Logcat: 05-13 19:08:51.996: E/AndroidRuntime(23437): FATAL EXCEPTION: Thread-1108 05-13 19:08:51.996: E/AndroidRuntime(23437): Process: com.example.voicerecorder, PID: 23437 05-13 19:08:51.996: E/AndroidRuntime(23437): java.lang.NoClassDefFoundError: java.nio.file.Paths 05-13 19:08:51.996: E/AndroidRuntime(23437): at com.example.voicerecorder.activities.RecordActivity$TestLoader.run(RecordActivity.java:201) I have no idea what I am doing wrong. EDIT I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath! I will never again put my desktop jre into my android classpath!
accepted answer: http://stackoverflow.com/a/23638239
tagged with: java
score: 6
tagged with: noclassdeffounderror
possible better answer: http://stackoverflow.com/a/23638296
has answer: http://stackoverflow.com/a/23638296
type: Question
has title: NoClassDefFoundError on Android
answer count: 2
has answer: http://stackoverflow.com/a/23638239
downvote count: 0
favorite count: 0
tagged with: android
upvote count: 6

http://stackoverflow.com/comment/36386774
comment on: http://stackoverflow.com/q/23678518
has text: I don't know if it helps, but you could give an alternative library a try and compare performance. It's [DavidWebb](http://hgoebl.github.io/DavidWebb/), a tiny wrapper around `HttpURLConnection`. I've prepared a [gist](https://gist.github.com/hgoebl/9dcb663243db3f5fcbd3) for you.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23767232
favorite count: 0
linked to: http://stackoverflow.com/q/258099
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/258099
tagged with: exit
has title: Exit on special button
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23767349
accepted answer: http://stackoverflow.com/a/23767349
upvote count: 1
answer count: 1
has body: I have created a custom exit button and i want the code to terminate if that button is pressed. How can i achieve that? String[] button1 = {"exit", "next"}; //if next is pressed if (code == JOptionPane.YES_OPTION) { JOptionPane.showMessageDialog( null, "Knock knock" + "\nWho is there", "The Jasmin Project", JOptionPane.YES_NO_OPTION); int no = JOptionPane.showOptionDialog(null, "Want to view more?", "The Jasmin Project", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, button1, button1[0]); //end code if exit is pressed if (no == JOptionPane.NO_OPTION) { System.exit(1); } }

http://stackoverflow.com/comment/36354257
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23666110
has text: apache commons collection has one.
score: 0

http://stackoverflow.com/q/23730834
possible better answer: http://stackoverflow.com/a/41813623
has answer: http://stackoverflow.com/a/41813623
type: Question
has comment: http://stackoverflow.com/comment/36477764
has title: How to create fair lock to solve starvation in java?
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23730893
favorite count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/110342616
has body: I want to create fair lock so that each thread was given a lock one after the other regardless of priorities. import java.util.concurrent.locks.ReentrantLock; public class StarvationRunnable implements Runnable { private ReentrantLock lock = new ReentrantLock(true); public void doLongTask() { lock.lock(); // to imitate long running task in critical section for (int i = 0; i &lt; 1000000000; i++) ; System.out.println(Thread.currentThread().getName() + " is running with priority " + Thread.currentThread().getPriority() + " !"); lock.unlock(); } @Override public void run() { for (;;) { doLongTask(); } } public static void main(String[] args) { StarvationRunnable runnable = new StarvationRunnable(); for (int i = 0; i &lt; 4; i++) { Thread thread = new Thread(runnable); thread.setPriority(i == 3 ? Thread.MIN_PRIORITY : Thread.MAX_PRIORITY); thread.start(); } } } So I have 4 threads. 3 with max priority and 1 with min priority. I create fair lock by new ReentrantLock(true); When I run this demo it doesn't give thread with min priority to execute as many times as to threads with max priority. But I think that fair lock is just for that. How to use fair lock correctly?
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23730893
tagged with: concurrency
tagged with: reentrantlock
has comment: http://stackoverflow.com/comment/36477797
downvote count: 0

http://stackoverflow.com/comment/36415008
has text: Isn't enumerating a `TreeSet` linear time? Maintaining the average labels (more likely, a sum label and a count label) isn't too hard if you implement the binary tree in the modular fashion proposed by [Austern et al.](http://www.stroustrup.com/tree-appendix.pdf).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23697882
type: Comment

http://stackoverflow.com/q/23762124
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23762290
has comment: http://stackoverflow.com/comment/36536931
upvote count: 1
has comment: http://stackoverflow.com/comment/36536837
has answer: http://stackoverflow.com/a/23762290
has title: Importing Java classes run-time and compilation
favorite count: 0
has body: Could someone explain what importing java.net.* imports? Also could someone explain briefly how importing say java.swing.* would affect the run-time and compilation.
has comment: http://stackoverflow.com/comment/36536957
linked to: http://stackoverflow.com/q/20777260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23762288
accepted answer: http://stackoverflow.com/a/23762288
score: 1
tagged with: java
tagged with: import
type: Question

http://stackoverflow.com/comment/36271756
comment on: http://stackoverflow.com/a/23623831
type: Comment
has text: So basically I need to execute two quires. Thanks for the reply.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36558964
has text: Why do you want to know when the tab is clicked?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23773286
type: QuestionComment

http://stackoverflow.com/a/23757454
has comment: http://stackoverflow.com/comment/36528098
score: 5
has comment: http://stackoverflow.com/comment/36527878
has comment: http://stackoverflow.com/comment/36528069
type: Answer
answers question: http://stackoverflow.com/q/23756966
has comment: http://stackoverflow.com/comment/36528581
upvote count: 5
has comment: http://stackoverflow.com/comment/36529813
downvote count: 0
has body: I think this has to do with the CompileThreshold flag which controls when the byte code is compiled into machine code by JIT. The Oracle JDK has a default count of 10,000 as document at http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html. Where OpenJDK I couldn't find a latest document on this flag; but some mail threads suggest a much lower threshold: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2010-November/004239.html Also, try turn on / off the Oracle JDK flags like -XX:+UseCompressedStrings and -XX:+OptimizeStringConcat. I am not sure if those flags are turned on by default on OpenJDK though. Could someone please suggest. One experiement you can do, is to firstly run the program by a lot of times, say, 30,000 loops, do a System.gc() and then try to look at the performance. I believe they would yield the same. And I assume your GC setting is the same too. Otherwise you are allocating a lot of objects and the GC might well be the major part of your run time.

spring-security
tags question: http://stackoverflow.com/q/23751281
tags question: http://stackoverflow.com/q/23683555
tags question: http://stackoverflow.com/q/23657595
tags question: http://stackoverflow.com/q/23756832
tags question: http://stackoverflow.com/q/23688322
tags question: http://stackoverflow.com/q/23638462
tags question: http://stackoverflow.com/q/23728688
tags question: http://stackoverflow.com/q/23741629
type: Tag
tags question: http://stackoverflow.com/q/23673250
tags question: http://stackoverflow.com/q/23616317
tags question: http://stackoverflow.com/q/23776131
tags question: http://stackoverflow.com/q/23665191
tags question: http://stackoverflow.com/q/23617096
tags question: http://stackoverflow.com/q/23700951
tags question: http://stackoverflow.com/q/23684514
tags question: http://stackoverflow.com/q/23752029
tags question: http://stackoverflow.com/q/23677717
tags question: http://stackoverflow.com/q/23723469
tags question: http://stackoverflow.com/q/23638985
tags question: http://stackoverflow.com/q/23738187
tags question: http://stackoverflow.com/q/23730090
tags question: http://stackoverflow.com/q/23730333
tags question: http://stackoverflow.com/q/23692094
tags question: http://stackoverflow.com/q/23679990
tags question: http://stackoverflow.com/q/23661492
tags question: http://stackoverflow.com/q/23685490
tags question: http://stackoverflow.com/q/23778134
tags question: http://stackoverflow.com/q/23726666
tags question: http://stackoverflow.com/q/23654889
tags question: http://stackoverflow.com/q/23630097
tags question: http://stackoverflow.com/q/23693796
tag name: spring-security
tags question: http://stackoverflow.com/q/23713672
tags question: http://stackoverflow.com/q/23659188
tags question: http://stackoverflow.com/q/23634163
tags question: http://stackoverflow.com/q/23636368

http://stackoverflow.com/q/23623029
has comment: http://stackoverflow.com/comment/36314788
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/39504454
has comment: http://stackoverflow.com/comment/36314904
type: Question
upvote count: 4
has body: I am trying to access the Opendaylight APIs from my sample project and getting javax.xml.bind.UnmarshalException, when I execute the code. I have figured out that, this exception is caused when trying to instantiate an abstract class. But, this is the sample code from official source and I don't have control over the APIs. I tried replacing the classes from library with the classes I generated using the XSD and result is the same. Can someone tell me what is wrong or what can be done? Here is the sample code and output. Please note, the server is configured correctly and I am getting the response. import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import org.apache.commons.codec.binary.Base64; import org.opendaylight.controller.sal.reader.FlowOnNode; import org.opendaylight.controller.statistics.northbound.AllFlowStatistics; import org.opendaylight.controller.statistics.northbound.FlowStatistics; public class JAXBStatisticsClient { public static void main(String[] args) { System.out.println("Starting Statistics JAXB client."); String user = "admin"; String password = "admin"; String containerName = "default"; String baseURL = "http://172.18.2.95:8080/controller/nb/v2/statistics"; try { URL url = new java.net.URL(baseURL + "/" + containerName + "/flow"); String authString = user + ":" + password; byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); URLConnection connection = url.openConnection(); connection.setRequestProperty("Authorization", "Basic " + authStringEnc); connection.setRequestProperty("Content-Type", "application/xml"); connection.setRequestProperty("Accept", "application/xml"); connection.connect(); InputStream inputStream = connection.getInputStream(); JAXBContext context = JAXBContext.newInstance(AllFlowStatistics.class); Unmarshaller unmarshaller = context.createUnmarshaller(); AllFlowStati…
has comment: http://stackoverflow.com/comment/36272403
downvote count: 0
score: 4
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/36314392
has comment: http://stackoverflow.com/comment/36316298
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: JAXB throwing InstantiationException when accessing Opendaylight northbound APIs
tagged with: opendaylight
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36314155
has comment: http://stackoverflow.com/comment/36271055
has comment: http://stackoverflow.com/comment/36320843
has comment: http://stackoverflow.com/comment/36298214

http://stackoverflow.com/a/23717955
accepted answer of: http://stackoverflow.com/q/23717939
answers question: http://stackoverflow.com/q/23717939
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36452582
type: Answer
upvote count: 3
has body: Your lunarButton may be declared locally, perhaps in the init method. One solution: declare it as an instance field in the class, not in the init method. Solution two: don't even worry about the variable. Get the JButton object from the ActionEvent parameter's getSource() method. Cast the object returned to JButton, and call whatever methods you'd like on it. For example: if("switch".equals(action)) { // ImageIcon sun = new ImageIcon("assets/sun.png"); // ImageIcon moon = new ImageIcon("assets/moon.png"); JButton btn = (JButton) ae.getSource(); changeLunar(); count++; if (count % 2 == 0) { btn.setIcon(sun); } else { btn.setIcon(moon); } As an aside: you really don't want to re-load the images from disk each time the button is pushed. Instead read the images in once, perhaps in a constructor, stuff them into an ImageIcon field, and use that field when needed.
score: 3

http://stackoverflow.com/a/23687546
type: Answer
answers question: http://stackoverflow.com/q/23686881
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36396047
has body: Answering this accurately would require knowing more about your project (presumably hhs.app). However, Drodio's hierarchy did discover PersistHistoryAsyncTask, which is a private inner class of ActivityChooserModel, not listed in the Android documentation due to being a private class, so my point on no classes in that android library inheriting from AsyncTask in my original response (below) was incorrect. Assuming the listed inner classes in RESTfulActivity, SQLiteActivity, MainActivity, and DeliveryItemActivity all extend AsyncTask, the results in your second screenshot are entirely expected. AsyncTask does not inherit from anything (except Object, obviously), and you have 9 classes extending AsyncTask. So, you have the very simple hierarchy: java.lang.Object | +-- android.os.AsyncTask | +-- hhs.app.RESTfulActivity.PostDeliveryItemTask | +-- hhs.app.SQLiteActivity.FetchAndPopTask | +-- hhs.app.MainActivity.GetVendorsTask | +-- hhs.app.DeliveryItemActivity.PostDeliveryItemTask | +-- etc... Original Answer: You're looking at two different classes: android.content.AsyncTaskLoader and android.support.v4.content.AsyncTaskLoader. The former is an: Abstract Loader that provides an AsyncTask to do the work. The latter is a: Static library support version of the framework's AsyncTaskLoader. Used to write apps that run on platforms prior to Android 3.0. Both AsyncTaskLoader classes inherit from a class named Loader in their same package, and the two Loader classes inherit from Object. None of the classes in question implement any interfaces. You can see the source for both classes on grepcode.com: android.content.AsyncTaskLoader android.support.v4.content.AsyncTaskLoader Neither class is coupled to the other in any way that I can see. The support version imports android.content.Context, but Context doesn't do anything with the AsyncTaskLoader in its own package. All that said, it does not appear that the feature of Drodio you've posted a screenshot of is intended to be the i…
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23686881

http://stackoverflow.com/comment/36519896
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23666101
has text: Yes, but using holder for the children will prevent re-inflating the children views not entire view. But now you are using holder for the entire view so there may be a chance to prevent re-inflating the entire row view right? Thats the problem in your case I believe. Try and let me know your result.
score: 0

http://stackoverflow.com/q/23735179
answer count: 1
accepted answer: http://stackoverflow.com/a/23735446
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/12427167
linked to: http://stackoverflow.com/q/16683984
has body: I have a pretty standard Java POJO. Let's call it Dog: Dog.java has a series of fields. In Java, convention says field names should start with a lower case. This means I have: public String name; public String dogType; public String weight; At the same time, I have a requirement on my JSON format that the JSON members (name, dogType, and weight) all be written with a capital letter at the beginning i.e. Name, DogType, and Weight. I am using Jackson. If I use the standard serialization code as below, I get JSON member names written exactly the same way they are in Java. ObjectMapper mapper = new ObjectMapper(); String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jReq); System.out.println(json); To address my problem, I have 2 options: either I use the Jackson annotation @JsonProperty(value="DogType"), or I use a naming strategy as described in the API. My question is: is there a clean way of doing it? There are quite a few questions on SO about this that explain both ways: Change field case with an ObjectMapper Model class for Jackson Parser to parse Uppercase properties But none go into the pros and cons. My initial hunch is that I should go for the naming strategy. Is that a good approach or a bad one?
type: Question
has answer: http://stackoverflow.com/a/23735446
has title: Java objects to JSON: field names
type: AnsweredQuestion

http://stackoverflow.com/q/23767818
downvote count: 0
tagged with: java
has title: Pattern detection in an image with JavaCV
tagged with: image-processing
type: Question
tagged with: javacv
score: 4
has body: I'm trying to create a code which should at the end recognize some pattern/shape in a picture. I've had some trouble when I tried to draw the shape on the pic ("Output3" in this case). The program seems not to end. I think there is a infinite loop with the while function. The program doesn't display the output3. What's the issue? INPUT image: OUTPUT2 image: public class Hello { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub // Memory storage CvMemStorage memory = CvMemStorage.create(); CvSeq contours = new CvSeq(null); // Display original contour image .png, then GRAYSCALE and display in CanvasFrame IplImage image = cvLoadImage("contour.jpg", CV_LOAD_IMAGE_GRAYSCALE); CanvasFrame canvas = new CanvasFrame("Output", 1); CanvasFrame canvas2 = new CanvasFrame("Output2", 1); CanvasFrame canvas3 = new CanvasFrame("Output3", 1); canvas.showImage(image); // thresholding cvSmooth(image, image, CV_BLUR, 9 , 9, 2, 2); cvThreshold(image, image, 155, 255, CV_THRESH_BINARY); cvCanny(image, image, 20*7*7, 40*7*7, 7); cvDilate(image, image, null, 1); canvas2.showImage(image); cvSaveImage("output2.jpg", image); // finding contours cvFindContours(image, memory, contours, Loader.sizeof(CvContour.class), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0)); while(contours != null &amp;&amp; !contours.isNull()) { if(contours.elem_size() &gt; 0) { CvSeq approx = cvApproxPoly(contours, Loader.sizeof(CvContour.class), memory, CV_POLY_APPROX_DP, (int) cvContourPerimeter(contours)*0.02, 0); cvDrawContours(image, approx, CvScalar.BLUE, CvScalar.BLUE, -1,1, CV_AA); } contours.h_next(); } canvas3.showImage(image); } My goal is to take a photo, send it to the program which should return: This is a square This is a rectangle This is a circle This is an hexagon
has answer: http://stackoverflow.com/a/33033796
favorite count: 0
answer count: 1
upvote count: 4
tagged with: detection
type: UnansweredQuestion
tagged with: opencv

http://stackoverflow.com/q/23760477
downvote count: 0
favorite count: 0
has body: I want to pass an xml string through POST method to an URL. I tried below snippet but it doesn't return anything disableCertificateValidation(); String url = "https://..url"; //https Properties sysProps = System.getProperties(); sysProps.put("proxySet", "true"); sysProps.put("proxyHost", "1.2.3.4"); sysProps.put("proxyPort", "80"); Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication("userid", "password".toCharArray())); } }; Authenticator.setDefault(authenticator); String xml = ---xml string; URL urll; HttpURLConnection connection = null; try { // Create connection urll = new URL(url); connection = (HttpURLConnection) urll.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + Integer.toString(xml.getBytes().length)); connection.setRequestProperty("Content-Language", "en-US"); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); // Send request DataOutputStream wr = new DataOutputStream(connection .getOutputStream()); wr.writeBytes(xml); wr.flush(); wr.close(); // Get Response InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer response = new StringBuffer(); while ((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); System.out.println("response.toString();"+response.toString()); } catch (Exception e) { e.printStackTrace(); } finally { if (connection != null) { connection.disconnect(); } } But when I try to post it through jsp I get the proper response from the url. &lt;script type="text/javascript"&gt; function set(){ document.getElementById("eXml").value=---xml string document.getElementById("textt").value=document.getElementById("eXml").value; alert(document.getElementById…
possible better answer: http://stackoverflow.com/a/48605771
has answer: http://stackoverflow.com/a/48605771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23760787
tagged with: java
tagged with: httpconnection
tagged with: https
type: Question
score: 4
accepted answer: http://stackoverflow.com/a/23760787
tagged with: post
upvote count: 4
has title: Send Xml string through POST method in java
answer count: 2

http://stackoverflow.com/comment/36426675
type: QuestionComment
has text: The concern I have is that you do all your set up in a constructor. In this simple example it's fine, but if you had your class implement some event handler, and if you added it as an action listener in your init method, then you would be exposing an instance of your class before its constructor had completed. This can come back to bite you.
score: 3
comment on: http://stackoverflow.com/q/23704010
type: Comment

http://stackoverflow.com/q/23679189
has answer: http://stackoverflow.com/a/42545592
has title: DB management using Entity Objects
answer count: 3
tagged with: oracle-database
has body: I have a bean in my Fusion Web Application where I'm supposed to insert new data into a table of my database through java code (after appropriate validation). The question is how should I do the insertion? Should I use Entity Objects? How? P.S.: This is not the way it should work http://jneelmani.blogspot.com/2009/11/adf-insert-using-storeprocedure.html
tagged with: oracle-adf
accepted answer: http://stackoverflow.com/a/24136609
possible better answer: http://stackoverflow.com/a/23696396
has answer: http://stackoverflow.com/a/23696396
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: database
tagged with: entity
has answer: http://stackoverflow.com/a/24136609

http://stackoverflow.com/q/23651911
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/23656277
has comment: http://stackoverflow.com/comment/36326024
has body: Im working on a struts based web application with tomcat server, using jdbc to connect the DB, and using mySql and sql server DB, and added related jars as well, but having this exception how to resolve the issue. com.mind.fw.lang.MindFWRuntimeException: Error while doing JNDI lookup at com.mind.fw.core.dao.util.DBUtil.getJndiDS(DBUtil.java:186) at com.mind.fw.core.dao.util.DBUtil.initializeDS(DBUtil.java:157) at com.mind.fw.core.dao.util.DBUtil.getDataSource(DBUtil.java:132) at com.mind.common.util.MySqlConnection.getMySqlConnection(MySqlConnection.java:21) at com.mind.dao.PVS.Pvsdao.getSearchpartnerdetailsWithStatus(Pvsdao.java:1901) at com.mind.actions.PVS.Partner_SearchAction.search(Partner_SearchAction.java:371) 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.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.mind.common.CharsetEncoding.doFilter(CharsetEncoding.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFi…
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36326446
has comment: http://stackoverflow.com/comment/36326107
tagged with: java
has title: Error while connecting to mySql DB with tomcat server
has comment: http://stackoverflow.com/comment/36326499
type: Question
tagged with: jdb
upvote count: 0
has answer: http://stackoverflow.com/a/23656277
has comment: http://stackoverflow.com/comment/36325964
answer count: 1

http://stackoverflow.com/q/23652334
accepted answer: http://stackoverflow.com/a/29472809
has comment: http://stackoverflow.com/comment/36416545
score: 0
tagged with: nullpointerexception
tagged with: mahout
has comment: http://stackoverflow.com/comment/36352918
tagged with: mahout-recommender
type: AnsweredQuestion
tagged with: java
has body: I'm using the mahout version 0.9. I have got NPE at demo server with following stacktrace. HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException type Exception report message Request processing failed; nested exception is java.lang.NullPointerException description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) root cause java.lang.NullPointerException org.apache.mahout.cf.taste.impl.recommender.TopItems.getTopUsers(TopItems.java:119) org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood.getUserNeighborhood(NearestNUserNeighborhood.java:94) org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender.recommend(GenericUserBasedRecommender.java:87) org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender.recommend(AbstractRecommender.java:63) .....recommendationengine.service.RecommendationService.findRecommendedProductsForOpportunityByMahout(RecommendationService.java:69) .....recommendationengine.controller.RecommendationController.recommendedForOpportunity(RecommendationController.java:54) sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:491) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) org.springframework.web.method.support.InvocableHandlerMet…
type: Question
has answer: http://stackoverflow.com/a/29472809
has comment: http://stackoverflow.com/comment/36370199
has title: NPE in Mahout TopItems#getTopUsers
answer count: 1

http://stackoverflow.com/comment/36313437
type: Comment
has text: That's because you haven't got the signature of your toString() method right. Check that it is: `public String toString() {...}`. The default `Object.toString()` prints the name of the class and reference (which is what you are seeing).
comment on: http://stackoverflow.com/a/23643660
score: 0
type: AnswerComment

http://stackoverflow.com/q/23770475
type: AnsweredQuestion
score: 0
tagged with: scala
has body: In general, SBT revolver has worked well for me, but for some reason I've started seeing the following error over and over again: I'll be editing a particular class and will hit save and the following error message will pop up: java.lang.IllegalArgumentException: requirement failed: Source file '/path/to/class/ClassName.class' does not exist. Is there a way to modify my ~/.sbtconfig file to overcome this? Or is there another solution?
type: Question
tagged with: sbt
has comment: http://stackoverflow.com/comment/36572887
tagged with: java
has title: java.lang.IllegalArgumentException in SBT revolver
has answer: http://stackoverflow.com/a/25859373
answer count: 1
accepted answer: http://stackoverflow.com/a/25859373

http://stackoverflow.com/comment/36485260
score: 0
type: Comment
type: QuestionComment
has text: Out of interest, what will you use this number for?
comment on: http://stackoverflow.com/q/23734998

http://stackoverflow.com/q/23639403
tagged with: eclipse
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/23639458
accepted answer: http://stackoverflow.com/a/23639458
has answer: http://stackoverflow.com/a/23640076
favorite count: 0
has body: I saw some similar questions on this,but I don't understand them enough so i want to ask the question and tailor it my own way. I have a properties file that I store in src/main/resources, and then reference this in my code like so: Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("src/main/resources/app.properties"); // load a properties file prop.load(input); this works locally, however when I create a .war file and deploy it to the sever it has no idea where the properties file is. Where do I put this properties file, and how do I reference it in the code, so that I can run it locally, and on the server without any problems?
tagged with: properties
has title: Where to put properties file in eclipse and how to access the path both locally and on server
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23639492
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23640076
type: Question
score: 3

http://stackoverflow.com/comment/36501345
score: 0
type: Comment
type: QuestionComment
has text: public void LoadModules(ArrayList<Module> modules){ moduleListModel.clear(); for(Module mod : modules){ moduleListModel.addElement(mod); } The modules ArrayList is an ArrayList filled with Module-objects. sem1ListMoel is filled in the same way.
comment on: http://stackoverflow.com/q/23743162

http://stackoverflow.com/comment/36381025
has text: Still not working... We have "compileJava.options.encoding = 'UTF-8'" in our build.gradle so this coudn't be the problem. I hate when something not print a proper and useful error message like MAILFORMED "/asd/asd.xml:100:23" Its like finding a fish in a sea.
comment on: http://stackoverflow.com/q/23678908
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23623665
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23626369
score: 1
tagged with: java
tagged with: compression
type: Question
tagged with: hadoop
tagged with: lzo
has comment: http://stackoverflow.com/comment/38005885
has body: I am running into a strange problem failing to inflate/uncompress lzo compressed data in java which was deflated/compressed from python lzo module although both seem to be using the same native lzo codec implementation. To give more details, I am using the python module from here: https://github.com/jd-boyd/python-lzo and compressing a simple byte "a" yields import lzo lzo.compress("a") &gt; '\xf0\x00\x00\x00\x01\x12a\x11\x00\x00' and compressing the same byte "a" in java using https://github.com/twitter/hadoop-lzo yields byte[] b = new byte[1]; b[0] = 'a' ByteArrayInputStream inputByteStream = new ByteArrayInputStream(b); ByteArrayOutputStream outputByteStream = new ByteArrayOutputStream(); LzoCodec lzoCodec = new LzoCodec(); Configuration conf = new Configuration(); lzoCodec.setConf(conf); OutputStream outputStream = lzoCodec.createOutputStream(outputByteStream); int data = inputByteStream.read(); while (data != -1) { outputStream.write(data); data = inputByteStream.read(); } StringBuilder sb = new StringBuilder(); for (byte b : outputByteStream.toByteArray()) { sb.append(String.format("%02X ", b)); } System.err.println(sb.toString()); &gt; 00 00 00 01 00 00 00 05 12 61 11 00 00 The trailing part looks similar i.e. the part [ 11 00 00 ] but header definitely looks off. I made sure that both python and java are using lzo version 2.03 and default compression strategy in both python and java is LZO1X_1. Any help will be appreciated.
has title: lzo codec difference b/w python and java
tagged with: hadoop-lzo

http://stackoverflow.com/comment/36457456
type: AnswerComment
has text: Also if I want to put a separator in the java code how should I write it
comment on: http://stackoverflow.com/a/23720256
type: Comment
score: 0

http://stackoverflow.com/comment/36529559
has text: no this is not helping!! still in the url i can see that it takes the req_type- publisher but not processing its request and getting me a blank page and doesnot execute the query even
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23758361
type: Comment

http://stackoverflow.com/comment/36534488
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23746533
type: Comment
has text: `Why abstract factory pattern>?` Because the abstract factory yields no concrete implementation details. If you have a component that uses a bunch of `product` interfaces you can give it an `Abstract Factory` and that produces those `products`. You are free to swap the implementations of the `Factory` and the `products` behind the interfaces with out impacting the component that uses them.

http://stackoverflow.com/q/23765287
tagged with: refactoring
tagged with: java
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/23765376
has answer: http://stackoverflow.com/a/23765423
has comment: http://stackoverflow.com/comment/36542987
type: Question
has comment: http://stackoverflow.com/comment/36543040
possible better answer: http://stackoverflow.com/a/23765423
tagged with: concurrency
answer count: 2
has body: I'm currently refactoring some code and I keep finding blocks like the one below: for (int i = 0; i &lt; NumSortThreads; i++) { logger.info("Starting sorting thread " + (i) + "/" + NumSortThreads + "... "); sorter = new FooSorter(batchQueue, fooQue, RsaveQueue, minSamples); Sorter = new Thread(sorter); Sorter.start(); } Can you reuse a thread object in this manner? It's important as later I go to terminate the thread (using one of the object's methods) and I'm not sure if it will actually kill all of the spawned threads. I can't find any documentation on the matter but from what I know of Java I would assume that each time new Thread(obj) is called, it's killing the previous thread. This is partially based off the fact that I know java provides another object for Thread Groups (which is what the original author was probably going for). Does this code produce NumSortThreads threads? Or does produce only one due to repeat instantiation?
accepted answer: http://stackoverflow.com/a/23765376
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36542952
has title: Reusing Thread Object in a for loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36543007
score: 1

http://stackoverflow.com/q/23743842
answer count: 1
upvote count: 6
favorite count: 0
tagged with: android
tagged with: cryptography
has title: Random access InputStream using AES CTR mode in android
downvote count: 0
type: UnansweredQuestion
tagged with: encryption
score: 6
has answer: http://stackoverflow.com/a/23744623
tagged with: java
has body: I am unable to find any working example for AES CTR encryption for random access. Can someone guide me how to use the counter in CTR MODE also how to implement jumping to a specific position in the stream? The default stream implementation (CipherInputStream) doesn't skip the stream and it corrupts the plain text. I am trying to decrypt encrypted Video file stored on sdcard in Android. An embedded HTTP file server decrypts it on the fly. Everything is working fine until a user performs a seek within the video: the video stops immediately because it receives corrupt video stream. I am using following code to initialize and encrypt/ decrypt stream (for sake of simplicity i hard coded the keys. it will not be hard coded in production) ByteBuffer bb = ByteBuffer.allocate(16); bb.put("1234567891230000".getBytes()); byte[] ivString = bb.array(); // INITIALISATION String keyString = "1234567812345678"; IvParameterSpec iv = new IvParameterSpec(ivString); SecretKeySpec keySpec = new SecretKeySpec(keyString.getBytes(), "AES"); // FOR ENCRYPTION Cipher cipher = Cipher.getInstance("AES/CTR/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(ivString)); Inputstream encrypted_is = new CipherInputStream(in, cipher); // FOR DECRYPTION cipher.init(Cipher.DECRYPT_MODE, keySpec, new IvParameterSpec(ivString)); Inputstream decrypted_is = new CipherInputStream(in, cipher);
type: Question
has comment: http://stackoverflow.com/comment/39835778
has comment: http://stackoverflow.com/comment/36502536

http://stackoverflow.com/comment/36403043
comment on: http://stackoverflow.com/a/23691058
type: Comment
has text: I generate jar file with your maven config, it works for me. Can you post the whole maven pom file?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23724911
has comment: http://stackoverflow.com/comment/36466176
has body: You are doing something far too complicated than is necessary. Instead of having the listener as a seperate class, you could have it as an anonymous class. That way you can get a handle on the outer class (butonTest.this), and call any method you want on it. m_submit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { submit(); System.out.println("Test"); butonTest.this.close(); } }); I'm not sure what you are trying to do with the infinite loop. It would have run to completion before you show the dialog anyway. It would help to read up a bit on how Event-Handling works in Swing :)
answers question: http://stackoverflow.com/q/23724691
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23724691

http://stackoverflow.com/comment/36476633
type: Comment
comment on: http://stackoverflow.com/a/23676521
type: AnswerComment
score: 0
has text: If it has solved your problem . Accept the answer by clicking the 'Tick' mark that appears to the left of my answer

http://stackoverflow.com/a/23635376
type: Answer
accepted answer of: http://stackoverflow.com/q/23624873
answers question: http://stackoverflow.com/q/23624873
type: AcceptedAnswer
has body: I solved the problem by removing "INNER JOIN" from that SQL2 string.
score: 0

http://stackoverflow.com/q/23687289
has title: Could not find the main class: when running Java Jar?
downvote count: 1
type: Question
tagged with: java
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/23687332
upvote count: 0
possible better answer: http://stackoverflow.com/a/23687338
tagged with: jar
has answer: http://stackoverflow.com/a/23687338
favorite count: 0
tagged with: linux
linked to: http://stackoverflow.com/q/10149463
accepted answer: http://stackoverflow.com/a/23687332
type: AnsweredQuestion
has body: I'm having trouble running a java Jar file. I'm getting the error "Could not find the main class: com.body.Mouth. Program will exit." Valid (No error): running Mouth class from eclipse. main function is in Mouth. Invalid (could not find main class error): java -jar Eat.jar java -jar Eat.jar com.body.Mouth thanks, Hank
has comment: http://stackoverflow.com/comment/36394670

http://stackoverflow.com/comment/36498872
has text: are you even creaing a connection to that port
comment on: http://stackoverflow.com/q/23742157
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36347165
comment on: http://stackoverflow.com/q/23661758
type: Comment
has text: Because you are modifying the **same** `subMap` object, when you add the two more values in your `subMap` the map paired with key `"one"` is **also** modified. You manipulate the **same** reference.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36552657
type: Comment
has text: What do you mean "the property is null"? Which property, and how are you asking?
type: QuestionComment
comment on: http://stackoverflow.com/q/23769992
score: 0

http://stackoverflow.com/q/23622189
has title: Servlet-mapping glitch with spring mvc
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23625466
tagged with: spring
tagged with: spring-mvc
has body: ​If I try: app /* I get this error: No mapping found for HTTP request with URI [/sample/WEB-INF/jsp/person.jsp] If I try just / as then everything works fine. My url : http://localhost:8080/sample/person Why is this happening? What is the preferred way of doing this configuration in web.xml? My app-servlet.xml has : <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" />
has comment: http://stackoverflow.com/comment/36268840
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23625277
tagged with: servlet-mapping

http://stackoverflow.com/a/23750915
upvote count: 2
has body: That means the empty string; JUnit puts the value in angle brackets.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23750846
has comment: http://stackoverflow.com/comment/36515505
accepted answer of: http://stackoverflow.com/q/23750846
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36515484

http://stackoverflow.com/q/23676644
has title: hibernate 4.3.5 with Jboss 6.3 eap
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: jboss
tagged with: eclipse
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: when i use hibernat 4.3.5 with jboss 6.3 eap and try to start jboss, i get the following exception Failed to define class org.jboss.as.jpa.hibernate4.JBossAppServerJtaPlatform in Module "org.jboss.as.jpa.hibernate:4" from local module loader @55308275 (finder: local module finder @63c4fb04 (roots: D:\jboss-eap-6.3\modules,D:\jboss-eap-6.3\modules\system\layers\base)): java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate4/JBossAppServerJtaPlatform (Module "org.jboss.as.jpa.hibernate:4" from local module loader @55308275 (finder: local module finder @63c4fb04 (roots: D:\jboss-eap-6.3\modules,D:\jboss-eap-6.3\modules\system\layers\base))) bellow is full stack trace exception 13:13:19,533 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final-redhat-2 13:13:19,824 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final 13:13:19,931 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.3.0.Alpha1 (AS 7.4.0.Final-redhat-4) starting 13:13:20,916 WARN [org.jboss.modules] (ServerService Thread Pool -- 8) Failed to define class org.jboss.as.jpa.hibernate4.JBossAppServerJtaPlatform in Module "org.jboss.as.jpa.hibernate:4" from local module loader @55308275 (finder: local module finder @63c4fb04 (roots: D:\jboss-eap-6.3\modules,D:\jboss-eap-6.3\modules\system\layers\base)): java.lang.LinkageError: Failed to link org/jboss/as/jpa/hibernate4/JBossAppServerJtaPlatform (Module "org.jboss.as.jpa.hibernate:4" from local module loader @55308275 (finder: local module finder @63c4fb04 (roots: D:\jboss-eap-6.3\modules,D:\jboss-eap-6.3\modules\system\layers\base))) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:428) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.3.0.Final-redhat-2] at org.jboss.modules.Mo…

http://stackoverflow.com/comment/36324392
type: Comment
comment on: http://stackoverflow.com/q/23648558
score: 2
type: QuestionComment
has text: This question is way too broad. What exactly are you trying to accomplish? I mean, you're not writing a full-blown search engine, are you? Inputs, outputs, context, details: help us help you!

http://stackoverflow.com/comment/36536675
score: 1
has text: No, they are not ignored by GC if that element is in an array which is allocated and is in memory as long as the program is running. Also null value of an array element is not ignored by System.out.println and should print null string.
comment on: http://stackoverflow.com/q/23761956
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23700568
score: -4
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36419201
has comment: http://stackoverflow.com/comment/36419703
tagged with: java
accepted answer: http://stackoverflow.com/a/23700614
tagged with: adt
has title: ADT simple app - fatal exception
tagged with: eclipse
linked to: http://stackoverflow.com/q/23353173
downvote count: 4
has comment: http://stackoverflow.com/comment/36419059
upvote count: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/23353173
favorite count: 0
has comment: http://stackoverflow.com/comment/36419525
has body: I have just started out with Android and Java, and i have just made a simple app with a couple of textviews, a button and a edittext. When i run the app i get an error saying the: Unfortunately, FirstApp has stopped. I am familiar with programming, and wonder if i miss some library, or if ADT is misconfigured. I have tried to clean and rebuild, to right click the project in the Package explorer and Android Tools -> Add support library, restarted the emulator, restarted ADT and restarted the computer. Cant figure out what does this. Can any of you see something wrong here? MainActivity.java imports import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.*; import android.os.Build; MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnCalc = (Button)findViewById(R.id.btnCalc); btnCalc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { EditText number = (EditText)findViewById(R.id.num); TextView display = (TextView)findViewById(R.id.display); double num = Double.parseDouble(number.getText().toString()); num = num * 5; display.setText(num + ""); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } fragment_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:la…
has comment: http://stackoverflow.com/comment/36420832
has comment: http://stackoverflow.com/comment/36419145
tagged with: android
has answer: http://stackoverflow.com/a/23700614

http://stackoverflow.com/q/23634492
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36294295
has comment: http://stackoverflow.com/comment/36291934
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36295703
has comment: http://stackoverflow.com/comment/36291870
has comment: http://stackoverflow.com/comment/36292273
has title: Constructing an Object with a Newly-Constructed Array of Newly-Constructed Objects
type: Question
has comment: http://stackoverflow.com/comment/36293240
tagged with: null
tagged with: adt
has answer: http://stackoverflow.com/a/23635175
has comment: http://stackoverflow.com/comment/36292775
has comment: http://stackoverflow.com/comment/36291797
has body: Alright, so I have the following code: Foo f = new Foo ( new Bar[] { new Bar(), new Bar(), new Bar() }, new Bar() }; Constructor for Foo: Bar[] barArr = new Bar[]; Bar barLoc; Foo(Bar[] arr, Bar b) { barArr = arr; barLoc = b; } Constructor for Bar: int x = 3; int y = 7; int z = 0; Bar () { } Which, as I understand it, should be perfectly fine and self-explanatory. However, after the Bar[] constructor is finished, my debugger tells me that Bar[] contains only null objects. Using breakpoints, outputs, etc., I've followed the program through the constructors and confirmed that Bar() works perfectly fine, which is supported by how calls to Bar() elsewhere in the program behave as expected. I've also confirmed the same for Foo(Bar[], Obj) using already-constructed Bar() objects. I would like to avoid doing such if at all possible, as I need to construct >30 of these things, most of which needing unique sets of arguments for each of the constructors - using named variables for each of these would be a readability nightmare. Of possible importance to note, I am constructing these objects directly within a class (don't recall the specific term for this), rather than within a method. This leads me to suspect that I am misunderstanding how this sort of thing works in Java (I'm more used to C++, you see). Could someone shine some light on the issue? I am using ADT and developing for Android 4.3.
answer count: 1
has comment: http://stackoverflow.com/comment/36294511
has comment: http://stackoverflow.com/comment/36291902
tagged with: constructor
has comment: http://stackoverflow.com/comment/36292331

http://stackoverflow.com/a/23730500
has body: If you have for example if (Expression1) while (Expression2) Statement1 then the IfThenStatement immediately contains a WhileStatement. It also contains Statement1, but it does not immediately contain Statement1. Referring to the symbols used in the JLS spec S is the IfThenStatement which contains the WhileStatement T, which in turn contains Statement1 U. Therefore S does not immediately contain U.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36477379
answers question: http://stackoverflow.com/q/23729821
has comment: http://stackoverflow.com/comment/36477983
accepted answer of: http://stackoverflow.com/q/23729821

http://stackoverflow.com/comment/36549853
type: QuestionComment
has text: @NiklasB. what I mean by that is you cant invoke anything on a null reference, but Kayaman was certainly right. Adding another overload which accept some other reference type results in ambiguity.
comment on: http://stackoverflow.com/q/23768552
score: 0
type: Comment

http://stackoverflow.com/comment/36382386
score: 0
type: Comment
has text: Did you override `toString` method in `Spel` class?
type: QuestionComment
comment on: http://stackoverflow.com/q/23680881

http://stackoverflow.com/comment/36505794
type: QuestionComment
comment on: http://stackoverflow.com/q/23745861
score: 2
has text: They make perfect sense to me. Imagine `Arrays.asList(T...)` being a more reasonably named `List.create(T...)`, for instance. But this question is OT for SO, since it's an opinion-based question.
type: Comment

http://stackoverflow.com/comment/36345900
type: Comment
has text: i repeated the line for every column and it worked !! thanks @Sergiy Medvynskyy
comment on: http://stackoverflow.com/a/23659992
type: AnswerComment
score: 0

http://stackoverflow.com/q/23771808
tagged with: io
type: UnansweredQuestion
score: 0
tagged with: file
tagged with: java
type: Question
has title: How to read a file and perform a find-and-replace?
has body: How would I go about going through this text file of the complete book of Huckleberry Finn and replace every occurrence of the word "the" with "a"? import java.io.File; import java.io.IOException; import java.util.Scanner; public class Filey { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File huck = new File("HuckFinn.txt"); } }
answer count: 1
has answer: http://stackoverflow.com/a/23785562

http://stackoverflow.com/q/23713281
has body: I am getting the following error when trying to run JBoss server on my computer: Error occurred during initialization of VM Incompatible minimum and maximum heap sizes specified Picked up _JAVA_OPTIONS: -Xmx512M I am using Windows 7. When I looked it up I saw that the problem is with the Java parameters setting. I have tried to set it to -Xms512m -Xmx1024m but it did not work (Not sure if I did it correctly).
has comment: http://stackoverflow.com/comment/36444148
type: UnansweredQuestion
upvote count: 1
has title: VM Error when starting local JBoss server
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36443916
has comment: http://stackoverflow.com/comment/36443313
tagged with: jboss
has answer: http://stackoverflow.com/a/23834382
type: Question
has comment: http://stackoverflow.com/comment/36443329
downvote count: 0
has comment: http://stackoverflow.com/comment/36443512
answer count: 1
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/23689400
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
tagged with: jpanel
answer count: 2
downvote count: 0
has title: What Java JPanel Layout allows for center, side, and corner elements?
has answer: http://stackoverflow.com/a/23689621
favorite count: 0
has answer: http://stackoverflow.com/a/23689614
type: UnansweredQuestion
has body: I have this code for a GUI: package rubiksCube; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SimpleGui extends JFrame{ int[] px2; int[] py2; int[] pz2; Graphics g2 = null; int sN; public SimpleGui(){ JButton solve = new JButton(); JPanel p = new JPanel(); solve.setText("Solve"); solve.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Control c = new Control(); c.solve(); }}); solve.addKeyListener(new KeyListener(){ public void keyPressed(KeyEvent k) { switch (k.getKeyCode()){ case KeyEvent.VK_DOWN: break; case KeyEvent.VK_UP: break; case KeyEvent.VK_LEFT: break; case KeyEvent.VK_RIGHT: break; case KeyEvent.VK_0: break; case KeyEvent.VK_1: break; case KeyEvent.VK_2: break; case KeyEvent.VK_3: break; case KeyEvent.VK_4: break; case KeyEvent.VK_5: break; case KeyEvent.VK_6: break; case KeyEvent.VK_7: break; case KeyEvent.VK_8: break; case KeyEvent.VK_9: break; case KeyEvent.VK_MINUS: break; case KeyEvent.VK_EQUALS: break; } } public void keyReleased(KeyEvent k) { } public void keyTyped(KeyEvent k) { } }); JButton random = new JButton(); random.setText("Randomize"); random.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Control c = new Control(); c.random(); }}); p.setVisible(true); solve.setVisible(true); p.add(solve); p.add(random); p.add(new Display()); add(p); setContentPane(p); setVisible(true); }} Now I want the component (new Display()) to show up in the middle of the screen, while the JButtons solve and random show up in the top right corner. Incase you are wondering, new Display() is a class that extends JPanel and displays graphics.

http://stackoverflow.com/comment/36448328
score: 0
type: Comment
type: QuestionComment
has text: @11684 Thanks for trying anyway :) Are there any other places I could post this to try and get help?
comment on: http://stackoverflow.com/q/23715057

http://stackoverflow.com/comment/36489935
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23737457
type: AnswerComment
has text: @MarounMaroun oh, I got you! :-)

http://stackoverflow.com/q/23625937
has comment: http://stackoverflow.com/comment/36275334
answer count: 2
has answer: http://stackoverflow.com/a/23625999
favorite count: 0
has body: I have a helper class that consists of various static methods, one of those methods requires Context to access some information. Could passing Context to a static helper method as an argument potentially cause a memory leak? public class ConnectionHelper { public static boolean isConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); return cm != null; } } How does the static method behave, does it dispose of the context reference after it has executed or will it hang around in memory afterward?
tagged with: android
accepted answer: http://stackoverflow.com/a/23625999
has title: Could passing Context to a static helper method as an argument potentially cause a memory leak?
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/23626056
has answer: http://stackoverflow.com/a/23626056
upvote count: 4

http://stackoverflow.com/comment/36460613
score: 0
comment on: http://stackoverflow.com/q/23722124
type: Comment
type: QuestionComment
has text: @Zavior - wait, you mean I might have accidentally asked an original question?

http://stackoverflow.com/q/23690425
has body: I need to toggle on/off RGB channels of an image, but I am stuck and my code is buggy. Can you help me figure out how to do this the right way? This is my code: The function channels is called when 1 of 3 checkboxes has changed its state and provides the arguments which are true == selected public void channels(boolean red, boolean green, boolean blue) { if (this.img != null) {// checks if the image is set char r = 0xFF, g = 0xFF, b = 0xFF; if (red == false) { r = 0x00; } if (green == false) { g = 0x00; } if (blue == false) { b = 0x00; } BufferedImage tmp = new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB); for (int i = 0; i &lt; img.getWidth(); i++) { for (int j = 0; j &lt; img.getHeight(); j++) { int rgb = img.getRGB(i, j); int red = (rgb &gt;&gt; 16) &amp; r; int green = (rgb &gt;&gt; 8) &amp; g; int blue = (rgb &gt;&gt; 0) &amp; b; int gbr = (red &lt;&lt; 16) | (green &lt;&lt; 8) | blue;// EDITED tmp.setRGB(i, j, gbr); } } img = tmp; repaint(); } else { //show error } } Thank you for your help!
has comment: http://stackoverflow.com/comment/36401388
has comment: http://stackoverflow.com/comment/36401206
has comment: http://stackoverflow.com/comment/36401273
has comment: http://stackoverflow.com/comment/36401192
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23690587
tagged with: image-processing
possible better answer: http://stackoverflow.com/a/23698191
linked to: http://stackoverflow.com/q/21763192
has comment: http://stackoverflow.com/comment/36402160
has answer: http://stackoverflow.com/a/23698191
type: Question
has comment: http://stackoverflow.com/comment/36402186
accepted answer: http://stackoverflow.com/a/23690587
has comment: http://stackoverflow.com/comment/36401419
has comment: http://stackoverflow.com/comment/36402014
has comment: http://stackoverflow.com/comment/36402036
has comment: http://stackoverflow.com/comment/36401430
has comment: http://stackoverflow.com/comment/36401250
tagged with: rgb
tagged with: image
has title: Toggle between RGB channels
has comment: http://stackoverflow.com/comment/36401449
score: 0
has comment: http://stackoverflow.com/comment/36401162
answer count: 2
linked to: http://stackoverflow.com/q/3527811

http://stackoverflow.com/comment/36529211
score: 0
comment on: http://stackoverflow.com/q/23737169
type: Comment
type: QuestionComment
has text: Hi, thanks for your answers. I've added some information to my opening post, if you don't mind reading it. Thanks!

http://stackoverflow.com/q/23750663
downvote count: 2
has comment: http://stackoverflow.com/comment/36515290
tagged with: php
has comment: http://stackoverflow.com/comment/36515029
type: Question
has comment: http://stackoverflow.com/comment/36515803
has comment: http://stackoverflow.com/comment/36515016
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
has comment: http://stackoverflow.com/comment/36515201
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/36515022
linked to: http://stackoverflow.com/q/20560562
favorite count: 0
has body: Please help me , I am trying to connect my android app to mysql database in localhost through connection in php and json array, but i cant figure out what is the problem , i cant view the data from database. Here is my files. Connection.php &lt;?php $db_con = mysqli_connect('localhost', 'root', '', 'android') or die ("connection error");; $query = "SELECT * FROM product"; $results = mysqli_query($db_con, $query) or die ("query error");; while($row = mysqli_fetch_assoc($results)){ $output[]=$row; } echo json_encode($output); ?&gt; and this the android java "MainActivity.java" : public class MainActivity extends ActionBarActivity { TextView viewItem; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); viewItem = (TextView) findViewById(R.id.itemView); // Button btnViewItems = (Button) findViewById(R.id.btnViewItems); getData(); } public void getData() { String results = ""; InputStream isr = null; // Http post try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://10.0.2.2:8080/android/Connection.php"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); } catch (Exception e) { Log.e("log-tag", "Error in http connection" + e.toString()); viewItem.setText("Cannot connect to database"); } // Converting 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(); results = sb.toString(); } catch (Exception e) { Log.e("log-tag", "Error Converting string" + e.toString()); viewItem.setText("Cannot convert string"); } // prase jason data try { String s = ""; JSONArray jArray = new JSONArray(results); for (int i = 0; i &lt; jArray.length(); i++) { JSONObject jOb = jArray.getJSONObject(i); s = s + jOb.getString("…
has comment: http://stackoverflow.com/comment/36515055
tagged with: android
has title: how to connect android to mysql?
has answer: http://stackoverflow.com/a/23750795
type: UnansweredQuestion

http://stackoverflow.com/a/23669022
downvote count: 0
answers question: http://stackoverflow.com/q/23669004
has body: Check is Empty before parsing it into integer like if(!jTextField1.getText().isEmpty()){ Integer.parseInt(jTextField1.getText()); }
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/q/23754768
score: 1
has comment: http://stackoverflow.com/comment/36523736
favorite count: 0
has body: I have been searching for a while, but I could not found any usefull informations about my question. is it possible to use Java annotations without initializing annotation implementation with CDI or EJB?
type: UnansweredQuestion
tagged with: annotations
upvote count: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36523660
tagged with: ejb
downvote count: 0
tagged with: cdi
has comment: http://stackoverflow.com/comment/36531370
has title: Using java annotations without CDI
has answer: http://stackoverflow.com/a/23755326
answer count: 1

http://stackoverflow.com/a/23617162
has body: whatever the value type of memberNumbers is, add a function called toString() (if its a custom object) public String toString() { return this.name; } where this.name is a property in whatever object your putting inside memberNumbers
answers question: http://stackoverflow.com/q/23617058
score: 0
type: Answer

nested
tags question: http://stackoverflow.com/q/23658006
tags question: http://stackoverflow.com/q/23689881
tag name: nested
type: Tag
tags question: http://stackoverflow.com/q/23758764
tags question: http://stackoverflow.com/q/23688955
tags question: http://stackoverflow.com/q/23718183

http://stackoverflow.com/a/23718444
has comment: http://stackoverflow.com/comment/36454531
has comment: http://stackoverflow.com/comment/36475120
has comment: http://stackoverflow.com/comment/36478936
has body: It looks like you replaced the body with some fake content in the debug output. It might help to see the actual content to make sure there's not an error in the formatting of the protocol message. Have you gotten a thread dump to see exactly where the program is hung? Is it hung trying to read data from the IMAP connection? What method is your program calling when it gets hung? As mentioned in the comments below, you need to be sure your program isn't throwing a runtime exception that you're not catching, making it appear that your program is hung when in fact it has been aborted.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23710669
answers question: http://stackoverflow.com/q/23710669

http://stackoverflow.com/a/23718157
type: Answer
answers question: http://stackoverflow.com/q/23718078
has body: The screen constantly needs to refresh. To show graphics, it paints an image every time the screen refreshes by calling the update method. The update method clears the screen by painting it white. Then, the update method calls the paint method (or repaint depending on context). Because you only paint graphics once, your graphics are painted over by a blank screen and not refreshed. You need to paint your graphics every time that the screen refreshes, or they will be erased. Always paint, but only take the screenshot once. Here's an example of the paint method: public void paint (Graphics g) { g.drawImage (img, 0, 0, null); Dimension appletSize = this.getSize (); lll = getLocationOnScreen (); if (counter == 0) //try taking the screenshot when counter is 0 { try { next2 = new Robot ().createScreenCapture (new Rectangle (lll.x, lll.y, 500, 500)); } catch (java.awt.AWTException e) {} } if (next2 != null) //if you took the screenshot and saved it to next2, draw it g.drawImage (next2, 0, 0, null); System.out.println (lll); counter++; }
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23718078

http://stackoverflow.com/comment/36478778
has text: @EvanKnowles the message that's being used (this), is of type T because the subclasses define T as their own type when extending Message<T extends Message>
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23731270

http://stackoverflow.com/comment/36559292
comment on: http://stackoverflow.com/a/23773600
type: Comment
type: AnswerComment
has text: Thanks. I'll try this out and accept this if it works. Will also ask on serverfault.
score: 0

http://stackoverflow.com/comment/36383768
score: 0
type: QuestionComment
type: Comment
has text: change DD to D i.e. EEE MMM d HH:mm:ss z yyyy
comment on: http://stackoverflow.com/q/23681537

http://stackoverflow.com/a/23616142
score: 0
type: Answer
has body: Initializing an array (Item[] hardware = new Item[6];) just creates an array of the specified size with nulls. If you with to set properties on these items, you must first initialize them: for(int i = 0; i &lt;= 5; i++) { hardware[i] = new Item(); // Missing from your snippet hardware[i].setItemID(itemID[i]); hardware[i].setItemName(itemName[i]); hardware[i].setInStore(inStore[i]); hardware[i].setPrice(price[i]); }
answers question: http://stackoverflow.com/q/23616098

http://stackoverflow.com/comment/36394266
has text: I did use BufferedInputStream and BufferedOutputStream before but it was worse than what I use now. BTW, my program also needs to read the data before forwarding them.
type: Comment
comment on: http://stackoverflow.com/a/23686897
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36493765
comment on: http://stackoverflow.com/q/23739468
score: 0
type: Comment
has text: Check if you get proper value of `childDetails.person.id`.
type: QuestionComment

lwjgl
tags question: http://stackoverflow.com/q/23667008
tag name: lwjgl
tags question: http://stackoverflow.com/q/23706997
tags question: http://stackoverflow.com/q/23707342
tags question: http://stackoverflow.com/q/23741782
tags question: http://stackoverflow.com/q/23697832
tags question: http://stackoverflow.com/q/23715942
tags question: http://stackoverflow.com/q/23727493
type: Tag
tags question: http://stackoverflow.com/q/23648197
tags question: http://stackoverflow.com/q/23641437
tags question: http://stackoverflow.com/q/23710829
tags question: http://stackoverflow.com/q/23635749
tags question: http://stackoverflow.com/q/23723993

http://stackoverflow.com/q/23751172
downvote count: 0
accepted answer: http://stackoverflow.com/a/23751350
has answer: http://stackoverflow.com/a/23751402
tagged with: timestamp
type: Question
score: 7
has answer: http://stackoverflow.com/a/23751350
tagged with: java
has comment: http://stackoverflow.com/comment/36516181
has title: convert string to date and time as am/pm format
has answer: http://stackoverflow.com/a/23751462
upvote count: 7
has answer: http://stackoverflow.com/a/23751436
has comment: http://stackoverflow.com/comment/36515984
possible better answer: http://stackoverflow.com/a/23751462
favorite count: 0
has body: string : 2014-04-25 17:03:13 using SimpleDateFormat is enough to format? or otherwise i will shift to any new API? Date date = new Date(string); DateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd"); out.println( dateFormat.format (date)); My expected result is (India zone): Date : 25-04-2014 Time : 05:03 PM
linked to: http://stackoverflow.com/q/4216745
tagged with: datetime
answer count: 4
duplicate of: http://stackoverflow.com/q/4216745
type: AnsweredQuestion

http://stackoverflow.com/comment/84173767
comment on: http://stackoverflow.com/a/23766819
type: AnswerComment
has text: Instead of `Hex.encodeHexString` you can use `DatatypeConverter.printHexBinary(digest)` from `import javax.xml.bind.DatatypeConverter;`.
type: Comment
score: 1

http://stackoverflow.com/a/23618954
has comment: http://stackoverflow.com/comment/36274566
has comment: http://stackoverflow.com/comment/36274136
type: Answer
has comment: http://stackoverflow.com/comment/36275080
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23617940
has comment: http://stackoverflow.com/comment/36275681
answers question: http://stackoverflow.com/q/23617940
has comment: http://stackoverflow.com/comment/58977317
has body: There are a lot of things going wrong in your Java code: leftVal.getType().toString() == "DOUBLE" Never do string equality checks using ==! Read this: How do I compare strings in Java?, and truly understand it. But you shouldn't compare the strings to begin with. Compare the integer types instead: leftVal.getType() == ExpressionParser.DOUBLE And this makes little sense to me: String i = "100"; if (i.contains(".")){ ... The fact that you get a no viable alternative message is because your input "10" is being tokenized as an ID. This is because the ID token matches only digits, just like the DIGIT rule: ID: [a-zA-Z0-9]+; ... DIGIT: [0-9]+ ; and since ID is defined before DIGIT, it get precedence. Either include ID as an numExpr alternative, or let the ID token start with a letter: ID: [a-zA-Z] [a-zA-Z0-9]*;
has comment: http://stackoverflow.com/comment/36262140
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36272410

http://stackoverflow.com/comment/36340976
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23659430
has text: It _is_ n minus the number of duplicates. `--n`
score: 0

http://stackoverflow.com/comment/36388786
comment on: http://stackoverflow.com/q/23683777
score: 0
type: Comment
type: QuestionComment
has text: @ZouZou he is diving double / integer isnt ? (double + double ) / 2

http://stackoverflow.com/comment/36448141
score: 0
type: Comment
type: QuestionComment
has text: You can't add a `String` in `Set<Integer` then what is the meaning of replacing it in the same `Set`? Correct me if I'm wrong.
comment on: http://stackoverflow.com/q/23715710

http://stackoverflow.com/comment/36529993
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23758657
type: AnswerComment
has text: Nice, I was forget :)

http://stackoverflow.com/q/23745356
tagged with: gson
has body: Good [insert day phase], is there a way to export Gson more human readable? I currently get this: [{"id":"test","region":{"lower":{"x":163,"y":63,"z":233},"higher":{"x":167,"y":67,"z":237}}}] But I would like to achieve results like this: [{ "id":"test", "region": { "lower": { "x":163, "y":63, "z":233 }, "higher": { "x":167, "y":67, "z":237 } } }] Thank you for any suggestions.
tagged with: export
answer count: 2
has answer: http://stackoverflow.com/a/23745388
downvote count: 0
favorite count: 0
tagged with: serialization
possible better answer: http://stackoverflow.com/a/23745637
has answer: http://stackoverflow.com/a/23745637
accepted answer: http://stackoverflow.com/a/23745388
has title: GSON - Human readability
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/11020894
type: Question
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/11020894
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23624015
tagged with: java
has comment: http://stackoverflow.com/comment/36272359
has title: How to resolve hostname with ipv6 address?
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36271900
has comment: http://stackoverflow.com/comment/36272323
has body: It is easy to resolve hostname with ipv4 address, but I am not able to resolve hostname with ipv6 address even using Inet6Address class. InetAddress addr = InetAddress.getByName("192.168.190.62"); String host = addr.getHostName(); System.out.println(host); Above code works for IPv4, but for IPv6 even with Inet6Address it is not working. Please help, how is it possible ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36272180
answer count: 0

http://stackoverflow.com/a/23709447
downvote count: 0
score: 1
has body: This depends on how well optimized is your own code (memory consumption, simultaneous connections, comet or simple http), there's no fixed rule here. What people do is : they design their system, then they se what consumes resources and optimize and finally they simulate simultaneous connections while following the health of the server. This is what I saw until now for editor solutions You can still get an idea of that by allocating the memory you think you will need in your servlet processing and do the test of multiple simultaneous connections on your target machine (or on any machine and specify how could behave a machine that is twice more performant for example).
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23709175

http://stackoverflow.com/q/23699936
has title: Name-ID-Subject Recorder with Alphabetical and Ascending ID Displayer and Subject Filter using Multi-Dimensional Array
tagged with: arrays
tagged with: user-interface
answer count: 1
type: UnansweredQuestion
has body: it has been 7 days since i have been started coding this.. i really can't understand what is my codes problem. . . why does my switch case never work?? the menu just returns without performing the specific function of the case.. i really need to know what the problem is. . . . . . package dakilangtaoako; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; public class DakilangTaoAko { public static void main(String[] args){ BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) ); String mydata[][] = new String[5][3] ; String inttoword [] = new String [5]; int wordtoint[] = new int [5]; int mychoice = 0, temp; String toreturn = ""; for (int outside = 0; outside &lt; 5; outside++){ System.out.println("Entry no." + (outside + 1)); for (int inside = 0; inside &lt; 3; inside++){ if(inside == 0){ try { System.out.print("Name: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } else if(inside == 1){ try { System.out.print("ID: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } else if(inside ==2){ try { System.out.print("Subject: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } } } for(int i=0;i&lt;5;i++){ wordtoint[i]=Integer.parseInt(mydata[i][1]); } while(mychoice != 5){ System.out.println("-------- DISPLAY OPTIONS --------"); System.out.println("\t [1] Display Entries Alphabetically "); System.out.println("\t [2] Display Entries by Ascending ID number "); System.out.println("\t [3] Display Students Enrolled in Prog2 "); System.out.println("\t [4] Display Students Enrolled in CSO "); System.out.println("\t [5] Exit …
tagged with: numbers
score: 0
tagged with: java
tagged with: alphabetical
type: Question
has answer: http://stackoverflow.com/a/23700343

flowpane
tags question: http://stackoverflow.com/q/23648272
tags question: http://stackoverflow.com/q/23655804
type: Tag
tag name: flowpane

http://stackoverflow.com/a/23707645
type: Answer
answers question: http://stackoverflow.com/q/23704590
score: 0
has body: You have to make sure that the version for Nexus referenced in the plugin source and the version of Nexus you are running are the same for starters. Try that first. Update 2014-09-15: The plugin is actively being worked on by Sonatype. You should give it a spin. Check out the nexus-2.10.x branch. https://github.com/sonatype/nexus-npm-repository-plugin/tree/nexus-2.10.x and ensure to use a Nexus 2.10 build.
accepted answer of: http://stackoverflow.com/q/23704590
type: AcceptedAnswer

http://stackoverflow.com/comment/36323111
score: 0
type: Comment
has text: i want to use the enter key as i want to restrict the number of key used !! by pressing enter move next cell and preform any action like click a button !!
type: QuestionComment
comment on: http://stackoverflow.com/q/23648646

http://stackoverflow.com/comment/36514963
type: QuestionComment
has text: @JeffreyHantin: I'm not claiming it's good code, just that it isn't clear what question the OP was asking.
comment on: http://stackoverflow.com/q/23749928
score: 0
type: Comment

http://stackoverflow.com/comment/36473782
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). *"i just keep adding random bits, hoping something will work"* In over a decade of development, I haven't seen 'programming by magic' work even once.
score: 1
comment on: http://stackoverflow.com/q/23728276

http://stackoverflow.com/a/23618475
has comment: http://stackoverflow.com/comment/36274839
has comment: http://stackoverflow.com/comment/36274826
has comment: http://stackoverflow.com/comment/36273412
has comment: http://stackoverflow.com/comment/36273805
accepted answer of: http://stackoverflow.com/q/23618361
type: AcceptedAnswer
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/23618361
has comment: http://stackoverflow.com/comment/36273962
upvote count: 8
type: Answer
has body: It looks like you have a syntax error in your code. Your are trying to define the lambda expression within an anonymous inner class. However, you should use the lambda expression instead of the anonymous inner class. I guess the following works: SocketServer server = SocketFactory.create().addListener(8888, "localhost") .setHandler(e -&gt; { e.send("Hello World"); }).create(); If the method setHandler is overloaded, it might be necessary to provide more information, e.g. by adding a cast: SocketServer server = SocketFactory.create().addListener(8888, "localhost") .setHandler((SocketHandler) e -&gt; { e.send("Hello World"); }).create();
has comment: http://stackoverflow.com/comment/36266999
has comment: http://stackoverflow.com/comment/36273316
has comment: http://stackoverflow.com/comment/36274302

http://stackoverflow.com/a/23639774
has body: In an Activity AlertDialog.Builder mAlertDialogBuilder = new AlertDialog.Builder(this); In a Fragment AlertDialog.Builder mAlertDialogBuilder = new AlertDialog.Builder(getActivity());
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23639654

http://stackoverflow.com/a/23689335
has body: Colors can be represented in ways other than a mix of red, green and blue. One model that will work better for this is a method called HSV (there is a similar model called HSL) meaning Hue, Saturation and Value. The Hue is the frequency of the color (rotation position on a color wheel) while saturation and value control how vibrant and how dark/light the color appears. Decide on a range for S and V then pick a random Hue and you should be good.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36399882
accepted answer of: http://stackoverflow.com/q/23689264
type: Answer
answers question: http://stackoverflow.com/q/23689264
upvote count: 2
has comment: http://stackoverflow.com/comment/36399052
score: 2
has comment: http://stackoverflow.com/comment/36399467

http://stackoverflow.com/comment/36592602
type: AnswerComment
has text: @user2573318 You cannot have a dynamic value for var literal in c set.
type: Comment
comment on: http://stackoverflow.com/a/23788786
score: 1

http://stackoverflow.com/comment/36299970
type: AnswerComment
has text: I will add that the result above returns the caption bar along with the height of the top and bottom border. The caption bar height would then be: cyCaptionBar = outer.height - inner.height - shell.getBorderWidth() * 2;
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23637999

http://stackoverflow.com/q/23651586
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23668054
tagged with: hbase
type: UnansweredQuestion
tagged with: nosql
linked to: http://stackoverflow.com/q/11061854
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I want to copy data from one HBase table to another using Java APIs, but not able to find one. Is there any Java API to do the same? Thanks.
has title: Copy table in HBase from Java

http://stackoverflow.com/comment/36443245
score: 1
comment on: http://stackoverflow.com/q/23713262
has text: I don't understand your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36546756
type: Comment
has text: If `list` is defined outside of your `switch` as `List<?> list`, I don't see any reason why it wouldn't work.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23767116

http://stackoverflow.com/q/23725682
tagged with: art-runtime
tagged with: dalvik
has comment: http://stackoverflow.com/comment/36467645
answer count: 0
type: UnansweredQuestion
has title: Understading ART / Dalvik compilation correctly
tagged with: android
has body: I want to ask you if I understand the compiling process correctly. After exporting Android app into .apk file we receive byte code (.apk). When we want to launch our app on Android device: Dalvik: byte code (.apk) -> Dalvik VM JIT compilation -> compiled native code -> execution of the programme (whole programme is allocated in the memory) This Dalvik JIT compilation is executed each time we lauch the app. ART: Installation: byte code (.apk) -> ART VM AOT compilation -> compiled native code App launch: native code -> execution (only some part of the programme allocates memory) AOT compilation is proccessed only once after app installation.
tagged with: java
type: Question
upvote count: 4
downvote count: 0
tagged with: compilation
score: 4
favorite count: 0

http://stackoverflow.com/comment/36523003
score: 0
type: Comment
type: QuestionComment
has text: I still can't understand what you are trying to do. Perhaps you should post an example of two input images and what you expect as an output.
comment on: http://stackoverflow.com/q/23743098

http://stackoverflow.com/comment/66951681
has text: @Zakhar You are right if we use `@PreMatching` the filter/interceptor will apply to all the requests regardless of the annotations which makes `@NameBinding` useless. For more info please see https://jersey.java.net/documentation/latest/filters-and-interceptors.html
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23657244

http://stackoverflow.com/q/23640934
has comment: http://stackoverflow.com/comment/36305068
has comment: http://stackoverflow.com/comment/36305363
upvote count: 0
has body: Here's my problem. I have a txt file called "sites.txt" . In these i type random internet sites. My Goal is to save the first image of each site. I tried to filter the Server response by the img tag and it actually works for some sites, but for some not. The sites where it works the img src starts with http:// ... the sites it doesnt work start with anything else. I also tried to add the http:// to the img src images which didnt have it, but i still get the same error: Exception in thread "main" java.net.MalformedURLException: no protocol: at java.net.URL.&lt;init&gt;(Unknown Source) My current code is: public static void main(String[] args) throws IOException{ try { File file = new File ("sites.txt"); Scanner scanner = new Scanner (file); String url; int counter = 0; while(scanner.hasNext()) { url=scanner.nextLine(); URL page = new URL(url); URLConnection yc = page.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); String inputLine = in.readLine(); while (!inputLine.toLowerCase().contains("img"))inputLine = in.readLine(); in.close(); String[] parts = inputLine.split(" "); int i=0; while(!parts[i].contains("src"))i++; String destinationFile = "image"+(counter++)+".jpg"; saveImage(parts[i].substring(5,parts[i].length()-1), destinationFile); String tmp=scanner.nextLine(); System.out.println(url); } scanner.close(); } catch (FileNotFoundException e) { System.out.println ("File not found!"); System.exit (0); } } public static void saveImage(String imageUrl, String destinationFile) throws IOException { // TODO Auto-generated method stub URL url = new URL(imageUrl); String fileName = url.getFile(); String destName = fileName.substring(fileName.lastIndexOf("/")); System.out.println(destName); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(destinationFile); byte[] b = new byte[2048]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close(); } I also got a …
favorite count: 0
has answer: http://stackoverflow.com/a/23640987
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23641757
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/1207190
has comment: http://stackoverflow.com/comment/36305339
type: Question
has title: Saving the first Image from URL
has answer: http://stackoverflow.com/a/23641041
tagged with: java
score: -1

http://stackoverflow.com/q/23712148
accepted answer: http://stackoverflow.com/a/23712349
type: Question
tagged with: spring
tagged with: jsf
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/23712349
linked to: http://stackoverflow.com/q/17278376
linked to: http://stackoverflow.com/q/23638664
has body: I am using ehcache in my project so when server start data of few table will be loaded into the cache ..in my application i am using Spring,Hibernate,JSF I m using this configurationin applicationCOntext.xml file &lt;bean id="cacheManager" class="com.ccc.service.cache.CacheManager" init-method="init"&gt; &lt;property name="delay" value="${timer.delay}" /&gt; &lt;/bean&gt; &lt;bean id="companyCache" class="com.ccc.service.cache.clients.ValidCacheClient"/&gt; &lt;context:component-scan base-package="com.ccc.spring" /&gt; &lt;context:annotation-config /&gt; &lt;context:spring-configured /&gt; In Jsf Managed Bean i am creating Object of Service class like this @ManagedProperty(value = "#{GlobalDataService}") static GlobalDataService globalDataService; But in ValidCacheClient.java how to create object of Service class? ValidCacheClient.java is not a manged class so how to create the Object of Service class?
linked to: http://stackoverflow.com/q/20148259
type: AnsweredQuestion
has title: How to Create Service class Object in Spring

http://stackoverflow.com/comment/36494399
type: AnswerComment
type: Comment
score: 0
has text: I do appreciate your answer yet I assume that it will be past the goal they want us to achieve with this excerise. Thanks for your help anyway.
comment on: http://stackoverflow.com/a/23739763

http://stackoverflow.com/a/23735208
has comment: http://stackoverflow.com/comment/36485528
has comment: http://stackoverflow.com/comment/36485786
answers question: http://stackoverflow.com/q/23734873
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: step 1: load default.jsp i guess you have a form to submit the search query like //action is your url pattern and method is your choice get or post // your text box step 2: Now perform your business logic for search in your servlet then put your result data in request req.setAttribute("key",value); //value is object dispatch your request with data to `SearchResults.jsp` req.getRequestDispatcher("SearchResults.jsp").forward(req,resp); step 3: display data in SearchResults.jsp using req.getAttribute("key") Tip Best way is to configure jsp file in web.xml myjsp jsp/SearchResults.jsp myjsp /jsp_url Now you can use req.getRequestDispatcher("jsp_url").forward(req,resp);
type: Answer
has comment: http://stackoverflow.com/comment/36489434
has comment: http://stackoverflow.com/comment/36486943
has comment: http://stackoverflow.com/comment/36485495
accepted answer of: http://stackoverflow.com/q/23734873

http://stackoverflow.com/q/23692958
accepted answer: http://stackoverflow.com/a/23695909
tagged with: java
tagged with: javafx
upvote count: 1
answer count: 1
has body: I have a table view and table columns which I replaced sorting with. Sorting Event: nameColumn.sortTypeProperty().addListener( new ChangeListener&lt;SortType&gt;() { @Override public void changed( ObservableValue&lt;? extends SortType&gt; observable, SortType oldValue, SortType newValue) { FXListSorter.sortPersonByName(fetchResults, newValue); showFetchResultsByPage(); } }); List Sorter: public static void sortPersonByName(ObservableList&lt;PersonBean&gt; list, SortType sortType) { FXCollections.sort(list, new Comparator&lt;PersonBean&gt;() { @Override public int compare(PersonBean p1, PersonBean p2) { if (sortType.equals(SortType.ASCENDING)) { return p1.toString().compareToIgnoreCase(p2.toString()); } else { return p2.toString().compareToIgnoreCase(p1.toString()); } } }); } Show fetched results: private void showFetchResultsByPage() { int start = currentPageIndex * pageSize; if (start &gt; fetchResults.size()) { return; } int maxValForPage = currentPageIndex * pageSize + pageSize; int end = (maxValForPage &lt;= fetchResults.size()) ? maxValForPage : fetchResults.size(); Platform.runLater(new Runnable() { @Override public void run() { personsTableView.getItems().setAll( fetchResults.subList(start, end)); } }); } Still, when I sort the table column, the table view's default sorting is executed first, then the sorting i created. Is there a way to disable the table view's default sorting? Thanks
tagged with: sorting
tagged with: javafx-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23695909
downvote count: 0
has title: Replace Column Sorting in JavaFX
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/23644376
upvote count: 2
score: 2
downvote count: 0
has body: As previously mentioned "MM" is months. But as you are already instantiating a calendar object, then why not simply do System.out.println(cal1.get(Calendar.MINUTE));
type: Answer
answers question: http://stackoverflow.com/q/23644332

http://stackoverflow.com/comment/36257936
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23616720
has text: I think `setPrefWidth` isn't the right method. I will test and answer
score: 0

http://stackoverflow.com/q/23679608
tagged with: hashmap
tagged with: jpa
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36392719
has body: I want to have the following field in my Presentation class (JPA entity): private HashMap&lt;User, Boolean&gt; users = new HashMap(); but when I run our databasetest (fill db with testdata), I get the following errormessage: [class domein.Presentation] uses a non-entity [class java.lang.Boolean] as target entity in the relationship attribute [field users]. I have tried using the annotations @ElementCollection and @BasicMap but they both don't work. My current solution is to make a new Entity class MyBoolean, but that is ugly code. How can I do this?
has title: class uses a non-entity [class java.lang.Boolean] in HashMap?
accepted answer: http://stackoverflow.com/a/23692749
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23692749
type: Question

http://stackoverflow.com/comment/36613157
has text: This won't help, because the extern dependency is loading, just the one which actually compiles doesn't seem to be able to add itself to the classpath. e.g. /home/cubepanel/test-network/jars/craftcubbit.jar:/home/cubepanel/test-network/servers/ProHub/plugins/MultiCubeCore.jar craftcubbit is the extern one, it's working. MultiCubeCore is the one which executes my dynamically loaded code, and this one is not working. Is this because I can't add the jar which is compiling to the classpath?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23708916

intellij-13
tags question: http://stackoverflow.com/q/23640513
tag name: intellij-13
tags question: http://stackoverflow.com/q/23739029
tags question: http://stackoverflow.com/q/23688702
type: Tag

http://stackoverflow.com/q/23665098
upvote count: 7
has comment: http://stackoverflow.com/comment/36352475
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36352393
accepted answer: http://stackoverflow.com/a/23665370
downvote count: 0
has comment: http://stackoverflow.com/comment/36352590
has comment: http://stackoverflow.com/comment/36352388
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36352801
has comment: http://stackoverflow.com/comment/36352573
favorite count: 0
has title: Remove an Element from a List inside a loop
linked to: http://stackoverflow.com/q/8189466
has comment: http://stackoverflow.com/comment/36352534
has comment: http://stackoverflow.com/comment/36352345
has comment: http://stackoverflow.com/comment/36352483
has answer: http://stackoverflow.com/a/23665370
has comment: http://stackoverflow.com/comment/36353110
possible better answer: http://stackoverflow.com/a/23665546
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/8189466
has answer: http://stackoverflow.com/a/23665546
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/36352869
has body: I'm trying to delete an element from an ArrayList inside a loop. This is OK. ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(Arrays.asList(1, 2, 3)); for(Integer i: list){ if(i == 2) list.remove(i); } But this is not, and throw concurrentMOdificationException. ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(Arrays.asList(1, 2, 3)); for(Integer i: list){ list.remove(i); } I don't understand why. I just added another element, it is not OK either (throw concurrentMOdificationException). ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(Arrays.asList(1, 2, 3, 4)); System.out.println(list); for (Integer i : list) { if (i == 2) list.remove(i); }

http://stackoverflow.com/comment/36291060
type: Comment
type: QuestionComment
has text: sry... will delete my comment
score: 0
comment on: http://stackoverflow.com/q/23633992

http://stackoverflow.com/q/23700287
has comment: http://stackoverflow.com/comment/36420231
accepted answer: http://stackoverflow.com/a/23700372
score: 0
possible better answer: http://stackoverflow.com/a/23700368
has answer: http://stackoverflow.com/a/23700371
has comment: http://stackoverflow.com/comment/36418561
has answer: http://stackoverflow.com/a/23700372
answer count: 5
type: AnsweredQuestion
has title: Having trouble with || and &&
has answer: http://stackoverflow.com/a/23700368
has answer: http://stackoverflow.com/a/23700375
has answer: http://stackoverflow.com/a/23700524
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36418474
has body: I am new to programming and wanted to make a dice rolling programm in Java for execise. The code is the following: import java.math.*; public class Dices { public static int dice1=0; public static int dice2=0; public static int x; public static void main(String args[]){ do { x++; dice1=(int) (Math.random()*6+1); dice2=(int) (Math.random()*6+1); System.out.println(dice1+", "+dice2); } while(dice1 !=1 || dice2 !=1); System.out.println("Finalthrow: "+dice1+", "+dice2); System.out.println("Snake-Eyes after "+x+" tries."); } } This way it works fine, but in my opinion there is something wrong with the code. In the while condition should actually be. But if I use &amp;&amp; it stops as soon as it rolls a 1 on the first dice. I thought &amp;&amp; means "AND" and || means "OR". So actually it should behave exactly the other way around, or am I misinterpreting something?

http://stackoverflow.com/comment/36441077
comment on: http://stackoverflow.com/q/23710829
has text: looks like the indexes are derped
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36495819
comment on: http://stackoverflow.com/q/23716832
type: Comment
has text: If it gets restarted after a few seconds, is it really a problem?
type: QuestionComment
score: 0

http://stackoverflow.com/a/23726011
has body: The simple answer is no. You can parse it once and use it as a variable later. double depositAmount = Double.parseDouble(str); if (depositAmount &lt;= 0 || depositAmount &gt; 10000) throw new InvaildDepositAmount("Deposit Amount " + depositAmount); else totalBalance += depositAmount; This is also more efficient because, what if the call to parseDouble were expensive (that is, it took a long time for it to get an answer)? Calling it once would be more efficient and easier to read in the long run.
type: Answer
upvote count: 6
score: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23725952
answers question: http://stackoverflow.com/q/23725952

http://stackoverflow.com/q/23693654
tagged with: jruby
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36455993
tagged with: ruby
has comment: http://stackoverflow.com/comment/36407650
accepted answer: http://stackoverflow.com/a/23719832
has title: Why does not Warble include .class files in war file?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23719832
has body: when I warble my project, it doesn't include .class files to war file. My config/warble.rb file is like that: Warbler::Config.new do |config| config.features = %w(compiled executable) config.dirs &lt;&lt; "bin" config.dirs &lt;&lt; "public" config.includes = FileList["Rakefile"] config.executable = ["rake", "bin/rake"] end It was compiled yesterday but not compile and include for now. Also when I run warble compiled, it just rm .class files.

http://stackoverflow.com/q/23721160
has title: Jquery get method won't render xhtml pages
score: 0
answer count: 1
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/36484025
has comment: http://stackoverflow.com/comment/36460035
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36459360
has answer: http://stackoverflow.com/a/23740253
tagged with: jsf
has comment: http://stackoverflow.com/comment/36466980
has body: I am trying to render a jsf page with extension .xhtml when user chooses a jquery tab, the pages are called using jquery ajax, The problem is when I place a html page in the get method it works , but when the pages are .xhtml it is not rendered , here is an example $.get("/example/page.xhtml")", function(data) { $(".loads_here").append(data); ...}
tagged with: java
type: Question

http://stackoverflow.com/comment/37552721
has text: this answer not working properly provide some code snippets for this
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23693615

http://stackoverflow.com/comment/36296735
comment on: http://stackoverflow.com/q/23618135
has text: @Will yeah i know and I usually do comment as I go. I was just in a rush with this one
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36418340
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23690047
has text: Thank you ohiocowboy, I read that before, it is a stander doc, I did as it says, have problem, so it didn't resolve my problem.

http://stackoverflow.com/q/23737295
has answer: http://stackoverflow.com/a/23737419
score: -2
answer count: 4
tagged with: reference
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/36489622
has title: Why it is not possible to call a static function defined within a class through reference variable of the class?
has answer: http://stackoverflow.com/a/23737552
has answer: http://stackoverflow.com/a/23737389
upvote count: 0
has comment: http://stackoverflow.com/comment/36489537
has comment: http://stackoverflow.com/comment/36490376
linked to: http://stackoverflow.com/q/268814
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/36490713
has body: I have a question that why this code is giving me an error while i am trying to call a static function defined within a class through a class reference and it makes possible to call a static function when i am creating an object of a reference. public class Example { public static void main(String args[]) { Example t; t.method();//getting error Example t1=new Example t1(); t1.method();//it runs successfully } public static void method() { System.out.println("NullPointerException"); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23737325
duplicate of: http://stackoverflow.com/q/268814

http://stackoverflow.com/a/23631000
upvote count: 2
answers question: http://stackoverflow.com/q/23630428
type: Answer
downvote count: 0
score: 2
has body: Consider the following example (Basicalliy your example just filled with some real code, it is designed to throw a NullPointerException): public class Exceptions { public static void myMethod() { try{ String s = null; s.length(); } catch(NumberFormatException e1){ System.out.println("Something unexpected happend"); } catch(NullPointerException e2){ throw new RuntimeException("Exactly what we want happened"); } finally{ System.out.println("Finally Block"); } } public static void main(String[] args){ try{ myMethod(); } catch(RuntimeException e){ e.printStackTrace(); } } } The output of which is: Finally Block java.lang.RuntimeException: Exactly what we want happened at Exceptions.myMethod(Exceptions.java:14) at Exceptions.main(Exceptions.java:23) So you can see, that the finally-block is executed before the new RuntimeException is handed to the calling method. Otherwise the "Finally Block" output would be after the stacktrace of the RuntimeException.

http://stackoverflow.com/comment/36381209
score: 0
comment on: http://stackoverflow.com/q/23676834
type: Comment
type: QuestionComment
has text: @Edd 2, 3, 2 will be 2 because 2, & 3, are not treated as Int. My values are something like, Edd 22 Leghari 11 (with more text as well in between) and I expect 33 (grand total) which it does. Text file is created using a PowerShell script so it is reasonably predictable :)

http://stackoverflow.com/comment/36468648
type: Comment
type: QuestionComment
has text: If the only choices are a1/b1/c1, why not store 1 in a variable and ask the user for a/b/c?
score: 0
comment on: http://stackoverflow.com/q/23726146

http://stackoverflow.com/comment/36556802
type: Comment
has text: Agreed you could use multiple frames, that causes multiples frames to be displayed on the task bar and can cause window clutter. However, if the OP does use this approach then all frames should use DISPOSE_ON_CLOSE.
comment on: http://stackoverflow.com/a/23769938
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36333985
type: Comment
has text: thanks for the feedback . OBS . I created my application as NOT SCALABLE . I am using RHEL provided by OpenShift returned by uname version : Linux ex - 2.6.32 - std - node365.prod.rhcloud.com 431.11.2.el6.bz844450.x86_64 # 1 SMP Mon Mar 31 11:32:14 EDT 2014 x86_64 x86_64 x86_64 GNU / Linux
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23629947

android-listview
tags question: http://stackoverflow.com/q/23724206
tags question: http://stackoverflow.com/q/23681308
tags question: http://stackoverflow.com/q/23710946
tags question: http://stackoverflow.com/q/23616325
tags question: http://stackoverflow.com/q/23756977
tags question: http://stackoverflow.com/q/23631456
tags question: http://stackoverflow.com/q/23777209
tags question: http://stackoverflow.com/q/23751773
tags question: http://stackoverflow.com/q/23714661
tags question: http://stackoverflow.com/q/23713608
tags question: http://stackoverflow.com/q/23770404
tags question: http://stackoverflow.com/q/23657706
tag name: android-listview
tags question: http://stackoverflow.com/q/23683865
type: Tag
tags question: http://stackoverflow.com/q/23739835
tags question: http://stackoverflow.com/q/23739353
tags question: http://stackoverflow.com/q/23711963
tags question: http://stackoverflow.com/q/23673323
tags question: http://stackoverflow.com/q/23764286
tags question: http://stackoverflow.com/q/23628239

http://stackoverflow.com/comment/36552960
score: 0
has text: I might have a solution, but I'm going to need to ask another question first. I'll report back shortly.
type: Comment
comment on: http://stackoverflow.com/a/23769639
type: AnswerComment

http://stackoverflow.com/a/41963104
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23775596
has body: Some remarks about the Samsung S5 focus feature: When using AUTO focus mode: setting focus area directly after preview start didn't work for me, I had to call setFocusAreas() and setMeteringAreas() in a delayed Runnable (250 ms) when using CONTINUOUS_PICTURE: I wanted to start an auto focus when user taps on screen. So on touch event I set focus mode to AUTO, and call autofocus(). I had to reset focusAreas and FocusMeteringAreas (just call setfocusAreas(null) and setMeteringAreas(null)) before setting back CONTINUOUS_PICTURE focus mode to get continuous focus back again after autofocus. Also note that continuous focus is ignoring focus and metering areas, it's only focusing on the objects at the center of the screen.. I observed this behaviour only on Samsung S5.. (tested on S5 neo, S6, S7, XPeria E5, Nexus 5, Wiko UFeel and ASUS ZenPhone2)

http://stackoverflow.com/a/23756027
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36525350
accepted answer of: http://stackoverflow.com/q/23755759
answers question: http://stackoverflow.com/q/23755759
has body: Generally you have to parse the number using ES locale and format it using US locale: NumberFormat.getNumberInstance(Locale.US).format(NumberFormat.getNumberInstance(new Locale("es", "ES")).parse("25000,00"))
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23676579
type: AnsweredQuestion
tagged with: java
has body: I have developed an android app that uses BroadcastReceiver class to detect Wi-Fi Network changes. In this receiver I get the ssid of the network. Now I want that this ssid obtained by the receiver should be passed to the MainActivity everytime the receiver is called so that some ssid comparison can be done in the MainActivity. How can this be done?
has title: Receive data in the MainActivity from BroadcastReceiver everytime it is called
type: Question
has answer: http://stackoverflow.com/a/23676711
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23676711
tagged with: android

http://stackoverflow.com/comment/36295967
type: QuestionComment
comment on: http://stackoverflow.com/q/23636426
has text: Is this work done in separate threads? `SwingWorker`s? On the UI event thread?
score: 0
type: Comment

http://stackoverflow.com/comment/36453157
type: QuestionComment
has text: As for me, your example works as expected.
score: 0
comment on: http://stackoverflow.com/q/23718135
type: Comment

http://stackoverflow.com/comment/36335238
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23655174
has text: Sorry if I was unclear. Polygon is a java.awt.Polygon.
score: 0

http://stackoverflow.com/comment/36478663
type: QuestionComment
comment on: http://stackoverflow.com/q/23731270
has text: Beware, though, of the [dangers of correlating subtype polymorphism with generic polymorphism](http://blog.jooq.org/2013/06/28/the-dangers-of-correlating-subtype-polymorphism-with-generic-polymorphism/)
score: 2
type: Comment

http://stackoverflow.com/a/23669283
type: Answer
has body: ManagedExecutorService is exactly what you want to use for this. The availability of this service in JEE is a great benefit. In the past, we basically just ignored the guidelines and managed all of this stuff ourselves. The MES allows you to capture the context information of the invoking component, and tie your task in to the life cycle of the container. These are both very important in the JEE environment. As to where to start the task, you basically have two options. One, you can use a ServletContextListener, and have that kick off the task during container startup. Two, you can use an @Singleton EJB, and tie in to its lifecycle methods to start your task. If you start the task up from the ServletContextListener, then the task will run as if it's in the WAR environment. If you start it up from the @Singleton, it will run within the Session Beans environment (this mostly relates to how the JNDI appears). Either way, you only need to worry about starting the task via these mechanisms. You should rely on the ManagedTaskListener.taskAborted interface method to shut your task down. In theory you can work with the Thread.interrupt that is sent to your task during shut down. I've never had good luck with that myself, I rely on an external mechanism to tell the long running tasks to shut off. I wish I could give first hand experience with this new facility, but I haven't had an opportunity to try it out yet. But from the spec, this is what you want to do.
answers question: http://stackoverflow.com/q/23668302
score: 1
accepted answer of: http://stackoverflow.com/q/23668302
upvote count: 1
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23630078
has comment: http://stackoverflow.com/comment/36283114
has comment: http://stackoverflow.com/comment/36294608
type: Answer
has comment: http://stackoverflow.com/comment/36283079
score: 2
upvote count: 3
downvote count: 1
has body: Your logcat clearly said Caused by: java.lang.IllegalStateException: The meta- data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the element: You need to add Google play services version using &lt;meta-data&gt; tag under &lt;application&gt; tag in your manifest.xml file &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt;
answers question: http://stackoverflow.com/q/23629987

http://stackoverflow.com/q/23709694
has comment: http://stackoverflow.com/comment/36436672
has body: I am a manual tester and don't any of the tool so I need to know how can we check memory leaks in mobile device itself. Or is there any other method to test it? without having the knowledge of coding.
tagged with: ios
score: 4
has comment: http://stackoverflow.com/comment/36436865
has answer: http://stackoverflow.com/a/23709753
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 4
tagged with: memory-management
downvote count: 0
tagged with: java
has title: How can I test Memory leaks of my application in mobile device especially in iOS and Android?
type: Question

http://stackoverflow.com/comment/36439588
score: 0
type: AnswerComment
type: Comment
has text: i added if statements, but it still dont work. I have to add UncaughtExceptionHandler ? there is no other way ?
comment on: http://stackoverflow.com/a/23711202

http://stackoverflow.com/comment/36463046
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23723305
has text: How about using setText(getText() + ...); ? New line characters are "\n" btw. I also believe there is a methode appendText().
type: QuestionComment

http://stackoverflow.com/comment/36349133
has text: I can't reproduce this. Setting `nb_workers` to 1 will take ~7s. Setting it to 4 takes ~2s.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23663178
type: Comment

http://stackoverflow.com/a/23721885
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23721636
score: 2
downvote count: 0
has body: That's however how it should be. In the business logic is reduced to nothing except calling a DAO method, then you are lucky to have simple business logic. It would obviously be extremely inefficient and completely unrealistic to have the service call BookDAO.findAll() and filter the giant list of books returned by the DAO. SQL is the right tool for the job. Note that the days where mocking was only possible with interfaces are past. Using an interface to define your DAO methods isn't really necessary anymore.

http://stackoverflow.com/q/23755376
score: -1
has title: Replacing letters in a string with for loops
accepted answer: http://stackoverflow.com/a/23755945
possible better answer: http://stackoverflow.com/a/23755962
answer count: 2
has answer: http://stackoverflow.com/a/23755962
favorite count: 0
has body: I'm currently trying to loop through a String array replacing each letter in the word with a corresponding letter. I have an array of classes that store a letter called letter Occurrence, I have one for each letter that appears in my original string, which is stores 23 chars of the alphabet(Z never appears in my original string) I've then sorted my class from the most common letters to the least common letters that appear. Here's the original string of text that I want to change: vaoyelsy lsty aajp l a k urd aoofeia upd, kxflup lo oatqaosavailmjakqp ks oatqao frdap ks l k, l dtq dfisoak tva aoyifqqia fja lo dafo toakqp. toakqp tva aoy fqqia fja lo trdlqdao, ks k da lja acfkp da fpoumqflk b atra b da lois.pmath aksaoiy l daj. aq daoa a fkskapp k luo tra, k luo yap, k luo jfia, k da tojqd b luo oaaqfkc. iwtyp tva daaobui jfia. lk'q kiy fva luo toa, uq fva luo atoq p aii.qda loa lu tva, da loa lu oa rrumfas, da app lu fva. uq da app lu tva da loa oaa lu oa. lvaoqy lo p p oaaslj. q p lq loqfbfrtqflk, aktkra.fq p lybui oaaslj. daoa p l aiavfpflk aoa, l dfp, l dtq. uq a oa aobarqiy tmmy. Heres an output of the order the letterOccurence array. a - 12.3342175066313% o - 6.23342175066313% l - 5.570291777188329% q - 3.8461538461538463% f - 3.580901856763926% k - 3.580901856763926% p - 3.4482758620689653% d - 3.183023872679045% t - 3.050397877984085% u - 2.7851458885941645% i - 2.3872679045092835% s - 1.7241379310344827% y - 1.7241379310344827% v - 1.5915119363395225% j - 1.4588859416445623% r - 1.3262599469496021% b - 0.9283819628647214% m - 0.7957559681697612% c - 0.2652519893899204% e - 0.2652519893899204% h - 0.1326259946949602% w - 0.1326259946949602% x - 0.1326259946949602% And heres my code replacing the letters. char[] letterFrequency = {'e','t','a','o','i','n','s','h','r','d','l','c','u','m','w','f','g','y','p','b','v','k','j','x','q','z'}; String codeBreak = ""; for(int cnt = 0; cnt &lt; words.length;cnt++){ for(int i = 0;i &lt; letterOccurences.size(); i++){ words[c…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36524090
has answer: http://stackoverflow.com/a/23755945
downvote count: 2
upvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/46473867
type: Comment
comment on: http://stackoverflow.com/q/23660921
score: 0
type: QuestionComment
has text: I have the exact opposite problem. Mine works on a server, but not my local workspace... same issue with 64 vs 32-bit system I guess. Don't have any solution yet.

http://stackoverflow.com/comment/36335577
comment on: http://stackoverflow.com/a/23656560
score: 0
type: AnswerComment
type: Comment
has text: You are right. The services will be required. You can implement a dummy service if you want to skip the behavior. However, you will see the dummy implementation in your stacktrace, your will be able to debug it, you will know, what is happening. However, with annotations, you will not know, who picks up that annotation, you will not be able to configure it. What if two different technologies picks up the same annotation and does a weaving on your class?

http://stackoverflow.com/comment/65054884
type: AnswerComment
comment on: http://stackoverflow.com/a/23653779
score: 0
type: Comment
has text: @Nepster It can be but does not have to.

http://stackoverflow.com/comment/36487191
comment on: http://stackoverflow.com/q/23736136
type: Comment
has text: You want to know about _constructors_.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36285824
comment on: http://stackoverflow.com/a/23630959
type: Comment
has text: Now it works great, forgot to set CountDownTimer timer; on top of my main class. Thanks @Apoorv
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36300704
type: Comment
comment on: http://stackoverflow.com/q/23638552
score: 0
type: QuestionComment
has text: Even if it wasn't flushing the stream the buffer is only 1kb not ~20kb.

http://stackoverflow.com/q/23736960
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36489703
tagged with: opencv
score: 2
answer count: 0
tagged with: java
has title: Assertion failed in compareHist (opencv)
type: Question
has body: i have the following code and i have tried to make it in CV_32F but still it gives me this error: Mat A = Highgui.imread("letter12.jpg", Highgui.CV_LOAD_IMAGE_COLOR); Mat B = Highgui.imread("r3.jpg", Highgui.CV_LOAD_IMAGE_COLOR); Mat resizeimage = new Mat(); Size sz = new Size(A.width(),A.height()); Imgproc.resize( B, resizeimage, sz ); A.convertTo(A, CvType.CV_32F); resizeimage.convertTo(resizeimage, CvType.CV_32F); double distance = Imgproc.compareHist(A, resizeimage, Imgproc.CV_COMP_CORREL); Error: OpenCV Error: Assertion failed (H1.type() == H2.type() &amp;&amp; H1.type() == CV_32F) in compareHist, file Desktop/opencv-2.4.8/modules/imgproc/src/histogram.cpp, line 1985 error: cv::Exception: Desktop/opencv-2.4.8/modules/imgproc/src/histogram.cpp:1985: error: (-215) H1.type() == H2.type() &amp;&amp; H1.type() == CV_32F in function compareHist

http://stackoverflow.com/comment/124353367
comment on: http://stackoverflow.com/a/23753195
has text: Doesn't it work, "myProcess.StartInfo.CreateNoWindow = true" ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23642694
tagged with: normalize
has answer: http://stackoverflow.com/a/23642740
has title: What does it mean to normalize an array?
favorite count: 0
score: 5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23642740
upvote count: 5
tagged with: java
has body: I need to normalize an array that contains values between 0 to 1024 into an array that will contain values between 0-255. I am doing this in Java but I am wanting to understand what exactly does it mean to "normalize an array" rather than asking for exact code.
possible better answer: http://stackoverflow.com/a/23642837
has answer: http://stackoverflow.com/a/23642837
has comment: http://stackoverflow.com/comment/36308867
type: Question
linked to: http://stackoverflow.com/q/13368046
answer count: 2
has comment: http://stackoverflow.com/comment/36312913
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36312231
has comment: http://stackoverflow.com/comment/36308548

http://stackoverflow.com/a/23620205
has body: this.validate(); Swing components have a default state of being invalid and won't be painted to the screen unless validated (by calling the .validate() method on either the component itself or on one of the parent containers).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23620009

http://stackoverflow.com/comment/36436672
type: Comment
has text: Have you tried googlig for the answer?
score: 0
comment on: http://stackoverflow.com/q/23709694
type: QuestionComment

http://stackoverflow.com/comment/36500500
has text: No need; the listening `Jlist` will get the message; more above.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23742894

http://stackoverflow.com/comment/36361674
type: QuestionComment
comment on: http://stackoverflow.com/q/23670110
has text: Plain way would be waiting for a few seconds. After that checking if the process is still running.
score: 0
type: Comment

http://stackoverflow.com/comment/36443593
score: 0
has text: "I'm guessing when it sleeps the whole application halts and then resumes to find out it needs to halt again." -- no, it is because you are not returning control of the main application thread to the framework, so it cannot draw your changes.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23713320

http://stackoverflow.com/a/23731918
type: AcceptedAnswer
has body: Yes you can, though you would have to use scala syntax: :: ~ » scala Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25). Type in expressions to have them evaluated. Type :help for more information. scala&gt; val x = new java.io.File("/tmp/foo") x: java.io.File = /tmp/foo scala&gt; x.length res0: Long = 24777 Here I used scala REPL which is bundled with scala distribution, but in fact, you can use sbt (scala analog to maven) command so all project classes are instantly available on class path: sbt console .... // using java code, just like any other jvm code It is possible to use vanila REPL for the same purpose, but you will have to manually reconstruct classpath: scala -classpath ... And yes, as @Boris mentioned in the comments, IDEs (originally Eclipse, but now IDEA too) has it's own way of this feature -- build in, interactive worksheets (relevant plugins has to be installed):
score: 8
type: Answer
answers question: http://stackoverflow.com/q/23731715
accepted answer of: http://stackoverflow.com/q/23731715
downvote count: 0
has comment: http://stackoverflow.com/comment/36479693
upvote count: 8
has comment: http://stackoverflow.com/comment/36479572

http://stackoverflow.com/q/23742153
has answer: http://stackoverflow.com/a/23742258
has title: Having trouble deciding where to put a while loop in my pig dice game program
type: Question
has comment: http://stackoverflow.com/comment/36541798
tagged with: java
has body: So I'm writing a program where two users take turns rolling a die. If the user rolls a 1 then their turn ends, if the user rolls 2-6 then I'm supposed to keep a running total of the points scored until the user either decides to roll again and risk his stored points for the round or to save it. The problem I'm currently having now has to do with where I should place a while loop in my code so that the user can play for an undetermined amount of time. Ideally I would like to get out of the while loop whenever the user rolls a 1, but I'm also having trouble with how to update that number every time outside of the loop. Any help would be much appreciated! Note: The game isn't finished yet, I'm trying to write through some of these problems before moving on, also the place where I'd like to put my while loop is in the takeTurn method. Thanks again! Here is my code: import java.util.*; public class PigDice { // when a player reaches this number, they win public static final int WINNING_SCORE = 50; public static final int DIE = 6; // sides on a die. public static void main( String[] args ) { Scanner keyboard = new Scanner( System.in ); Random rand = new Random(); String winner = playGame( keyboard, rand ); System.out.println( winner + " wins!" ); } public static String playGame( Scanner scanner, Random rand ) { int score1 = 0; // player 1's score int score2 = 0; // player 2's score // play till someone wins while ( score1 &lt; WINNING_SCORE &amp;&amp; score2 &lt; WINNING_SCORE ) { score1 += takeTurn( scanner, rand, 1, score1 ); System.out.println( "Player 1 score: " + score1 ); System.out.println( "***************************" ); if ( score1 &lt; WINNING_SCORE ) { score2 += takeTurn( scanner, rand, 2, score2 ); System.out.println( "Player 2 score: " + score2 ); System.out.println( "***************************" ); } } if ( score1 &gt;= WINNING_SCORE ) { return "Player 1"; } else { return "Player 2"; } } public static int takeTurn( Scanner scanner, Random rand, int player, …
downvote count: 4
tagged with: dice
favorite count: 0
answer count: 3
tagged with: while-loop
has answer: http://stackoverflow.com/a/23742268
has answer: http://stackoverflow.com/a/23764819
type: UnansweredQuestion
tagged with: user-input
linked to: http://stackoverflow.com/q/3821827
score: -3
upvote count: 1

http://stackoverflow.com/a/23716946
type: Answer
has comment: http://stackoverflow.com/comment/36450636
has comment: http://stackoverflow.com/comment/36450613
score: 2
has comment: http://stackoverflow.com/comment/36450658
answers question: http://stackoverflow.com/q/23716925
upvote count: 2
has comment: http://stackoverflow.com/comment/36450553
accepted answer of: http://stackoverflow.com/q/23716925
has comment: http://stackoverflow.com/comment/36450598
has comment: http://stackoverflow.com/comment/36450625
has body: You add your graphicsCall variable to nothing, and so it will not be displayed. Solution: add it to a container such as that JPanel that you just created, or perhaps directly to the JFrame's contentPane. i.e., change this: JFrame window = new JFrame(); Sound soundCall = new Sound(); Graphics graphicsCall = new Graphics(); final JPanel container = new JPanel(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(container); to this: JFrame window = new JFrame(); Sound soundCall = new Sound(); Graphics graphicsCall = new Graphics(); // final JPanel container = new JPanel(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(soundCall); As an aside, you will want to re-name that class from Graphics to something else, or else you risk confusing yourself or your compiler since there already exists a critical Java class with that name. Also, avoid using setSize(...). Better to have your drawing JPanel override getPreferredSize() and to call pack() on your JFrame. Edit As per MadProgrammer's astute observation, you're drawing outside of the bounds of your component. Edit 2 Regarding your latest code, this: public class Draw { public class Graphics extends JPanel { public void paintComponent(java.awt.Graphics g) { super.paintComponent(g); g.setColor(Color.GRAY); g.drawRect(0, 0, 500, 500); } } } is useless dreck. Why are you needlessly wrapping a class inside of a class? Instead why not simply: public class Draw extends JPanel { public void paintComponent(java.awt.Graphics g) { super.paintComponent(g); g.setColor(Color.GRAY); g.drawRect(0, 0, 500, 500); } @Override public Dimension getPreferredSize() { // return an appropriate Dimension here } }
has comment: http://stackoverflow.com/comment/36450648
has comment: http://stackoverflow.com/comment/36450621
has comment: http://stackoverflow.com/comment/36450767
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36450734

http://stackoverflow.com/comment/36265722
comment on: http://stackoverflow.com/q/23620359
has text: Before posting I used some regex in other posts, and tested them. But seems that the matches() function from java keeps giving false, and doesn't admit words with ñ. For example I tried the `"\\P{L}+"` regex, but it didn't seem to work, I just tried this one also `"[a-zA-ZñÑ]*"`, and the alternate version that was posted below: `"[a-zA-Z\u00f1\u00d1]*"`. All of them for some reason bounce with the same result.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23822383
has comment: http://stackoverflow.com/comment/36845703
type: Answer
has body: For a start, you should move your String owner = "hypergainz"; into the class variables, since you don't need to set it every time a message is received. Next, a good idea might be to break up the message into a String array, so that you can break the commands up from the (possible) arguments. You can do that with: String[] messageArray = message.split(" "); Once you have done that, you can compare the very first section of the message much easier. If you are going to be using a few commands (up to about 10) I'd suggest using a switch to try and keep it tidy. For example: public void onMessage(String channel, String sender, String login, String hostname, String message) { String[] messageArray = message.split(" "); String command = messageArray[0]; switch(command){ default:break; case: "!songrequest": sendMessage(channel, "Sorry i cant do that atm HyperGainZ need to learn me that, to see the current song use !song :D"); return; case "!song": String song = ""; try { song = getSong(); } catch (Exception e) { e.printStackTrace(); } sendMessage(channel, song); return; } However, if you are going to be making a (big) utility bot, creating your own distribution method might be a good idea, because that onMessage(...) method fills up very quickly.
has comment: http://stackoverflow.com/comment/36746825
has comment: http://stackoverflow.com/comment/36706050
has comment: http://stackoverflow.com/comment/36675813
has comment: http://stackoverflow.com/comment/36694896
score: 4
has comment: http://stackoverflow.com/comment/36858304
upvote count: 4
answers question: http://stackoverflow.com/q/23741368
downvote count: 0
has comment: http://stackoverflow.com/comment/36684475

http://stackoverflow.com/q/23671306
type: Question
tagged with: opencv
has answer: http://stackoverflow.com/a/26026934
tagged with: javacv
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23675453
tagged with: ffmpeg
has answer: http://stackoverflow.com/a/23673143
has title: Issue with image rotation using JavaCV library
type: UnansweredQuestion
tagged with: android
has body: I am writing an Android application which records video for a specified amount of time. Everything works fine if I record using the smartphone's back camera. The app has a feature to pause/record feature like in Vine app. The issue comes when recording using the device's front camera. The video surface frame looks fine when storing/playing the video the video is upside down. There is a lot of things discussed about this issue everywhere. But I didn't find any solution that WORKS. Have a look at the code and image mentioned below. Here is the original image taken from front camera. I have turned it upside down for a better view. Here is what I actually get after rotation: Method: IplImage copy = cvCloneImage(image); IplImage rotatedImage = cvCreateImage(cvGetSize(copy), copy.depth(), copy.nChannels()); //Define Rotational Matrix CvMat mapMatrix = cvCreateMat(2, 3, CV_32FC1); //Define Mid Point CvPoint2D32f centerPoint = new CvPoint2D32f(); centerPoint.x(copy.width() / 2); centerPoint.y(copy.height() / 2); //Get Rotational Matrix cv2DRotationMatrix(centerPoint, angle, 1.0, mapMatrix); //Rotate the Image cvWarpAffine(copy, rotatedImage, mapMatrix, CV_INTER_CUBIC + CV_WARP_FILL_OUTLIERS, cvScalarAll(170)); cvReleaseImage(copy); cvReleaseMat(mapMatrix); I have tried doing double angleTemp = angle; angleTemp= ((angleTemp / 90)%4)*90; final int number = (int) Math.abs(angleTemp/90); for(int i = 0; i != number; ++i){ cvTranspose(rotatedImage, rotatedImage); cvFlip(rotatedImage, rotatedImage, 0); } Ends up in throwing exception saying that source and destination doesn't match with number of columns and rows. Update: Video is recorded in this way. IplImage newImage = null; if(cameraSelection == CameraInfo.CAMERA_FACING_FRONT){ newImage = videoRecorder.rotate(yuvIplImage, 180); videoRecorder.record(newImage); } else videoRecorder.record(yuvIplImage); Rotation is done in this way: IplImage img = IplImage.create(image.height(), image.width(), image.depth(), image.nChannels()); f…
answer count: 4
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/28739823

http://stackoverflow.com/a/23725666
has comment: http://stackoverflow.com/comment/36467559
upvote count: 1
answers question: http://stackoverflow.com/q/23725630
type: Answer
has body: You may define several variables in the first part of for loop statement and separate them by a comma ,: for (int i = 0, j = 0; //variable definition, more than 1 from the same type j &lt;= 800 &amp;&amp; i &lt;= 550; //conditional j += 60, i ++ //after completing a loop in the for ) { g.setColor(new Color(randRed(), randGreen(), randBlue())); //fix this code accordingly g.drawRect(j, 0, 60, 550); g.fillRect(j, 0, 60, 550); repaint(); }
downvote count: 0
score: 1

http://stackoverflow.com/q/23722858
tagged with: jdialog
has comment: http://stackoverflow.com/comment/36462979
score: 2
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/36462221
type: AnsweredQuestion
upvote count: 2
has title: Why is a Joptionpane not modal on top of a JDialog
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36462255
tagged with: java
has comment: http://stackoverflow.com/comment/36462108
has comment: http://stackoverflow.com/comment/36462120
accepted answer: http://stackoverflow.com/a/23723376
tagged with: modal-dialog
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23723376
has comment: http://stackoverflow.com/comment/36463266
has body: I have used a JOptionpane as an error message which is invoked by a wrong user input on a JDialog. Modality Type : APPLICATION MODAL modalExclusionType : APPLICATION_EXCLUDE The problem is when the JOptionpane appears the JDialog is still functional. Below is the code of invoking the JOptionpane JOptionPane.showMessageDialog(JDialog's name, "you must fill in all required fields", "Error!", 0); Is there any way to fix this? here is a minimal example programme import javax.swing.JOptionPane; public class Modality extends javax.swing.JFrame { public Modality() { initComponents(); } private void initComponents() { jDialog1 = new javax.swing.JDialog(); jTextField1 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jDialog1.setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE); jDialog1.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL); jButton2.setText("JOptionpane"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel1.setText("Type in the textfield while the jdialog is visible"); javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane()); jDialog1.getContentPane().setLayout(jDialog1Layout); jDialog1Layout.setHorizontalGroup( jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jDialog1Layout.createSequentialGroup() .addGroup(jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jDialog1Layout.createSequentialGroup() .addGap(109, 109, 109) .addComponent(jButton2)) .addGroup(jDialog1Layout.createSequentialGroup() .addGap(76, 76, 76) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jDialog1Layout.createSequentialGroup() .addGap(50, 50, 50) .addCompone…
favorite count: 0

http://stackoverflow.com/comment/36518414
comment on: http://stackoverflow.com/a/23751361
score: 0
type: AnswerComment
has text: I executed the standalone using Visual C++.
type: Comment

http://stackoverflow.com/q/23644190
has answer: http://stackoverflow.com/a/23644244
has answer: http://stackoverflow.com/a/23644227
possible better answer: http://stackoverflow.com/a/23644275
has answer: http://stackoverflow.com/a/23644275
answer count: 4
has comment: http://stackoverflow.com/comment/36311468
has comment: http://stackoverflow.com/comment/36311456
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23644227
score: 1
tagged with: java
has body: I am having problems implementing the printf method into my code. I started my first Java course this week and am trying to get ahead of the class. Essentially, I am to create an output of ASCII characters, hexadecimal numbers, and their decimal equivalents, up to 127 entries. The number of rows created in the output is chosen by user input. This is the code I have so far: package lab1; import java.util.Scanner; public class Lab1 { public static void main(String[] args) { //declare Scanner scan = new Scanner(System.in); //prompt the user to enter an integer, num defines the # of rows displayed in output System.out.print("How many groups? "); int num = scan.nextInt(); //print ascii, then hex value, then dec value for (int c = 0; c &lt; 128; c++) { String hex = Integer.toString(c , 16); String output = (char)c + " " + hex + " " + c; System.out.println(output); /* //print the output with printf to create the columns //character (c), string(s), decimal integer(d) System.out.printf("%-2c %-2s %-2d", output); */ } } } I would have posted an image here showing what the final result should look like but I need 10 reputation. I am able to email a copy to you privately though. I hope you can help me understand how to accomplish this, or direct me to a resource where I am able to learn myself. Thanks!
has comment: http://stackoverflow.com/comment/36311464
type: Question
has answer: http://stackoverflow.com/a/23644222
has comment: http://stackoverflow.com/comment/36311503
downvote count: 0
has comment: http://stackoverflow.com/comment/36311515
has title: Using 'printf' in Java
favorite count: 0
tagged with: printf

vaadin
tags question: http://stackoverflow.com/q/23714752
tags question: http://stackoverflow.com/q/23777359
tags question: http://stackoverflow.com/q/23652117
tags question: http://stackoverflow.com/q/23733566
tags question: http://stackoverflow.com/q/23636368
tag name: vaadin
tags question: http://stackoverflow.com/q/23630943
tags question: http://stackoverflow.com/q/23754174
tags question: http://stackoverflow.com/q/23760167
tags question: http://stackoverflow.com/q/23753565
tags question: http://stackoverflow.com/q/23756023
type: Tag
tags question: http://stackoverflow.com/q/23710744
tags question: http://stackoverflow.com/q/23631608
tags question: http://stackoverflow.com/q/23719298
tags question: http://stackoverflow.com/q/23672319
tags question: http://stackoverflow.com/q/23653791

http://stackoverflow.com/comment/36547477
type: Comment
comment on: http://stackoverflow.com/a/23757247
has text: Ok, I've removed my answer too because you're right, it doesn't actually work. Seems to be a bug, because simply having a second title for a module is useless.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23628203
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23628001
upvote count: 2
has body: No such public method in HashMap. You could use debug mode in your IDE to watch HashMap.table. plus: as Sanjeev commented, reflection is an option.

http://stackoverflow.com/a/23676037
upvote count: 1
type: Answer
has body: When you do current=null; you set the (local) variable current to null, but still the same object is pointed in your list, you want the object in the list which points to the last object with his next member (someobject.next) to stop pointing there, so you need to change the value of someobject.next, e.g. someobject.next = null;
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23675753

http://stackoverflow.com/q/23737498
has answer: http://stackoverflow.com/a/23749539
type: Question
accepted answer: http://stackoverflow.com/a/23749539
has title: Saving a file returned by web-service in java
score: 0
answer count: 1
has body: I have to make a call to a web-service for which the response is as per following &lt;ns2:wsresponse&gt; &lt;ns2:length&gt;10582&lt;/ns2:length&gt; &lt;ns2:filecontent&gt;H4sIAAAAAAAAALVZa3OjSLL9fB... (Snip) &lt;/ns2:filecontent&gt; &lt;ns2:contentType&gt;application/gzip&lt;/ns2:contentType&gt; &lt;/ns2:wsresponse&gt; The web-service is actually returning a file which is encoded using mime-type application/gzip (as in ns2:contentType). I am not sure how to save the file on disk on the client side in java?
tagged with: web-services
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36407839
comment on: http://stackoverflow.com/q/23693796
score: 0
has text: I'm aware of that. What I'm worried about is that having cleartext username/password for authentication allows *anyone* to get access, which you probably don't want. I originally thought you were going to have the user authenticate, but seeing as that isn't the case, I can't see how you expect to secure your program given that you have to load the cleartext password at some point.
type: QuestionComment
type: Comment

gmail
type: Tag
tags question: http://stackoverflow.com/q/23710669
tag name: gmail

algorithm
tags question: http://stackoverflow.com/q/23774985
tags question: http://stackoverflow.com/q/23641112
tag name: algorithm
tags question: http://stackoverflow.com/q/23644314
tags question: http://stackoverflow.com/q/23637359
tags question: http://stackoverflow.com/q/23711681
tags question: http://stackoverflow.com/q/23687525
tags question: http://stackoverflow.com/q/23722011
tags question: http://stackoverflow.com/q/23639943
tags question: http://stackoverflow.com/q/23718933
tags question: http://stackoverflow.com/q/23642787
tags question: http://stackoverflow.com/q/23664036
tags question: http://stackoverflow.com/q/23679648
tags question: http://stackoverflow.com/q/23730583
tags question: http://stackoverflow.com/q/23719990
tags question: http://stackoverflow.com/q/23656135
tags question: http://stackoverflow.com/q/23725742
tags question: http://stackoverflow.com/q/23699452
tags question: http://stackoverflow.com/q/23697049
type: Tag
tags question: http://stackoverflow.com/q/23771091
tags question: http://stackoverflow.com/q/23772990
tags question: http://stackoverflow.com/q/23691590
tags question: http://stackoverflow.com/q/23659430
tags question: http://stackoverflow.com/q/23644496
tags question: http://stackoverflow.com/q/23770814
tags question: http://stackoverflow.com/q/23655064
tags question: http://stackoverflow.com/q/23712737
tags question: http://stackoverflow.com/q/23634264
tags question: http://stackoverflow.com/q/23704635
tags question: http://stackoverflow.com/q/23716285
tags question: http://stackoverflow.com/q/23769169
tags question: http://stackoverflow.com/q/23695768
tags question: http://stackoverflow.com/q/23722712
tags question: http://stackoverflow.com/q/23709867
tags question: http://stackoverflow.com/q/23755482

http://stackoverflow.com/q/23688500
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36506419
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36397790
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36504777
has body: I am creating target XML by copying source XML content. I am doing copy at node level. Source XML has content with escape character which gets converted [$quot; to " etc...] while I create my target XML Is there any way to retain original XML content. Appreciate any help on this. copyXmlFile("Workflow", "./Source.xml", "./Destination.xml"); private static void copyXmlFile(String xmlType, String objectSourceFile, String outfile) throws TransformerException { //Get the DOM Builder Factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); //Get the DOM Builder DocumentBuilder builder = null; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } //document contains the complete XML as a Tree. try { File xmlFileContent = new File(objectSourceFile); Document document = builder.parse(new FileInputStream(xmlFileContent)); // root elements Document documentOut = builder.newDocument(); Element rootElementOut = documentOut.createElement(xmlType); rootElementOut.setAttribute("xmlns", "http://soap.sforce.com/2006/04/metadata"); documentOut.appendChild(rootElementOut); NodeList nodeList = document.getDocumentElement().getChildNodes(); for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element) { //Node copiedNode = documentOut.importNode(node, true); //rootElementOut.appendChild(copiedNode); rootElementOut.appendChild(documentOut.adoptNode(node.cloneNode(true))); } } // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(documentOut); //StreamResult result = new StreamResult(new File(outfile)); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //tr…
has comment: http://stackoverflow.com/comment/36403071
type: Question
has title: Retain escape character [&quot; &lt; etc..] while copying XML node - Java
has comment: http://stackoverflow.com/comment/36398144
score: 0
has comment: http://stackoverflow.com/comment/36398868

http://stackoverflow.com/q/23715369
favorite count: 0
accepted answer: http://stackoverflow.com/a/23716408
has title: Running Hadoop commands in a shell script
has comment: http://stackoverflow.com/comment/36449348
has answer: http://stackoverflow.com/a/23716408
score: 2
type: AnsweredQuestion
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/23717507
tagged with: java
upvote count: 2
tagged with: hadoop
has body: I have a simple shell script that I'd like to use to move log files into my Hadoop cluster. When I invoke the the shell script in my Java program, the script can not be found "Hadoop Commands", and I do not take any action. For instance, I would like to run the following command: #!/bin/bash hadoop fs -put /home/can/workspace2/myWebApp/tweets.txt /user/training/tweetFolder How can I solve this in a simple manner?
answer count: 2
possible better answer: http://stackoverflow.com/a/23717507
tagged with: shell

null
tags question: http://stackoverflow.com/q/23732227
tag name: null
tags question: http://stackoverflow.com/q/23768552
tags question: http://stackoverflow.com/q/23669523
tags question: http://stackoverflow.com/q/23689580
tags question: http://stackoverflow.com/q/23618238
tags question: http://stackoverflow.com/q/23681373
tags question: http://stackoverflow.com/q/23634492
type: Tag
tags question: http://stackoverflow.com/q/23689954
tags question: http://stackoverflow.com/q/23642675
tags question: http://stackoverflow.com/q/23757376
tags question: http://stackoverflow.com/q/23656365

http://stackoverflow.com/q/23777673
has answer: http://stackoverflow.com/a/59752603
has comment: http://stackoverflow.com/comment/36567145
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36566786
downvote count: 0
has body: Is there an easy way to determine the keystore type in java? The keystore file does not have an extencion but i know it may be either jks or pkcs12. At the moment im using something like this: public static boolean isJks(File f) throws Exception{ KeyStore ks = null; FileInputStream fis = null; try { fis = new FileInputStream(f); ks = KeyStore.getInstance("jks"); ks.load(fis, null); return true; } catch (IOException e) { if(fis != null){ fis.close(); } fis = new FileInputStream(f); ks = KeyStore.getInstance("pkcs12"); ks.load(fis, null); return false; } finally { if(fis != null){ fis.close(); } } } Is there a easier way of doing this? If not then is this the way to go or should it be improved?
linked to: http://stackoverflow.com/q/33239875
favorite count: 0
has answer: http://stackoverflow.com/a/65437635
has comment: http://stackoverflow.com/comment/36566746
upvote count: 6
has title: Determine if keystore type is pkcs12 or jks (programmatically)
type: UnansweredQuestion
tagged with: keystore
score: 6

http://stackoverflow.com/a/23762014
score: 4
has comment: http://stackoverflow.com/comment/36538208
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36537311
has comment: http://stackoverflow.com/comment/36539801
has comment: http://stackoverflow.com/comment/36537871
type: Answer
has body: There's no particularly nice way of doing this, that I'm aware of. The best I've seen is just to cast - which you can do once, of course: public class Superclass&lt;T extends Superclass&lt;T&gt;&gt; { @SuppressWarnings("unchecked") private final T thisAsT = (T) this; T someMethodThatDoesSameThingForAllSubclasses() { return thisAsT; } } public class Subclass extends Superclass&lt;Subclass&gt; { Subclass subclassOnlyMethod() { return this; } } And then: Subclass subclass = new Subclass().someMethodThatDoesSameThingForAllSubclasses() .subclassOnlyMethod(); It's horrible that the cast doesn't actually check anything due to type erasure, but that's the joy of Java generics :(
has comment: http://stackoverflow.com/comment/36538277
accepted answer of: http://stackoverflow.com/q/23761885
has comment: http://stackoverflow.com/comment/36538057
answers question: http://stackoverflow.com/q/23761885
has comment: http://stackoverflow.com/comment/36537361
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36538044

http://stackoverflow.com/q/23645260
favorite count: 0
upvote count: 2
has title: Load a picture on canvas and Overlay text on the picture and save it
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23645799
type: Question
downvote count: 0
answer count: 1
has body: I want to create an application which will simply load the selected the image to a canvas and the user will have freedon to overlay text on the image anywhere on the image. i.e is after he have overlayed text on the image he should be able to move the text, edit the text. How can this be achieved. Is it that i have to load a frame layout and then on that i have to dynamically place text view to get the text overlay or anything else can be done. I want to achieve something like the picture given below When a "Add text" is clicked from action bar I want to add the text to the Picture loaded by user. Searched a lot but could not get any answers. I just want how to get this text on the image and move it anywhere on the picture. Also the final image that will be saved on the device will be just with the text overlayed on the image. the box appearing in picture should not be present in the image. All the experts out their please guide me.
tagged with: android-image

http://stackoverflow.com/a/23767309
score: 0
has body: I made a simple application that behaves as required: You can edit any cell and once the last cell of the last row editing ends an empty row is added. It supports column reordering (no extra effort was required for this). The approach is actually quite simple, JTable implements CellEditorListener, so we can override the method editingStopped(ChangeEvent) and check if we are in the last cell of the table and if so add a new row. So you should do something like this: //In the JTable class @Override public void editingStopped(ChangeEvent e) { //getting these values before calling super.editingStopped(e); because they get erased. int row = getEditingRow(); int col = getEditingColumn(); super.editingStopped(e); //must call the super code to have a working edition if (row == getRowCount() - 1 &amp;&amp; col == getColumnCount() - 1) { getModel().createNewRow(); } }; Obviously the TableModel and TableCellEditor and JTable I implemented are the bare minimum to accomplish this, you can use your own, just change the calls to the model I use for yours. It looks like this: I recommend using TAB to finish editing so the focus goes to the next one, and when you are in the last it jumps to the first of the new row. Full code: import java.awt.Component; import java.util.ArrayList; import javax.swing.AbstractCellEditor; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellEditor; public class TableEditingTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new TableEditingTest().createAndShowGUI(); } }); } private void createAndShowGUI() { JFrame frame = new JFrame("Table editing test"); MyTableModel model = new MyTableModel(); model.addRow(new String[]{"Some values", "so we have", "an actual table."}); …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23765543
type: Answer
answers question: http://stackoverflow.com/q/23765543

http://stackoverflow.com/q/23773024
tagged with: functional-programming
has answer: http://stackoverflow.com/a/70042532
has answer: http://stackoverflow.com/a/38282460
downvote count: 0
accepted answer: http://stackoverflow.com/a/29395324
favorite count: 0
has comment: http://stackoverflow.com/comment/36558200
has comment: http://stackoverflow.com/comment/36563418
has comment: http://stackoverflow.com/comment/92557350
has comment: http://stackoverflow.com/comment/101475117
has answer: http://stackoverflow.com/a/31093915
has title: Functional style of Java 8's Optional.ifPresent and if-not-Present?
has answer: http://stackoverflow.com/a/56131331
has answer: http://stackoverflow.com/a/51387785
tagged with: java-8
has answer: http://stackoverflow.com/a/29900740
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/66359205
has answer: http://stackoverflow.com/a/63094545
tagged with: java
has answer: http://stackoverflow.com/a/55288755
has answer: http://stackoverflow.com/a/55885231
has comment: http://stackoverflow.com/comment/36558226
linked to: http://stackoverflow.com/q/28514704
type: Question
tagged with: option-type
has answer: http://stackoverflow.com/a/23777562
has comment: http://stackoverflow.com/comment/36558189
has answer: http://stackoverflow.com/a/29395324
score: 382
has comment: http://stackoverflow.com/comment/77390525
possible better answer: http://stackoverflow.com/a/42669868
has comment: http://stackoverflow.com/comment/36632003
has comment: http://stackoverflow.com/comment/104706394
upvote count: 382
has answer: http://stackoverflow.com/a/42669868
has answer: http://stackoverflow.com/a/23795627
has body: In Java 8, I want to do something to an Optional object if it is present, and do another thing if it is not present. if (opt.isPresent()) { System.out.println("found"); } else { System.out.println("Not found"); } This is not a 'functional style', though. Optional has an ifPresent() method, but I am unable to chain an orElse() method. Thus, I cannot write: opt.ifPresent( x -&gt; System.out.println("found " + x)) .orElse( System.out.println("NOT FOUND")); In reply to @assylias, I don't think Optional.map() works for the following case: opt.map( o -&gt; { System.out.println("while opt is present..."); o.setProperty(xxx); dao.update(o); return null; }).orElseGet( () -&gt; { System.out.println("create new obj"); dao.save(new obj); return null; }); In this case, when opt is present, I update its property and save to the database. When it is not available, I create a new obj and save to the database. Note in the two lambdas I have to return null. But when opt is present, both lambdas will be executed. obj will be updated, and a new object will be saved to the database . This is because of the return null in the first lambda. And orElseGet() will continue to execute.
has comment: http://stackoverflow.com/comment/36566608
has comment: http://stackoverflow.com/comment/92557759
answer count: 13

http://stackoverflow.com/comment/36459933
type: Comment
type: QuestionComment
has text: Thank you AlexR, my problem here is I don't know how to link the Java program and the JSP page such that when I click on the submit button , to convert the uploaded pdf file into a text file.
score: 0
comment on: http://stackoverflow.com/q/23721691

http://stackoverflow.com/a/23714679
score: 0
has body: this always refers the current class variables in the scenario you mentioned so the benefit is just that the purpose of assigning value is satisfied the way it should be Is there some performance benefit to this? No its not for performance improvement Does it have something to do with how fields behave with inheritance? only if your parent class variables have same names Yes, or it does not have any thing to do with Inheritance as well EDIT: // Use fieldRef instead of field this we usually do because in java if your field is an Object, it maintains reference and any modifications we do gets reflected in original object property.
type: Answer
answers question: http://stackoverflow.com/q/23714663

http://stackoverflow.com/q/23702744
score: 0
has title: GridBagLayout: component in multiple grid squares
tagged with: jcomponent
has body: Is it possible to have a single JComponent spread over multiple grid squares, and if so how would I achieve this?
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/23702782
tagged with: java
type: UnansweredQuestion
tagged with: gridbaglayout
type: Question
has comment: http://stackoverflow.com/comment/36423447

http://stackoverflow.com/comment/36259856
comment on: http://stackoverflow.com/q/23617672
type: QuestionComment
type: Comment
has text: As a rule I don't answer homework questions, but have you considered converting all the characters to lower case using String's toLowerCase() method then comparing the resulting strings character by character? (Note that strings are immutable and toLowerCase returns a string.
score: 0

http://stackoverflow.com/q/23661878
answer count: 1
accepted answer: http://stackoverflow.com/a/23670946
type: AnsweredQuestion
has title: How to replace web.xml with application context config files?
has comment: http://stackoverflow.com/comment/36350313
tagged with: web.xml
has answer: http://stackoverflow.com/a/23670946
type: Question
has comment: http://stackoverflow.com/comment/36362936
tagged with: spring-mvc
tagged with: java
score: 0
has body: Background I'm trying to implement integration test for controller in Spring. I DON'T want to use WebApplicationInitializer (Java config for Spring) to run my web app. I want to use xml based configurations. However, @ContextConfiguration could not load web.xml, so I created application-context.xml. The problem is web.xml and application-context.xml are serving the same purpose, Question Can I remove web.xml in favor of application-context.xml? If I remove web.xml, the test would pass, but the web app won't run in Tomcat. Codes This is my test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"file:path/to/application-context.xml"}) @WebAppConfiguration public class HelloControllerIntegrationTest { @Autowired private WebApplicationContext context; private WebClient webClient; @Before public void setup() throws Exception { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); webClient = new WebClient(); webClient.setWebConnection(new MockMvcWebConnection(mockMvc)); } @Test public void testPrintWelcome() throws Exception { // I'm trying to print out the page for now UnexpectedPage welcomePage = webClient.getPage("http://localhost/"); InputStream is = welcomePage.getInputStream(); java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); String a = s.hasNext() ? s.next() : ""; System.out.println(a); } } This is my application-context.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/…
tagged with: tomcat7
tagged with: integration-testing

http://stackoverflow.com/comment/36371519
type: AnswerComment
comment on: http://stackoverflow.com/a/23674483
type: Comment
has text: The pathelements for code and test should be as below: `<pathelement path="code/build"/> <pathelement path="code/test-classes"/>`
score: 0

http://stackoverflow.com/comment/36287682
score: 0
type: Comment
has text: When the pool is in its own class, you can create support properties that for example hold the time at which the object was first created, lock objects, clean up and release back to pool, etc
comment on: http://stackoverflow.com/a/23632358
type: AnswerComment

http://stackoverflow.com/a/23664582
has body: Do it in a loop. Split the string at 8-character chunks and convert them separately. In "pseudocode" it's something like: byte[] result = new byte[subs.size()]; int i = 0; int j = 0; while(i+8 &lt;= s.length){ result[j] = new Byte.valueOf(largeString.substring(i, i+8), 2); i+=8; j++; } result[j] = new Byte.valueOf(largeString.substring(i, largeString.length));
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23664078

http://stackoverflow.com/a/23725284
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23632717
upvote count: 1
type: Answer
has body: You can create a CustomRepository interface extending Repository&lt;T,ID extends Serializable&gt;. Then you can implement CustomRepositoryImpl by yourself if you want full control of your repositories. You can refer to SimpleJpaRepository as implementation example.

http://stackoverflow.com/a/23688260
score: 1
has comment: http://stackoverflow.com/comment/36396919
has comment: http://stackoverflow.com/comment/36397074
upvote count: 1
has comment: http://stackoverflow.com/comment/36399488
downvote count: 0
has comment: http://stackoverflow.com/comment/36398641
has body: Try using e.getSource(): @Override public void keyPressed(KeyEvent e) { JTextField tf = (JTextField)e.getSource(); tf.setText(""); } The above code leaves the typed character in the box. If you want to end up with no characters (although, I'm not sure why you would want to do this), then maybe you should put this code in keyReleased()?
answers question: http://stackoverflow.com/q/23688177
type: Answer
has comment: http://stackoverflow.com/comment/36396802

http://stackoverflow.com/q/23711667
tagged with: java
has comment: http://stackoverflow.com/comment/36440554
has comment: http://stackoverflow.com/comment/36440351
type: Question
has comment: http://stackoverflow.com/comment/36440854
tagged with: ant
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36440322
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23712100
has answer: http://stackoverflow.com/a/23711749
tagged with: android
has comment: http://stackoverflow.com/comment/36440952
has body: When I build with Export Signed Application Package in Eclipse, and I use the keystore I created the first time, it works. Now I'm trying to use ANT to build the release APK (not debug), but, when I try to install the new APK on my real phone (not emulator), it trhows an existing package by the same name with a conflicting signature and I can't install. Of course, this means that the signature is incorrect, or something simialar with the password. This is the info I put in local.propeties sdk.dir=D:\\Documents\\Applications\\Android SDK key.store=D:\\Projects\\myProject\\signature_key key.alias=two words key.store.password=PasswordUsing$and% key.alias.password=PasswordUsing$and% Yes. The key.alias has 2 words (my mistake, but it's late now) 1) Is the format valid? Should I use quotes for the alias? Should I escape $ or % characters in the password? 2) What format should I use in local.properties to make the keystore/password be valid? 3) Is there something I'm missing?
has title: ANT Build - Signed APK Signature Issue
tagged with: build.xml
type: UnansweredQuestion

http://stackoverflow.com/comment/36443523
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23713392
type: Comment
has text: What JLabel are you trying to put the result into?

http://stackoverflow.com/comment/36288560
type: QuestionComment
comment on: http://stackoverflow.com/q/23624348
score: 0
has text: yes it is there. and, in fact, it does see it, as it enters its main and executes code from it for about 10 minutes before displaying said error.
type: Comment

http://stackoverflow.com/a/23701805
type: Answer
has body: Consider the following example: bool [] booleanArray; FileInfo [] files; booleanArray = new bool[10]; files = new FileInfo[10]; Here, the booleanArray is an array of the value type System.Boolean, while the files array is an array of a reference type, System.IO.FileInfo. The following figure shows a depiction of the CLR-managed heap after these four lines of code have executed. Eventhough this is a C# example. This is similar to what we have in Java.
answers question: http://stackoverflow.com/q/23701593
score: 0

http://stackoverflow.com/comment/36412549
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23670946
type: AnswerComment
has text: No problem! I updated an answer with a clarification at the end

http://stackoverflow.com/a/23700079
answers question: http://stackoverflow.com/q/23699256
type: Answer
has body: You need to implement PropertyChangeListener on your SwingWorker and listen to the Progress property changes and then from overridden propertChange() method update your JProgressBar. Here is what you are looking. Hope this helps.
has comment: http://stackoverflow.com/comment/36419360
has comment: http://stackoverflow.com/comment/36419535
has comment: http://stackoverflow.com/comment/36418980
has comment: http://stackoverflow.com/comment/36418788
has comment: http://stackoverflow.com/comment/36419729
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36419969
has comment: http://stackoverflow.com/comment/36419884
score: 0
accepted answer of: http://stackoverflow.com/q/23699256

http://stackoverflow.com/comment/36475696
has text: Only been vaguely familiar with JavaFX, I would guess that the `launch` method is placing an event onto the event queue that will call `start`, so that `start` is guaranteed to be called within the context of it's gui thread...what ever JavaFX calls it...
score: 0
comment on: http://stackoverflow.com/q/23729713
type: QuestionComment
type: Comment

rest
tags question: http://stackoverflow.com/q/23691662
tags question: http://stackoverflow.com/q/23680953
tags question: http://stackoverflow.com/q/23632068
tags question: http://stackoverflow.com/q/23630833
tags question: http://stackoverflow.com/q/23685338
tags question: http://stackoverflow.com/q/23734985
tags question: http://stackoverflow.com/q/23638283
tags question: http://stackoverflow.com/q/23730325
tags question: http://stackoverflow.com/q/23757228
tags question: http://stackoverflow.com/q/23679658
tags question: http://stackoverflow.com/q/23632886
tags question: http://stackoverflow.com/q/23631868
tags question: http://stackoverflow.com/q/23762017
tags question: http://stackoverflow.com/q/23766789
tags question: http://stackoverflow.com/q/23741587
tags question: http://stackoverflow.com/q/23633402
tags question: http://stackoverflow.com/q/23639717
tags question: http://stackoverflow.com/q/23618621
tags question: http://stackoverflow.com/q/23641345
tags question: http://stackoverflow.com/q/23719611
tags question: http://stackoverflow.com/q/23656786
tags question: http://stackoverflow.com/q/23625927
tags question: http://stackoverflow.com/q/23736367
tags question: http://stackoverflow.com/q/23745798
tags question: http://stackoverflow.com/q/23649317
tags question: http://stackoverflow.com/q/23663851
type: Tag
tags question: http://stackoverflow.com/q/23676262
tags question: http://stackoverflow.com/q/23635957
tags question: http://stackoverflow.com/q/23741625
tags question: http://stackoverflow.com/q/23657595
tags question: http://stackoverflow.com/q/23761963
tags question: http://stackoverflow.com/q/23744108
tags question: http://stackoverflow.com/q/23750966
tags question: http://stackoverflow.com/q/23730465
tags question: http://stackoverflow.com/q/23645878
tags question: http://stackoverflow.com/q/23620716
tags question: http://stackoverflow.com/q/23673927
tag name: rest
tags question: http://stackoverflow.com/q/23758252
tags question: http://stackoverflow.com/q/23759810
tags question: http://stackoverflow.com/q/23732671
tags question: http://stackoverflow.com/q/23762443
tags question: http://stackoverflow.com/q/23664111
tags question: http://stackoverflow.com/q/23742089
tags question: http://stackoverflow.com/q/23682334
tags question: http://stackoverflow.com/q/23622266
tags question: http://stackoverflow.com/q/23737656
tags question: http://stackoverflow.com/q/23673250

http://stackoverflow.com/comment/140235913
has text: @James_D Thanks for the clarification. The view state vs model state is a helpful distinction.
comment on: http://stackoverflow.com/a/23716825
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36591905
type: Comment
comment on: http://stackoverflow.com/a/23729223
has text: Can you please explain your comment about extending directly from top level container like JFrame? Or at least give me a url so I can read about this?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23677938
accepted answer of: http://stackoverflow.com/q/23677790
has comment: http://stackoverflow.com/comment/36377979
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36377014
has body: As already stated in the Exception Message: You are trying to access an UI-Element from a thread that differs from the Display-Thread. I also stumbled across this several times when I was new to SWT. You can avoid this issue by invoking the correct Thread, using: Display.getDefault().asyncExec(Runnable) or Display.getDefault().syncExec(Runnable) This way, you can define an anonymous runnable to access the needed information from your Text. EDIT: Since you already knew about these methods on Display you now have to know how to return a value from that runnable, right? The solution to that depends on what you are going to do with these values. If its not a long-blocking operation, you could continue doing it inside the Display-Thread so you dont have to implement inter-thread-communication. Otherwise you could use a Monitor-Object which your other thread waits on. If the Display-Thread (with the runnable) is then finished reading the Value of your Text, it can invoke notify on that Monitor (which can be any variable) so that your waiting Thread can continue. EDIT2, since I can't comment: MyRunnable runnable = new MyRunnable(); Display.getDefault().syncExec(runnable); System.out.println(runnable.getText()); private class MyRunnable implements Runnable { String myString; @Override public void run() { //Here you can also get the text from your Text-Object myString = "MyText"; } String getText() { return myString; } }
has comment: http://stackoverflow.com/comment/36376920
score: 0
answers question: http://stackoverflow.com/q/23677790
type: Answer

http://stackoverflow.com/a/23731424
type: Answer
has body: Using gson, it is much simpler. Use the following code snippet: // create a new Gson object Gson gson = new Gson(); // convert your set to json String jsonUsersSet = gson.toJson(users); // print your generated json System.out.println("jsonUsersSet: " + jsonUsersSet); Convert from JSON string to your Java object: // Converts JSON string into a set of user object Type type = new TypeToken&lt;Set&lt;User&gt;&gt;(){}.getType(); Set&lt;User&gt; userSet = gson.fromJson(jsonUsersSet, type); // print your Set&lt;User&gt; System.out.println("userSet : " + userSet);
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23730768

http://stackoverflow.com/comment/36604707
score: 0
has text: Spews out a javadoc application error message. If I do "\\\n" as suggested here is the error message. :main:visualize:classes UP-TO-DATE :main:visualize:jar UP-TO-DATE :alljavadoc javadoc: error - invalid flag: -->\\ usage: javadoc [options] [packagenames] [sourcefiles] [@files] -overview <file> Read overview documentation from HTML file -public Show only public classes and members -protected Show protected/public classes and members (default)
comment on: http://stackoverflow.com/q/23763534
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36407915
comment on: http://stackoverflow.com/q/23693219
has text: final should not make any difference. I have used it earlier also
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/23775718
has body: Use the property java.io.tmpdir to get the tomcat temp folder and save your files there. That will be a good place to temporarily keep them in. So you can define it as follows: public static final String TMP_DIR = System.getProperty("java.io.tmpdir")
downvote count: 0
answers question: http://stackoverflow.com/q/23775620
score: 16
accepted answer of: http://stackoverflow.com/q/23775620
type: AcceptedAnswer
type: Answer
upvote count: 16

http://stackoverflow.com/comment/36374150
has text: And here is the exception I get: `Exception in thread "main" org.json.JSONException: JSONObject["name"] not found. at org.json.JSONObject.get(JSONObject.java:472) at org.json.JSONObject.getString(JSONObject.java:653) at proba.ProductInfo.deserialize(ProductInfo.java:31) at proba.Main.main(Main.java:51)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23676739
score: 0

http://stackoverflow.com/comment/36454043
type: QuestionComment
comment on: http://stackoverflow.com/q/23718679
score: 1
has text: What do you mean you have A and B defined? If A and B are classes and not type parameters, maybe you should use _ClassA_ and _ClassB_ to make it clear. If A and B are actual types (not type *parameters*), then the answers below about type erasure explain what's happening.
type: Comment

http://stackoverflow.com/q/23770359
tagged with: apache-tomee
has body: TomEE 1.6.0 has a default thread pool with 3 threads for EJB timer scheduling. I'd like to increase the size of this pool or configure a separate pool for my web application. I've tried to set the following properties separately or together inside my application in WEB-INF/application.properties and for TomEE globally in tomee/conf/system.properties but they don't seem to have any effect: openejb.timer.pool.size = 30 org.quartz.threadPool.threadCount = 30 How can I increase the EJB timer pool thread count in TomEE? Edit: I'm aware of this blog post which appears to give the answer and have tried to apply that with no success. I'd like to avoid a custom ThreadPool implementation and thought one of the above properties should suffice. Thanks!
answer count: 1
has answer: http://stackoverflow.com/a/23789876
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23789876
score: 1
tagged with: java
has title: How to change EJB timer thread pool size in TomEE/OpenEJB?
tagged with: quartz-scheduler
type: Question
tagged with: ejb
downvote count: 0
tagged with: openejb

http://stackoverflow.com/comment/36564229
has text: Dear @abimaran suppose some exception occur ..I will get null value..so in that case I want to so user some message
comment on: http://stackoverflow.com/a/23776218
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36438709
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23707026
type: Comment
has text: didn't work man! when I am scrolling lost all of the selected checkbox previously selected.

http://stackoverflow.com/comment/36392311
comment on: http://stackoverflow.com/q/23685845
score: 0
has text: If I created an array of Strings then I could probably loop through the array and write each String to the file. Then to read I could probably parse the file and put each word into the Array. Would this work?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36409990
comment on: http://stackoverflow.com/a/23686638
score: 0
type: Comment
has text: theoretically correct answer +1, but OP mentioned FileIO, there is possible issue with EDT/Concurency in Swing
type: AnswerComment

http://stackoverflow.com/comment/36367567
has text: @nikis yup, you are absolutely right
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23673237
score: 0

http://stackoverflow.com/q/23769632
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23769724
has comment: http://stackoverflow.com/comment/36552399
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23769834
score: -1
answer count: 2
has title: Program that draws bars from a random array, then selection sorts it in real time with a timer
upvote count: 0
tagged with: user-interface
tagged with: arrays
has body: I am trying to write a program that graphically displays a selection sort. It needs to sort bars of various heights, and the bars heights are generated from an array of random integers. The program needs to show the bars swapping as they are being sorted, I am having trouble getting the bars to draw, it needs to look like a bar graph. Here is my code thus far (not counting my boiler plate): import java.util.*; import java.awt.event.*; import javax.swing.*; import javax.swing.Timer; import java.awt.*; import java.util.Random; public class SelectionSortPanel extends JPanel { private static final int DELAY = 20; private int[] RandArray = new int[20]; Timer timer = new Timer(DELAY, new BarListener()); public SelectionSortPanel() { Random gen = new Random(); //int[] RandArray = new int[20]; for( int index =0; index&lt;RandArray.length; index++) { RandArray[index] = gen.nextInt(30)+10; } setPreferredSize(new Dimension(400,400)); } public void paintComponent(Graphics page) { setBackground(Color.black); setPreferredSize(new Dimension(600,400)); //time.start(); super.paintComponent(page); for(int i = 0; i &lt; RandArray.length; i++) { page.setColor(Color.red); page.fillRect(i * 10, 250, 8, -RandArray[i]); timer.start(); } } private class BarListener implements ActionListener { public void actionPerformed (ActionEvent event) { int min; int temp; for ( int index = 0; index &lt; RandArray. length- 1; index++) { min = index; for ( int scan = index+ 1;scan &lt; RandArray. length; scan++) if (RandArray[index]&gt;RandArray[scan]) min = scan; // Swap the values temp = RandArray[min]; RandArray[min] = RandArray[ index]; RandArray[index] = temp; repaint(); } } } } it will compile but when it is ran nothing happens. any help is appreciated.
favorite count: 0
tagged with: timer
tagged with: selection-sort

http://stackoverflow.com/a/23618624
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23618578
downvote count: 0
type: AcceptedAnswer
has body: Your constructor zad2 is creating another instance of zad2 here: testMethodbt.invoke(new zad2(), "1"); That will call the same constructor on another instance, which will create its own new zad2(), and so on, and this will continue until the stack overflows. If you meant to invoke the method on the current instance, pass this instead of a new zad2. This applies also to the earlier line in the constructor: testMethod.invoke(new zad2(), 10, 10); Of course it raises the question of why reflection is needed, when a straight method call would suffice here.
accepted answer of: http://stackoverflow.com/q/23618578

http://stackoverflow.com/q/23731110
possible better answer: http://stackoverflow.com/a/23731291
score: 0
has answer: http://stackoverflow.com/a/23731291
tagged with: java
accepted answer: http://stackoverflow.com/a/23731298
tagged with: servlets
type: Question
has body: I have a horizontal navigation menu in a JSP page and a submit button . I want to send the selected value from the navigation menu to a servlet . How to do that and how to get that value in the corresponding servlet ? The problem is in my solution the form is not being submitted that is the servlet displaying the value in HTML is not loading . Welcome Welcome Home Products Clothing T-Shirts Polo V-Neck Henley Shirts Half-Sleeve Full-Sleeve Jeans Trousers Shoes Sports-Shoes Formal-Shoes Accessories Contact Us
has comment: http://stackoverflow.com/comment/36478338
tagged with: jsp
has comment: http://stackoverflow.com/comment/36478285
answer count: 2
has title: How to send across a parameter from a jsp page to a servlet?
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23731298
duplicate of: http://stackoverflow.com/q/1407076
has comment: http://stackoverflow.com/comment/36478309
linked to: http://stackoverflow.com/q/23713329
has comment: http://stackoverflow.com/comment/36478862
has comment: http://stackoverflow.com/comment/36478436
type: AnsweredQuestion

http://stackoverflow.com/comment/36304027
comment on: http://stackoverflow.com/q/23640513
score: 0
type: Comment
has text: That is weird. Can you give us a hello world example that fails for you? Also, try rebuilding the index.
type: QuestionComment

http://stackoverflow.com/q/23662675
has body: I know this question has been asked and answered several times before but the solution doesn't seem to work in my WebApp. This servlet handles a JSP page on which users can (fictively) buy credits. In the get-method, the servlet requests the current credits of the user from the database to show them on the JSP page. Then the user can choose the amount of credits he wants to buy. The post method checks which value the user has chosen and updates the value in the database for that user. After buying new credits, it looks for the user like his credits are not updated because the browser (Google Chrome) caches an old version of the page. Only after a while the user can see his updated credits. This is my servlet: &lt;!-- language: lang-java --&gt; package Controller.Servlets; import Controller.ListenerHelper; import Model.Listener; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author Jens */ public class CreditServlet extends HttpServlet { private Listener listener; private int credits; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); ListenerHelper listenerHelper = new ListenerHelper(); listener = (Listener) session.getAttribute("Listener"); credits = listener.getCredits(); request.setAttribute("credits", credits); request.getRequestDispatcher("/listener/credits.jsp").forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); listener = (Listener) session.getAttribute("Listener"); String choice = request.getParameter("plan"); ListenerHelper listenerHelper = new ListenerHelper(); int creditsToAdd=0; switch (cho…
tagged with: servlets
linked to: http://stackoverflow.com/q/49547
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36347962
has title: Disable browser caching in servlet
has answer: http://stackoverflow.com/a/23662794
tagged with: jsp
has answer: http://stackoverflow.com/a/23662768
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/23698134
type: Question
has body: Recently I fixed a bug in Tomcat Shutdown. It was due to some thread hanging there when Tomcat try to shutdown itself. What I did was something similar to this: https://github.com/craigmingtaozhang/RxJava/blob/master/rxjava-core/src/main/java/rx/schedulers/EventLoopsScheduler.java public Thread newThread(Runnable r) { Thread t = new Thread(r, "RxComputationThreadPool-" + counter.incrementAndGet()); t.setDaemon(true); return t; } I found similar issue in other context: https://issues.apache.org/jira/browse/KAFKA-1305?jql=project%20%3D%20KAFKA%20AND%20resolution%20%3D%20Unresolved%20AND%20priority%20%3D%20Blocker%20ORDER%20BY%20key%20DESC Could anyone help to explain the pros and cons of using setDaemon?
tagged with: tomcat
score: 0
answer count: 1
has title: Thread setDameon(true) hanging Tomcat Shutdown
accepted answer: http://stackoverflow.com/a/23698217
tagged with: multithreading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23698217
tagged with: java

http://stackoverflow.com/q/23745437
type: Question
tagged with: if-modified-since
score: 0
answer count: 1
has body: I'm trying to control the caching of resources from my server and I have verified that putting the following headers on my HTTP responses causes the browser to cache resources as expected. Cache-Control: must-revalidate, max-age=30 Last-Modified: Mon May 19 11:21:05 GMT 2014 Expires: Mon May 19 11:51:05 GMT 2014 When the resource in the browser cache has expired the next GET on that resource from that particular client contains then a "If-Modified-Since" header is added to the GET request which makes it to the origin server. Especially in a Java webapp context what is a good way to handle the determination of whether the resource has changed on the server-side when it gets these conditional GET requests so it can decide whether to return a 304 Not Modified or 200 OK response? I have a few ideas but they are all custom solutions that seem like re-inventing the wheel to me: Just have some custom query that checks the resource last modified date. (This is the most obvious way to do it) Have a cache on the server that is independently kept in-sync with the resource update state so that the server can do a very quick check for resource modification, perhaps using a DB table listener from Spring Framework (this would be more efficient than having to do a query for each client each time, however, it is more complex to implement)
type: UnansweredQuestion
has title: What is a good way to handle a conditional HTTP GET request from the server-side? That is, a GET request containing "If-Modified-Since" header?
tagged with: java
has answer: http://stackoverflow.com/a/23745545
tagged with: caching
tagged with: http

multithreading
tags question: http://stackoverflow.com/q/23743933
tags question: http://stackoverflow.com/q/23768355
tags question: http://stackoverflow.com/q/23747294
tags question: http://stackoverflow.com/q/23773605
tags question: http://stackoverflow.com/q/23622359
tags question: http://stackoverflow.com/q/23759027
tags question: http://stackoverflow.com/q/23673426
tags question: http://stackoverflow.com/q/23635857
tags question: http://stackoverflow.com/q/23677790
tags question: http://stackoverflow.com/q/23727410
tags question: http://stackoverflow.com/q/23742092
type: Tag
tags question: http://stackoverflow.com/q/23743529
tags question: http://stackoverflow.com/q/23730207
tags question: http://stackoverflow.com/q/23736059
tags question: http://stackoverflow.com/q/23772171
tags question: http://stackoverflow.com/q/23630597
tags question: http://stackoverflow.com/q/23643604
tags question: http://stackoverflow.com/q/23639471
tags question: http://stackoverflow.com/q/23679932
tags question: http://stackoverflow.com/q/23660038
tags question: http://stackoverflow.com/q/23691727
tags question: http://stackoverflow.com/q/23619540
tags question: http://stackoverflow.com/q/23746851
tags question: http://stackoverflow.com/q/23652017
tags question: http://stackoverflow.com/q/23710744
tags question: http://stackoverflow.com/q/23775370
tags question: http://stackoverflow.com/q/23660327
tags question: http://stackoverflow.com/q/23648091
tags question: http://stackoverflow.com/q/23681290
tags question: http://stackoverflow.com/q/23774102
tags question: http://stackoverflow.com/q/23686133
tags question: http://stackoverflow.com/q/23617590
tags question: http://stackoverflow.com/q/23626686
tags question: http://stackoverflow.com/q/23685490
tags question: http://stackoverflow.com/q/23766615
tags question: http://stackoverflow.com/q/23628512
tags question: http://stackoverflow.com/q/23698134
tags question: http://stackoverflow.com/q/23664644
tags question: http://stackoverflow.com/q/23767679
tags question: http://stackoverflow.com/q/23722040
tags question: http://stackoverflow.com/q/23704667
tags question: http://stackoverflow.com/q/23651280
tags question: http://stackoverflow.com/q/23644891
tags question: http://stackoverflow.com/q/23748583
tags question: http://stackoverflow.com/q/23689463
tags question: http://stackoverflow.com/q/23772701
tags question: http://stackoverflow.com/q/23722770
tags question: http://stackoverflow.com/q/23771124
tags question: http://stackoverflow.com/q/23746424
tags question: http://stackoverflow.com/q/23715651
tags question: http://stackoverflow.com/q/23627077
tags question: http://stackoverflow.com/q/23664668
tags question: http://stackoverflow.com/q/23707808
tags question: http://stackoverflow.com/q/23746888
tags question: http://stackoverflow.com/q/23772951
tags question: http://stackoverflow.com/q/23721778
tags question: http://stackoverflow.com/q/23671890
tags question: http://stackoverflow.com/q/23717899
tags question: http://stackoverflow.com/q/23640858
tags question: http://stackoverflow.com/q/23699341
tags question: http://stackoverflow.com/q/23683801
tags question: http://stackoverflow.com/q/23724249
tags question: http://stackoverflow.com/q/23758637
tags question: http://stackoverflow.com/q/23719849
tags question: http://stackoverflow.com/q/23768116
tags question: http://stackoverflow.com/q/23763344
tags question: http://stackoverflow.com/q/23755149
tags question: http://stackoverflow.com/q/23672539
tags question: http://stackoverflow.com/q/23764787
tags question: http://stackoverflow.com/q/23642582
tags question: http://stackoverflow.com/q/23658726
tags question: http://stackoverflow.com/q/23720859
tags question: http://stackoverflow.com/q/23771010
tags question: http://stackoverflow.com/q/23731506
tags question: http://stackoverflow.com/q/23769411
tags question: http://stackoverflow.com/q/23689137
tags question: http://stackoverflow.com/q/23658799
tags question: http://stackoverflow.com/q/23629663
tags question: http://stackoverflow.com/q/23666972

http://stackoverflow.com/q/23723070
tagged with: titlebar
upvote count: 2
tagged with: jframe
has answer: http://stackoverflow.com/a/23723218
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36462498
downvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23723218
has title: How to show current date on a jframe title bar?
possible better answer: http://stackoverflow.com/a/23724778
has answer: http://stackoverflow.com/a/23724778
has comment: http://stackoverflow.com/comment/36462751
has comment: http://stackoverflow.com/comment/36462649
has body: I searched for the solution but couldn't find one. I want to show the current date on my jframe title bar. I know how to get current date using java but I need to show it on the title bar. Can anyone help me regarding this ? Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/36462589

soa
type: Tag
tags question: http://stackoverflow.com/q/23663851
tag name: soa
tags question: http://stackoverflow.com/q/23748101

http://stackoverflow.com/a/23676508
answers question: http://stackoverflow.com/q/23676380
score: 0
type: Answer
has body: You could use HashMap&lt;String, Integer&gt; to store words and frequencies where key is a word and value is frequency of the word.

http://stackoverflow.com/q/23775535
has comment: http://stackoverflow.com/comment/36562515
has title: What is bug in jdk6 compiler due to which hibernate ORM require JDK 7 compiler or plus?
tagged with: java
tagged with: hibernate
type: Question
score: 3
tagged with: java-7
downvote count: 0
favorite count: 0
tagged with: java-6
has body: Under System Requirements section in documentation of Hibernate ORM 4+ it is officially mentioned that building Hibernate from source requires JDK 7 due to a bug in the JDK 6 compiler I am looking for bug which doesnt make Hibernate compatible with jdk6 compiler. Hibernate Documentation
has comment: http://stackoverflow.com/comment/36562632
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: orm

http://stackoverflow.com/comment/36465201
type: AnswerComment
has text: I changed that in commit 4e5451b, it still doesn't instantiate the Dao class.
type: Comment
comment on: http://stackoverflow.com/a/23724389
score: 0

http://stackoverflow.com/comment/36256757
type: QuestionComment
has text: Theres no need to sort the array yourself, just use Arrays.sort.
comment on: http://stackoverflow.com/q/23616227
score: 0
type: Comment

http://stackoverflow.com/q/23724312
has answer: http://stackoverflow.com/a/23724338
tagged with: java
type: Question
has title: while loop with if nested inside it
has answer: http://stackoverflow.com/a/23724367
accepted answer: http://stackoverflow.com/a/23724338
score: 0
has comment: http://stackoverflow.com/comment/36464874
answer count: 3
possible better answer: http://stackoverflow.com/a/23724344
has answer: http://stackoverflow.com/a/23724344
has comment: http://stackoverflow.com/comment/36464881
has body: this question might be simple for many of you but im stuck in it:/ this if condition works without while around it, but when i put while i get nothing in log this REresponse is a response coming from server with a particular id that client sent to it plus a T or F as result to make sure the only client recieves it is the one who sent it boolean recieved = false String REresponse = (String) sInput.readObject(); while(recieved=false) { if (REresponse.equals("('T','"+newRID+"')")){ Log.i(LOGTAG,"you made it"); recieved = true; }else if (REresponse.equals("('F','"+newRID+"')")){ Log.i(LOGTAG,"you failed"); recieved=true; }else{ Log.i(LOGTAG,REresponse); Log.i(LOGTAG,"some thing is wrong"); also i tried to use case condition but it does accpet this
type: AnsweredQuestion

http://stackoverflow.com/comment/47689525
has text: I will suggest you to read the following paper "M4: A VisualizationOriented Time Series Data Aggregation" it may give you some alternatives, It describes a method for losseles (in terms of presented visuallization) data-point reduction. This is done while you are retrieving the data with an sql query.
type: QuestionComment
comment on: http://stackoverflow.com/q/23664334
score: 0
type: Comment

http://stackoverflow.com/comment/36424655
comment on: http://stackoverflow.com/a/23702867
type: Comment
has text: And how can the activity have a context but not the application?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23742709
answers question: http://stackoverflow.com/q/23741996
has body: Make sure MSCategoryDetailsBO is public class and contains valid getter/setter for all the properties/members that is needed in JSP. JSTL uses reflection so that you can access the properties of an object via dot notation, if they follow the JavaBean naming-convention. Its clear from the Exception itself that the property that you are trying to access are not have a matching getter method. PropertyNotFoundException: Property 'categoryIsSelected' not found on type Class MSCategoryDetailsBO should look like: public class MSCategoryDetailsBO { private boolean categoryIsSelected; private String categoryName; public void setCategoryIsSelected(boolean categoryIsSelected) { this.categoryIsSelected = categoryIsSelected; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public boolean getCategoryIsSelected() { return this.categoryIsSelected; } public String getCategoryName() { return this.categoryName; } } Please validate below condition again that means you want to show the categoryName if categoryIsSelected is false or empty. &lt;c:if test=&quot;${(item2.categoryIsSelected eq false) || (empty item2.categoryIsSelected)}&quot;&gt; ${item2.categoryName} &lt;/c:if&gt;
type: Answer
score: 0

http://stackoverflow.com/a/23720345
type: Answer
accepted answer of: http://stackoverflow.com/q/23719849
answers question: http://stackoverflow.com/q/23719849
has body: I think you pass the same label to the main clock as to one of the others: relogioBranco = new Relogio(relogioBrancoLabel); relogioPreto = new Relogio(relogioPretoLabel); relogioGeral= new RelogioGeral(relogioPretoLabel,menu); Shouldn't it have its own label? I think this problem has nothing to do with concurrency. You will only get concurrency problems if two threads are working one resource (e.g. thread a and thread b are both reading the same field). This is not the case here. Every thread works on his own variables/objects.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/23764964

http://stackoverflow.com/q/23662414
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36353805
type: Question
has comment: http://stackoverflow.com/comment/36377623
has comment: http://stackoverflow.com/comment/36377530
has comment: http://stackoverflow.com/comment/36351491
has comment: http://stackoverflow.com/comment/36352441
has comment: http://stackoverflow.com/comment/36385557
score: 0
has comment: http://stackoverflow.com/comment/36395306
has title: Client Socket - Keep Socket Open Indefinitely
has comment: http://stackoverflow.com/comment/36352876
has body: I am working on my first Java/Android sockets app that will act as a send/receive socket client. I have an existing app (server) that communicates using xml via sockets. This server can send out information to connected clients at any time so I must keep the socket open indefinitely once it has been created. The code below seems to be partially correct as I can send and receive direct responses however, I am unable to receive unsolicited messages? public void Connect(String ip, int port) { try { InetAddress inetAddress = InetAddress.getByName(ip); Socket socket = new Socket(inetAddress, port); mConnected = true; try { mOutputStream = socket.getOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(1024); byte[] buffer = new byte[1024]; int bytesRead; InputStream inputStream = socket.getInputStream(); new Thread(new NetworkConnectHandler()).start(); while (socket.isConnected()) { while ((bytesRead = inputStream.read(buffer)) != -1) { mReceivedPacket = null; byteArrayOutputStream.write(buffer, 0, bytesRead); mReceivedPacket = byteArrayOutputStream.toString("UTF-8"); if (mReceivedPacket.indexOf(STX) &gt; -1 &amp;&amp; mReceivedPacket.indexOf(ETX) &gt; -1) { break; } } byteArrayOutputStream.reset(); if (mReceivedPacket != null) { IncomingPacketHandler(XmlFromString(CleanIncomingPacket(mReceivedPacket))); } } } catch (Exception ex) { Log.e("Network Connect", "S: Error", ex); } } catch (Exception ex) { Log.e("Network Connect", "C: Error", ex); } } public class NetworkConnectHandler implements Runnable { @Override public void run() { ConnectHandler(); } } protected void ConnectHandler() { Log.e("ConnectHandler", "Connected"); SendDoc(CreateIDPacket()); } SendDoc sends an initial message to the server on the same socket that is created in the Connect method. All sent messages will receive a response from the server. In this case, the message is sent and the response is received.
has comment: http://stackoverflow.com/comment/36392349
has comment: http://stackoverflow.com/comment/36381583
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/36384384
has comment: http://stackoverflow.com/comment/36381032
has comment: http://stackoverflow.com/comment/36389488

http://stackoverflow.com/q/23672539
accepted answer: http://stackoverflow.com/a/23683007
tagged with: android
has comment: http://stackoverflow.com/comment/36366338
tagged with: time
tagged with: multithreading
type: AnsweredQuestion
has title: Best way to call method every 2 hours in android?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36366626
type: Question
possible better answer: http://stackoverflow.com/a/23672810
answer count: 2
has body: i saw this approach : TimerTask timerTask = new TimerTask() { @Override public void run() { MyMethod(); } }; Timer timer = new Timer(true); timer.schedule(timerTask, 0, 7200000); 1 . is this the best approach ? 2 . how can i make sure this method wont "die" ? note : i don't need this method to work on background if the application is closed so no need to do service or something like this .
has answer: http://stackoverflow.com/a/23672810
tagged with: delay
has answer: http://stackoverflow.com/a/23683007
has comment: http://stackoverflow.com/comment/36366575

http://stackoverflow.com/a/59857927
upvote count: 1
downvote count: 0
has body: I had a situation, where I was suppose to get distinct elements from list based on 2 keys. If you want distinct based on two keys or may composite key, try this: class Person{ int rollno; String name; } List&lt;Person&gt; personList; Function&lt;Person, List&lt;Object&gt;&gt; compositeKey = personList-&gt; Arrays.&lt;Object&gt;asList(personList.getName(), personList.getRollno()); Map&lt;Object, List&lt;Person&gt;&gt; map = personList.stream().collect(Collectors.groupingBy(compositeKey, Collectors.toList())); List&lt;Object&gt; duplicateEntrys = map.entrySet().stream() .filter(settingMap -&gt; settingMap.getValue().size() &gt; 1) .collect(Collectors.toList());
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23699371

sensors
type: Tag
tags question: http://stackoverflow.com/q/23700589
tags question: http://stackoverflow.com/q/23689463
tag name: sensors

binary-tree
tags question: http://stackoverflow.com/q/23718297
tag name: binary-tree
tags question: http://stackoverflow.com/q/23757131
type: Tag
tags question: http://stackoverflow.com/q/23620499
tags question: http://stackoverflow.com/q/23717775

http://stackoverflow.com/comment/36305878
score: 2
has text: Hi im atm on phone so can't check stuff out till tomorrow but thanks for your lightning fast answer. I also tried to add http:// with if(!parts[i].startsWith("http:"))parts[i]="http:" + parts[i] ; with the same error
type: Comment
comment on: http://stackoverflow.com/a/23640987
type: AnswerComment

http://stackoverflow.com/a/23757543
has comment: http://stackoverflow.com/comment/36528103
answers question: http://stackoverflow.com/q/23757441
has comment: http://stackoverflow.com/comment/36528339
score: 0
has body: You can do String.valueOf(spinner1.getSelectedItem()) which will get the current selected String in the Spinner
has comment: http://stackoverflow.com/comment/36528244
type: Answer

http://stackoverflow.com/comment/36502556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23743747
has text: This guy has the same error. I don't know if the suggested solution helps thought. http://androiddev.orkitra.com/?p=124868
score: 0

http://stackoverflow.com/q/23725604
has comment: http://stackoverflow.com/comment/36467464
upvote count: 0
has answer: http://stackoverflow.com/a/23725656
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36467499
tagged with: android
tagged with: android-asynctask
has title: AsyncTask doesn't return value of boolean as expected
accepted answer: http://stackoverflow.com/a/23725656
downvote count: 1
type: AnsweredQuestion
has body: to be honest for me AsyncTask is most bothering method EVER,i never get used to what it does, this is my AsyncTask code: public class myAsync extends AsyncTask&lt;String, Boolean, Boolean&gt;{ boolean thisisresult=false; @Override protected Boolean doInBackground(String...urls){ try { socket = new Socket(server, port); } catch(Exception ec) { Log.i(LOGTAG,"Error connectiong to server:" + ec); return false; } String msg = "Connection accepted " + socket.getInetAddress() + ":" + socket.getPort(); Log.i(LOGTAG, msg); try { sInput = new ObjectInputStream(socket.getInputStream()); sOutput = new ObjectOutputStream(socket.getOutputStream()); } catch (IOException eIO) { Log.i(LOGTAG,"Exception creating new Input/output Streams: " + eIO); return false; } try { EditText u=(EditText)findViewById(R.id.inputuser); theuser = u.getText().toString(); EditText p =(EditText)findViewById(R.id.inputpassword); thepass = p.getText().toString(); EditText n =(EditText)findViewById(R.id.realname); thename = n.getText().toString(); EditText m =(EditText)findViewById(R.id.inputmail); themail = m.getText().toString(); EditText ph = (EditText)findViewById(R.id.inputphone); thephone = ph.getText().toString(); int RID=RandomNumbers.Rgenerate(); String newRID = Integer.toString(RID); sOutput.writeObject(theuser); sOutput.writeObject(thepass); sOutput.writeObject(thename); sOutput.writeObject(themail); sOutput.writeObject(thephone); sOutput.writeObject(newRID); sOutput.flush(); Log.i(LOGTAG,"this"+theuser + thepass + thephone + themail + thename+ newRID); String REresponse = (String) sInput.readObject(); while(recieved==false) { if (REresponse.equals("('T','"+newRID+"')")){ Log.i(LOGTAG,"you made it"); // showthis=("اکانت با موفقیت ساخته شد"); recieved = true; thisisresult=true; }else if (REresponse.equals("('F','"+newRID+"')")){ Log.i(LOGTAG,"you failed"); // showthis=("username تکراری است"); recieved=true; thisisresult=true; }else{ // showthis=("جوابی از سرور دریافت نشد"); Log.i(LOGTAG,REresponse…
has comment: http://stackoverflow.com/comment/36467466
tagged with: java
has comment: http://stackoverflow.com/comment/36467452
score: -1
type: Question

http://stackoverflow.com/a/35919751
downvote count: 1
has body: None of the suggestions worked for me until I ran the command "gradle cleanIdeaModule ideaModule" info here: https://docs.gradle.org/current/userguide/idea_plugin.html
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23688702

http://stackoverflow.com/a/23651550
has body: public int foo(int i) { if(i &gt; 0) System.out.println("i: " + foo(i - 1)); return i; } When i &lt; 1, the loop is terminated and i is returned. However when i = 2, the code calls like this in the heap: foo(2) { System.out.println("i: " + foo(1){ System.out.println("i: " + foo(0){ // Condition for "if" failed here and does not continue. return 0; // Prints: i: 0 }); return 1; // Prints: i: 1 }); return 2; // Returns 2 as foo(2). } Interior recursive returns are used to print, but only 2 is returned at the end.
has comment: http://stackoverflow.com/comment/36326119
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36325915
type: Answer
answers question: http://stackoverflow.com/q/23651180
has comment: http://stackoverflow.com/comment/36326173
upvote count: 1

http://stackoverflow.com/q/23631868
has answer: http://stackoverflow.com/a/23647688
answer count: 2
has comment: http://stackoverflow.com/comment/36291794
has comment: http://stackoverflow.com/comment/36286994
downvote count: 0
has comment: http://stackoverflow.com/comment/36289489
favorite count: 0
has comment: http://stackoverflow.com/comment/36316522
tagged with: rest
possible better answer: http://stackoverflow.com/a/23633032
tagged with: spring
has comment: http://stackoverflow.com/comment/36316625
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36315981
has comment: http://stackoverflow.com/comment/36317268
tagged with: spring-4
has comment: http://stackoverflow.com/comment/36286630
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23647688
upvote count: 10
has comment: http://stackoverflow.com/comment/36316493
type: Question
has comment: http://stackoverflow.com/comment/36286829
has comment: http://stackoverflow.com/comment/36317879
has title: Spring 4 and Rest WS integration
has answer: http://stackoverflow.com/a/23633032
has body: I have been doing a poc on Spring4 and RestWS integration. I am new to both with barely a weeks exposure. I am following instructions from blogs. I understand that in Spring 4 and restWS setup jackson-core/anotation/databind 2 is to be used for correct message converstion of JSON &lt;-> Java object to happen. Also org.springframework.http.converter.json.MappingJackson2HttpMessageConverter is to be used for message conversion. I satisfied all these requirements. However when I try to start application, I get bean create exception. stack SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'regionController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.servlet.View com.leggmason.lmpamfs.controllers.RegionController.jsonView_i; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.json.MappingJacksonJsonView#0' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.servlet.view.json.MappingJacksonJsonView]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(…
score: 10

http://stackoverflow.com/comment/36547284
type: QuestionComment
has text: @Ordous, I have added some code to reproduce it.
comment on: http://stackoverflow.com/q/23765990
score: 0
type: Comment

http://stackoverflow.com/q/23655606
linked to: http://stackoverflow.com/q/20398289
tagged with: console
has title: java console window not appearing
favorite count: 0
has answer: http://stackoverflow.com/a/34233061
has answer: http://stackoverflow.com/a/23685233
has comment: http://stackoverflow.com/comment/54562722
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36333634
has comment: http://stackoverflow.com/comment/36333261
tagged with: windows-8
has body: When starting a Java program e.g. Java -cp path/to/ main.class my application starts, but I don't get a console in Win 8.1. I have set the Java console Switch to show console as Admin. But the console still doesn't show up.
tagged with: java
type: Question
answer count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/23679396
answers question: http://stackoverflow.com/q/23678198
score: 0
type: Answer
has body: // Try this way,hope this will you to solve your problem... String respone = "{\"id\":1,\"jsonrpc\":\"2.0\",\"result\":{\"albums\":[{\"albumid\":1,\"albumlabel\":\"\",\"artist\":[\"www.SongsLover.pk\"],\"artistid\":[2],\"description\":\"\",\"genre\":[\"Pop\"],\"label\":\"Single 2012\",\"rating\":0,\"style\":[\"\"],\"thumbnail\":\"image://music@smb%3a%2f%2fCECOTS-NAS%2fMedia%2fMusic%2fbackup%20Music%2fSissle2%2fGangnam%20Style%20.mp3/\",\"title\":\"Single 2012\",\"type\":\"\",\"year\":0},{\"albumid\":164,\"albumlabel\":\"\",\"artist\":[\"ARrahman\",\"MJ\"],\"artistid\":[146,163],\"description\":\"\",\"genre\":[\"Soundtrack\"],\"label\":\"Lord of the rings\",\"rating\":0,\"style\":[\"\"],\"thumbnail\":\"image://music@smb%3a%2f%2fCECOTS-NAS%2fMedia%2fMusic%2fExtras_Test%2fEnakkena%20Yenave.mp3/\",\"title\":\"Lord of the rings\",\"type\":\"\",\"year\":2000}],\"limits\":{\"end\":155,\"start\":0,\"total\":155}}}"; ArrayList&lt;HashMap&lt;String,Object&gt;&gt; albumList = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); try{ JSONObject responseJson = new JSONObject(respone); JSONArray albumJsonArray = responseJson.getJSONObject("result").getJSONArray("albums"); for (int i=0;i&lt;albumJsonArray.length();i++){ HashMap&lt;String,Object&gt; album = new HashMap&lt;String, Object&gt;(); album.put("albumid",albumJsonArray.getJSONObject(i).getString("albumid")); album.put("albumlabel",albumJsonArray.getJSONObject(i).getString("albumlabel")); JSONArray artistJsonArray = new JSONArray(albumJsonArray.getJSONObject(i).getString("artist")); ArrayList&lt;String&gt; artistList = new ArrayList&lt;String&gt;(); for (int j=0;j&lt;artistJsonArray.length();j++){ artistList.add(artistJsonArray.getString(j)); } album.put("artist",artistList); JSONArray artistidJsonArray = new JSONArray(albumJsonArray.getJSONObject(i).getString("artistid")); ArrayList&lt;String&gt; artistidList = new ArrayList&lt;String&gt;(); for (int j=0;j&lt;artistidJsonArray.length();j++){ artistidList.add(artistidJsonA…

http://stackoverflow.com/q/23737579
has comment: http://stackoverflow.com/comment/75082034
has comment: http://stackoverflow.com/comment/36494226
favorite count: 0
tagged with: sql-server
tagged with: sql
tagged with: netbeans
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36504923
has answer: http://stackoverflow.com/a/34406446
has title: NetBeans + Microsoft SQL Server 2012 jbdc drivers
type: Question
has comment: http://stackoverflow.com/comment/36496005
has body: I am trying to resolve problem: "java.lang.ClassNotFoundException: com.microsoft.sqlserver.jbdc.SQLServerDriver" Actually what is my problem..whether is it a class path error or program error or by missing of library files. //below is my code package projektsql; /** *C:\ProgramFiles\MicrosoftJDBCDriver4.0forSQLServer\sqljdbc_4.0\enu\sqljdbc4 * @author m4rtin77 * intergratedSecurity=true; */ import java.sql.*; import javax.swing.*; public class ProjektSQL { Connection conn = null; public static Connection ConnectDB(){ try{ Class.forName("com.microsoft.sqlserver.jbdc.SQLServerDriver"); String connstring = "jdbc:sqlserver://localhost:1433;databaseName=JavaSQLProjekt;intergratedSecurity=true;"; Connection conn = DriverManager.getConnection(connstring); JOptionPane.showMessageDialog(null, "Polaczono:"); return conn; }catch(Exception e){ e.printStackTrace(); return null; } } } And one method in Jframe: private void formWindowOpened(java.awt.event.WindowEvent evt) { conn = ProjektSQL.ConnectDB(); I really dont know what is gonna out there.
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/36410179
has text: No, I get the same compile error.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23695375
type: QuestionComment

http://stackoverflow.com/comment/36258238
type: QuestionComment
has text: Related reading (if you're on Java 7): http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23616889

http://stackoverflow.com/a/23714531
has comment: http://stackoverflow.com/comment/36445800
has comment: http://stackoverflow.com/comment/36445758
has comment: http://stackoverflow.com/comment/36447102
score: 0
answers question: http://stackoverflow.com/q/23714411
has comment: http://stackoverflow.com/comment/36445811
has comment: http://stackoverflow.com/comment/36445931
has comment: http://stackoverflow.com/comment/36446171
has body: It might sound weird, but you can cast the return value of your getName() method to Object: System.out.printf("Your first girlfriend was %s\n", (Object) getName()); Or (to create the requested array) even System.out.printf("Your first girlfriend was %s\n", new Object[] {(Object) getName()} ); could help.
has comment: http://stackoverflow.com/comment/36445841
type: Answer

http://stackoverflow.com/comment/36378475
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23678937
has text: yes - and maybe add that `putInt` automatically increments the position
score: 3

synchronization
tags question: http://stackoverflow.com/q/23724379
tags question: http://stackoverflow.com/q/23632761
tags question: http://stackoverflow.com/q/23683801
tags question: http://stackoverflow.com/q/23629663
tags question: http://stackoverflow.com/q/23703709
tags question: http://stackoverflow.com/q/23633490
tags question: http://stackoverflow.com/q/23764521
tags question: http://stackoverflow.com/q/23762876
tag name: synchronization
tags question: http://stackoverflow.com/q/23688580
type: Tag
tags question: http://stackoverflow.com/q/23642734
tags question: http://stackoverflow.com/q/23724472
tags question: http://stackoverflow.com/q/23746851
tags question: http://stackoverflow.com/q/23628320
tags question: http://stackoverflow.com/q/23689642

http://stackoverflow.com/comment/36580926
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23769407
has text: @djb Im curious if it is possible for me to pass an .XML file to another server. Or if I'm off track.
score: 0

http://stackoverflow.com/comment/36538502
type: QuestionComment
has text: I think ["Multiple Versions of the same ..."](http://stackoverflow.com/questions/6105124/java-classpath-classloading-multiple-versions-of-the-same-jar-project) describes your problem. ["Handling multiple versions of the same class"](http://java.dzone.com/articles/java-classloader-handling) explains some solutions. One solution not mentioned is to force a parent classloader to load the class first, so the two different classloaders will not load it, but instead use the parent's.
score: 1
comment on: http://stackoverflow.com/q/23760981
type: Comment

http://stackoverflow.com/q/23712047
has title: codenameone List Hortizontal scrolling
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23713796
type: Question
score: 0
answer count: 1
has body: How can I implement a horizontal scroll bar in a list in codenameone? There seems to be no scrollpane? I have tried some other ways around but it seems like I'll really need a horizontal scroll in the list. Any ideas? Thanks!
tagged with: codenameone
accepted answer: http://stackoverflow.com/a/23713796

http://stackoverflow.com/comment/36263727
comment on: http://stackoverflow.com/q/23619700
has text: Why do you want to make it shorter? Anything shorter and the purpose of your code may become unclear.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23619552
has comment: http://stackoverflow.com/comment/36295252
has comment: http://stackoverflow.com/comment/36303960
type: Question
has title: List selection listener does not display until panel is selected
tagged with: jsplitpane
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36303829
has comment: http://stackoverflow.com/comment/36295708
tagged with: java
has comment: http://stackoverflow.com/comment/36303914
has comment: http://stackoverflow.com/comment/36305736
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36263705
score: 0
has comment: http://stackoverflow.com/comment/36306862
has body: The following code displays a list on the left hand side and the content on the right hand side. So when an item in the list is selected it should display something on the right hand side (this uses split panes). The problems is that it does not display when an item is selected instead it displays it when you click the divider. I was wondering what is wrong with the following code that it does not automatically show the content when and item from the list is selected. Thanks in advance. Below shows the partial code on where I am having troubles with: public class FrequentQuestions implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub frame = new MyInternalFrame("Frequently Asked Questions"); String [] options = {"How to open/save images", "formats", "info"}; JList list = new JList(options); panelQuestions.add(list); list.addListSelectionListener(new ListSelectionListener(){ @Override public void valueChanged(ListSelectionEvent e) { // TODO Auto-generated method stub if(e.getValueIsAdjusting()) return; //String [] options2 = {"hello","bye"}; //JList list2 = new JList(options2); JList list = (JList) e.getSource(); if (list.isSelectionEmpty()) { System.out.println("list selection is empty!"); } else{ int index = ((JList)e.getSource()).getSelectedIndex(); if(index == 0){ readFile(); } else if(index == 1){ System.out.println("2nd item selected"); } else{ System.out.println("3rd item selected"); } } } }); scroll = new JScrollPane(panelAnswers,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panelQuestions, scroll); pane.setAutoscrolls(true); pane.setOpaque(true); panelQuestions.setMinimumSize(new Dimension(200,50)); panelQuestions.setBackground(new Color(0,0,0,0)); panelAnswers.setMinimumSize(new Dimension(100,30)); pane.setOneTouchExpandable(true); pane.setDividerLocation(250); frame.add(pane); frame.setVisible(true); desk.a…
has comment: http://stackoverflow.com/comment/36263917
has comment: http://stackoverflow.com/comment/36304547
has answer: http://stackoverflow.com/a/23640811
has comment: http://stackoverflow.com/comment/36307631
accepted answer: http://stackoverflow.com/a/23640811
has comment: http://stackoverflow.com/comment/36266976

http://stackoverflow.com/comment/36501149
comment on: http://stackoverflow.com/q/23741636
has text: Be careful. Were `s1` and `s2` declared `final` in the interview’s question? That makes a difference, as in case of `final` variables only *one* `String` is created (unless debugging information for unused variables is requested).
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36593589
has text: do you know how I can get an instance of the Configuration object that is needed in the PatternLayout constructor?
comment on: http://stackoverflow.com/a/23748924
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36485390
comment on: http://stackoverflow.com/q/23735163
has text: post `FragmentWrong.java` line 29. use `.equals` to compare strings instead of `==` . `info[2].equals("1"))`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36516231
type: Comment
has text: It is certainly an enum. I will do so, though I find it difficult placing the correct code within a question as I don't want to overload anyone.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23750838

http://stackoverflow.com/q/23692338
tagged with: htmlunit
has comment: http://stackoverflow.com/comment/36406710
has title: Why do I have java.util.EmptyStackException when using HTMLUnit to render the page via Filter?
has comment: http://stackoverflow.com/comment/36405234
has comment: http://stackoverflow.com/comment/36405538
has comment: http://stackoverflow.com/comment/36405194
type: UnansweredQuestion
has body: Ok, I have a Filter public class CrawlServlet implements Filter{ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; String requestQueryString = httpRequest.getQueryString(); if ((requestQueryString != null) &amp;&amp; (requestQueryString.contains("_escaped_fragment_"))) { String str="http://127.0.0.1:8888/Myproject.html?gwt.codesvr=127.0.0.1:9997#!article"; // this url work fine, if i open it it will show article. final WebClient webClient = new WebClient(); HtmlPage page = webClient.getPage(str); PrintWriter out = response.getWriter(); out.println(page.asXml()); } } } Ok, now i ran my app in eclipse, &amp; open the url http://127.0.0.1:8888/Myproject.html?gwt.codesvr=127.0.0.1:9997?_escaped_fragment_=article Then I got this error in eclipse .GWTUpld .gwt-Button:HOVER, .GWTUpld .DecoratedFileUpload .gwt-Button-over, .GWTUpld .DecoratedFileUpload .gwt-Anchor-over, .GWTUpld .DecoratedFileUpload .gwt-Label-over { color: #af6b29; } ...... .GWTUpld input[type="file"] { cursor: pointer; } ': null java.util.EmptyStackException at java.util.Stack.peek(Unknown Source) at java.util.Stack.pop(Unknown Source) at com.steadystate.css.parser.CSSOMParser$CSSOMHandler.endDocument(CSSOMParser.java:271) at com.steadystate.css.parser.AbstractSACParser.handleEndDocument(AbstractSACParser.java:456) at com.steadystate.css.parser.SACParserCSS3.styleSheet(SACParserCSS3.java:56) at com.steadystate.css.parser.AbstractSACParser.parseStyleSheet(AbstractSACParser.java:284) at com.steadystate.css.parser.SACParserCSS3.parseStyleSheet(SACParserCSS3.java:23) at com.steadystate.css.parser.CSSOMParser.parseStyleSheet(CSSOMParser.java:146) at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.parseCSS(CSSStyleSheet.java:818) at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.(CSSStyleSheet.java:179) at com.gargoylesoftware.ht…
answer count: 0
tagged with: java
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/36404839
has comment: http://stackoverflow.com/comment/36404797
score: 0

http://stackoverflow.com/q/23715593
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36448135
has comment: http://stackoverflow.com/comment/36447874
has answer: http://stackoverflow.com/a/23715749
has body: I'm new to java and i need some help. I got few things to do and i'm stuck with this problem. I really have no idea how to do it... So in CMD line if i enter banana banana apple apple -name Carlos banana Mike -c 8 it will print "Hello Carlos!" eight times. public class cheese { public static void main(String args[]) { for(String s: args){ if(s.equals("-name")){ String p = (GIVE VALUE OF FIRST ARGUMENT AFTER "-name"); if (s.equals("-c")){ int i = Integer.parseInt(THE FIRST ARGUMENTS AFTER "-c"); for(int j=0; j &gt;= i ; j++) System.out.println("Hello "+p+"!"); } } } } }
downvote count: 2
has comment: http://stackoverflow.com/comment/36448041
type: AnsweredQuestion
has title: Finding specific argument then adding value of next one to variable
score: -2
tagged with: java
tagged with: command-line-arguments
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23715749
has comment: http://stackoverflow.com/comment/36448205
has comment: http://stackoverflow.com/comment/36448163

http://stackoverflow.com/comment/36315652
has text: @metacubed The curl request works. I am able to use the data inside the API. I just need to know how to make the same curl request through JAVA code.
comment on: http://stackoverflow.com/q/23645878
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23772102
has answer: http://stackoverflow.com/a/68479898
possible better answer: http://stackoverflow.com/a/34206517
tagged with: java
has answer: http://stackoverflow.com/a/36519901
downvote count: 1
has answer: http://stackoverflow.com/a/40173070
score: 46
type: Question
has answer: http://stackoverflow.com/a/47215231
has body: This is a question that comes up a lot in job interviews. The idea is to define a data structure instead of using Java's built in LinkedHashMap. An LRU cache deletes the least recently used entry to insert a new one. So, given the following scenario: A - B - C - D - E Where A is the least recently used item, if we were to insert F, we need to remove A. This can be easily implemented if we keep a HashMap with the cache entries by (key,value) and a separate list that contains the elements' key and time of use. However, we would need to query the list to find the least recently used item, with a potential O(n) time complexity. How can this structure be implemented in Java for Generic objects and O(1) operations? This is different from the possible duplicate in that it focuses on efficiency (O(1) ops) and implementing the data structure itself, not extending Java's.
has answer: http://stackoverflow.com/a/62503521
has comment: http://stackoverflow.com/comment/36556625
tagged with: data-structures
has comment: http://stackoverflow.com/comment/36556604
accepted answer: http://stackoverflow.com/a/23772103
has answer: http://stackoverflow.com/a/42518890
has answer: http://stackoverflow.com/a/34206517
upvote count: 47
has comment: http://stackoverflow.com/comment/36568925
tagged with: time-complexity
has answer: http://stackoverflow.com/a/28435220
has answer: http://stackoverflow.com/a/45863666
tagged with: generics
has answer: http://stackoverflow.com/a/32696134
has answer: http://stackoverflow.com/a/38809977
has answer: http://stackoverflow.com/a/23772103
answer count: 15
favorite count: 0
has answer: http://stackoverflow.com/a/45073546
linked to: http://stackoverflow.com/q/221525
has answer: http://stackoverflow.com/a/47212318
has answer: http://stackoverflow.com/a/51611927
has title: LRU cache in Java with Generics and O(1) operations
type: AnsweredQuestion

http://stackoverflow.com/comment/36468109
score: 0
comment on: http://stackoverflow.com/q/23722359
type: Comment
type: QuestionComment
has text: Let me share you a sample code.

http://stackoverflow.com/comment/36357719
comment on: http://stackoverflow.com/q/23667748
score: 0
has text: Yeah, just a note. My program seems to want to exit but I can't seem to terminate the JFrame it self.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23638896
score: 0
has title: How to use Thread.sleep in a loop within NetBeans SWING?
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36300887
answer count: 1
has comment: http://stackoverflow.com/comment/36301432
has answer: http://stackoverflow.com/a/23638977
tagged with: netbeans
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/11700571
type: Question
tagged with: java
tagged with: sleep
has body: I am making a cosmetic SWING GUI program, in NetBeans, just for some fun with friends and it involves a loading screen that really only takes a few milliseconds but I want it to take a few seconds to finish, which is where I am trying to use the Thread.sleep() . The loading is a For-Loop and I know you have to throw InterruptedException but being that it is made with the NetBeans GUI builder you can't add it, I have tried just copy and pasted into a different project but it just comes up with errors. So my question is how I would get the Thread.sleep() to work or if there is some alternative way of causing the program to pause. Thank you Edit: Basically... How do I get a loop to pause every interval so that five loop intervals take five seconds.

http://stackoverflow.com/q/23727493
type: AnsweredQuestion
tagged with: camera
score: 1
tagged with: java
tagged with: lwjgl
has title: Creating a camera class with LWJGL
has answer: http://stackoverflow.com/a/23741900
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23741547
downvote count: 0
possible better answer: http://stackoverflow.com/a/23741900
favorite count: 0
has comment: http://stackoverflow.com/comment/36496969
has body: So i've recently started programming with LWJGL, and I have almost 2 years of Java experience. I'm having a hard time trying to get the camera to move properly (the camera is in a first person view). I want to be able to move around with the arrow keys and rotate the camera based on the mouse position. Does anybody know of a good tutorial for a camera class like this? I haven't been able to find anything close to what I need. Maybe some books as well that teach some 3D concepts?
has answer: http://stackoverflow.com/a/23741547
upvote count: 1

http://stackoverflow.com/a/23760136
has comment: http://stackoverflow.com/comment/36535344
has comment: http://stackoverflow.com/comment/36541801
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36534071
accepted answer of: http://stackoverflow.com/q/23756438
upvote count: 1
has comment: http://stackoverflow.com/comment/36565460
answers question: http://stackoverflow.com/q/23756438
has body: You could try: &lt;input t:type="TextField" t:value="result.action[indexProp]"/&gt; Not sure if tapestry is smart enough to determine getters and setters for individual list elements... probably not. If that doesn't work, you can add a getter/setter to your page so that tapestry can create an appropriate PropBinding Java @Property private int indexProp; @Property private SomeObject result; public void setCurrentAction(String action) { result.actions.set(indexProp); } public String getCurrentAction() { return result.actions.get(indexProp); } TML &lt;t:loop t:source="result.action" t:index="indexProp" t:formstate="ITERATION"&gt; &lt;input t:type="TextField" t:value="currentAction"/&gt; &lt;/t:loop&gt;
type: AcceptedAnswer
downvote count: 0

mfcc
type: Tag
tags question: http://stackoverflow.com/q/23669627
tag name: mfcc

http://stackoverflow.com/comment/36493876
type: AnswerComment
has text: Java's Garbage Collection should automatically dispose of the lightweight Swing components after they are not in use.
type: Comment
comment on: http://stackoverflow.com/a/23739618
score: 0

http://stackoverflow.com/comment/36287826
has text: You need to understand how Spring Data JPA generates the implementation for the method name. The name you have specified does not correspond with anything Spring Data JPA knows how to handle
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23630833
type: QuestionComment

http://stackoverflow.com/q/23768440
tagged with: apk
has comment: http://stackoverflow.com/comment/36549705
downvote count: 1
has title: How to package files into an APK archive programmatically
has comment: http://stackoverflow.com/comment/36549614
tagged with: java
tagged with: archive
has comment: http://stackoverflow.com/comment/36549522
has answer: http://stackoverflow.com/a/23769203
has comment: http://stackoverflow.com/comment/36549619
type: Question
has answer: http://stackoverflow.com/a/25264667
answer count: 2
has comment: http://stackoverflow.com/comment/36549898
has comment: http://stackoverflow.com/comment/36550423
has comment: http://stackoverflow.com/comment/36549793
has comment: http://stackoverflow.com/comment/36550202
score: 0
has body: I want to programmatically create an APK file from a given path to a directory(which contains Java source code). I know this can be done from the command line using android tools, but how can it done with Java code?
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/36549575
has comment: http://stackoverflow.com/comment/36549512
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/23726912
answer count: 1
score: 0
tagged with: javafx-webengine
tagged with: web
type: UnansweredQuestion
has title: How to stop WebEngine after loading for too long?
has body: I'm currently creating an automated bot to go into a certain website and do repetitive tasks. I'm using JavaFX and the WebEngine to do this. The problem is, this webpage sometimes takes a long time to load, and I don't necessarily need it to fully load. I'm using a listener for the WebEngine, so that when loading is complete it will continue with it's tasks, but like I said this is an issue when sometimes it takes a couple minutes to load. So my question is, is there some way I can stop the loading after a certain amount of time so that the listener will tell my program that loading is complete? Here is my listener: webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener&lt;Worker.State&gt;() { @Override public void changed(ObservableValue&lt;? extends Worker.State&gt; observableValue, Worker.State oldState, Worker.State newState) { if (newState == Worker.State.SUCCEEDED) { loaded = true; System.out.println("true"); start(); } } });
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23735658
type: Question

http://stackoverflow.com/q/23676537
has answer: http://stackoverflow.com/a/23676598
favorite count: 0
accepted answer: http://stackoverflow.com/a/23677077
tagged with: selenium-webdriver
tagged with: xpath
type: AnsweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/38500038
type: Question
upvote count: 33
has answer: http://stackoverflow.com/a/23677077
tagged with: java
score: 33
answer count: 3
has body: In our application almost in every screen we have a button with text 'New', Here is the html source for one of the button: New I have tried using the below statement to click on the button: driver.findElement(By.xpath("//button[[@type, 'submit'] and [text()='New']]")).click(); But this was not working org.openqa.selenium.InvalidSelectorException: The given selector //button[[@type= 'submit'] and [text()='New']] is either invalid or does not result in a WebElement. Currently I am using the below code to click on the button: List<WebElement> allButt = driver.findElements(By.tagName("button")); for (WebElement w : allButt) { if (w.getText().matches("New")) { w.click(); break; } } As I have almost 150 buttons in the page. Is there any other way?
possible better answer: http://stackoverflow.com/a/23676598
downvote count: 0
has title: Xpath for button having text as 'New'

http://stackoverflow.com/q/23616317
has title: Unauthorized BasicAuth Spring Security request after Oracle database restart
type: Question
tagged with: spring-security
has comment: http://stackoverflow.com/comment/36257640
score: 0
tagged with: oracle-database
answer count: 0
has body: I have an application using BasicAuth with Spring Security. The credentials and roles are stored in a database. For development I use MySQL, and production Oracle. The problem happens, only in production with Oracle, when the database restarts while the application is running - I start receiving org.springframework.web.client.HttpClientErrorException: 401 Unauthorized. This is my security context. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;http auto-config='true'&gt; &lt;intercept-url pattern="/v**/document/**" access="ROLE_DOCUMENT_USER" /&gt; &lt;intercept-url pattern="/v**/search/**" access="ROLE_DOCUMENT_USER" /&gt; &lt;http-basic/&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;password-encoder hash="sha-256"&gt; &lt;salt-source system-wide="#{T(com.example.app.data.entity.RestUser).SALT}"/&gt; &lt;/password-encoder&gt; &lt;jdbc-user-service data-source-ref="dataSource" users-by-username-query="select user_nm, password, enabled from rest_usr_t where user_nm = ?" authorities-by-username-query="select u.user_nm, ur.authority from rest_usr_t u, rest_authority_t ur where u.user_nm = ur.user_nm and u.user_nm = ?" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;beans:bean id="restSecurityService" class="com.example.app.security.rest.RestSecurityServiceImpl"/&gt; &lt;/beans:beans&gt; Any ideas what might be causing this, or ways to resolve it? Thanks, /w
has comment: http://stackoverflow.com/comment/36266133
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36282947
tagged with: java
has comment: http://stackoverflow.com/comment/36314905

http://stackoverflow.com/a/23752409
answers question: http://stackoverflow.com/q/23752216
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36522142
score: 1
upvote count: 1
has body: I think I found the answer myself. while setting row layout to the shell, if we just set it like this: shell.setLayout(new RowLayout()) It seems like the system sets some default values to the marginTop, marginLeft etc which is the reason while I got some unwanted spaces at the left and top of widgets. What you need to do is to set those values to 0. RowLayout rowLayout = new RowLayout(); rowLayout.wrap = false; rowLayout.pack = false; rowLayout.justify = true; rowLayout.type = SWT.VERTICAL; rowLayout.marginLeft = 0; rowLayout.marginTop = 0; rowLayout.marginRight = 0; rowLayout.marginBottom = 0; rowLayout.spacing = 0; shell.setLayout(rowLayout);
accepted answer of: http://stackoverflow.com/q/23752216

http://stackoverflow.com/q/23764628
type: Question
has answer: http://stackoverflow.com/a/23764658
score: 0
accepted answer: http://stackoverflow.com/a/23764658
answer count: 1
tagged with: android
has title: JSON - Create JSONObject with array
type: AnsweredQuestion
has body: I need to create in a Java (Android) a JSONObject/JSONArray with the exact following structure: { "listId": [ "c02bc683-fcd7-47a5-b157-853e26ed099e", "f8e1c9d7-ae45-4433-a315-726c1d912d09" ] } Can somebody help me on this please? EDIT: What i have is this: JSONArray obj = new JSONArray(); JSONObject jsonObject = new JSONObject(); jsonObject.put("listId", folderId); obj.put(jsonObject); JSONObject json = new JSONObject(); json.put("id", obj); But this produces something like: { "listId": [ {"id":"c02bc683-fcd7-47a5-b157-853e26ed099e"}, {"id":"f8e1c9d7-ae45-4433-a315-726c1d912d09"} ] } Thanks
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/23709279
upvote count: 1
answers question: http://stackoverflow.com/q/23709261
has body: Generate a random password of all letters first, then replace some of the letters with numbers/special characters as you desire. (By the way, I'm not familiar with Scala, so I'm going to use Java's syntax, as I wouldn't know whether I'm typing something valid otherwise. My apologies.) // Split source string into letters, numbers, and specials String AB = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; String numbers = "0123456789"; String specials = ":&lt;=&gt;?@_!#%&amp;()*+,-.~"; String randomPassword() { StringBuilder sb = new StringBuilder(); int len = rnd.nextInt(5) + 5; // Generate password with letters first. This part is the same as the original code. for (int i = 0; i &lt;= len; i++) { sb.append(AB.charAt(rnd.nextInt(AB.length()))); } // Generate an index to replace with a number int numberIndex = rnd.nextInt(len); // Generate an index to replace with a special character int specialIndex; do { specialIndex = rnd.nextInt(len); } while (specialIndex == numberIndex); // Replace one letter with a number sb.setCharAt(numberIndex, numbers.charAt(rnd.nextInt(numbers.length()))); // Replace one letter (or the number if you're unlucky) with a special character sb.setCharAt(specialIndex, specials.charAt(rnd.nextInt(specials.length()))); } It's a start, and has a flaw (only one number + special character), but it is easily fixable. This solution is also more efficient than generating entirely new passwords if one does not satisfy your criteria, and you're guaranteed to get a password that works when the method returns.
has comment: http://stackoverflow.com/comment/36436229
type: Answer
has comment: http://stackoverflow.com/comment/36436188
downvote count: 0
score: 1

http://stackoverflow.com/a/23749151
answers question: http://stackoverflow.com/q/23731393
score: 6
has comment: http://stackoverflow.com/comment/36518658
has body: This is a known bug in the IBM JVM: http://www-01.ibm.com/support/docview.wss?uid=swg1IZ76352 You can either upgrade to the latest IBM JVM, switch to an alternative JVM, or add jsr305 as a dependency to the surefire plugin (ie inside the plugin section, not as a dependency to the project).
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23731393

post
tags question: http://stackoverflow.com/q/23744108
tag name: post
tags question: http://stackoverflow.com/q/23742089
tags question: http://stackoverflow.com/q/23754783
type: Tag
tags question: http://stackoverflow.com/q/23760477
tags question: http://stackoverflow.com/q/23662147
tags question: http://stackoverflow.com/q/23621192
tags question: http://stackoverflow.com/q/23667967
tags question: http://stackoverflow.com/q/23672796

http://stackoverflow.com/q/23692249
upvote count: 1
has comment: http://stackoverflow.com/comment/36404541
linked to: http://stackoverflow.com/q/15998008
tagged with: java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/15998008
has comment: http://stackoverflow.com/comment/36404532
downvote count: 0
answer count: 0
linked to: http://stackoverflow.com/q/16085286
score: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/103654
has title: Why doesn't java throw overflow error when maximum value is exceeded
has body: My question here is in terms of concept. Background Donald Knuth once mentioned about a case where sometimes his merge sort failed once in a while. Later on he found out that it's due to the maximum value being exceeded while trying to find the mid-value between two integers. The code had to be changed from this: int mid = (left + right) / 2; to this: int mid = left + (right-left)/2; My question: I'm just curious why Java doesn't throw the Overflow Error instead of silently returning unexpected result. I feel that it's just semantically wrong that the program deliberately continues with the wrong outcome. One possible argument that I cant think of here is in context of bit operation. It may be too troublesome to incorporate the Overflow Error while doing the binary operations. But still I would argue that if that's the case then Java should throw the Overflow Error when an arithmetical operation such as +, -, *, / is used and ignores the Overflow Error when dealing only with binary operations such as >>, >>>, &lt;&lt;, etc. Not sure about the other programming languages, but I suspect it's quite similar. Please correct me if I'm wrong. So, any reasoning behind this? EDIT: As marked by Luiggi, this is a duplicate question. I've got my answers in the given links over there.

http://stackoverflow.com/a/23717026
accepted answer of: http://stackoverflow.com/q/23632027
answers question: http://stackoverflow.com/q/23632027
type: Answer
score: 0
has body: It may be possible, but it's forbidden by the specification. See http://www.oracle.com/technetwork/java/restrictions-142267.html for further details. You shouldn't even start a new thread from EJB or web application. For this purpose, the only allowed way is to open the server socket using JCA resource adapter. The communication with your EJB is then performed through message-driven beans. Yes, it sounds complicated. A good starting point is http://code.google.com/p/jca-sockets/ . I have implemented a CIFS server using this approach and it works perfectly. Another complication could be, that the port you are trying to bind is occupied, or the GlassFish is not allowed to bind to it. For example on Linux, only root user could bind to "privileged" ports (&lt;1024).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36530167

http://stackoverflow.com/comment/36456793
comment on: http://stackoverflow.com/a/23719969
type: AnswerComment
score: 0
type: Comment
has text: Thank you very much Jens. This helps me a lot, but tell me, what does the 2 means in "ObservationVectorReader(2)"? it means the states or the observations?

http://stackoverflow.com/a/23696684
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23695726
has body: static means, that the member is associated to the class and not to a concrete instance of the class. In your case it means, the ArrayList is member of your Globals class. To answer your question: Since you are working on the Object-References, you are directly updating the Object in your (static) ArrayList.
answers question: http://stackoverflow.com/q/23695726

http://stackoverflow.com/comment/36467683
score: 1
type: Comment
type: QuestionComment
has text: @Durdona The order of words tells you their significance. If you see `aaa bbb(ccc ddd)` you know that the method `bbb` takes an argument of type `ccc` called `ddd` and returns a value of type `aaa
comment on: http://stackoverflow.com/q/23725713

http://stackoverflow.com/a/23629269
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23624285
has comment: http://stackoverflow.com/comment/36284784
has comment: http://stackoverflow.com/comment/36284419
upvote count: 2
has comment: http://stackoverflow.com/comment/36284171
type: Answer
has comment: http://stackoverflow.com/comment/36283643
score: 2
has comment: http://stackoverflow.com/comment/36318417
has body: There's a method in PdfWriter called getVerticalPosition(). It takes a Boolean parameter that tells iText to ensure a new line or not. If you don't ensure a new line (false), you get the current Y, but that may not be the position you need. If you ensure a new line (true), a new line is added and you get the position where the new line starts. As you are creating A4 pages from start, and as the Y axis points upwards, you need to subtract the bottom margin from this vertical position to find out how much space is left for your new table. Note that we aren't happy with the getVerticalPosition() method at iText: having a getter that changes the content of the document isn't very elegant. In cases like yours, we prefer working with ColumnText to take charge over the layout process intstead of letting iText decide where to split a table.
has comment: http://stackoverflow.com/comment/36281656
has comment: http://stackoverflow.com/comment/36318752
accepted answer of: http://stackoverflow.com/q/23624285

http://stackoverflow.com/comment/36484034
has text: @SajanChandran how ,when did hibernate detect that?
score: 0
comment on: http://stackoverflow.com/q/23734266
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26018287
has body: Did you use the gdx-setup.jar file to create your project ? You can find it in the wiki, it is the official way to create a new project
answers question: http://stackoverflow.com/q/23742328
downvote count: 1
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/51243697
type: Answer

http://stackoverflow.com/q/23701365
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36420892
accepted answer: http://stackoverflow.com/a/23704038
has comment: http://stackoverflow.com/comment/36421224
answer count: 2
has comment: http://stackoverflow.com/comment/36421239
tagged with: jar
downvote count: 0
favorite count: 0
has title: Export Runnable JAR file not working
has comment: http://stackoverflow.com/comment/36421028
upvote count: 2
has comment: http://stackoverflow.com/comment/36422196
has comment: http://stackoverflow.com/comment/36421966
possible better answer: http://stackoverflow.com/a/23701848
has comment: http://stackoverflow.com/comment/36421408
has comment: http://stackoverflow.com/comment/36421336
has answer: http://stackoverflow.com/a/23701848
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23704038
tagged with: java
has body: I have read a lot of similar questions but I cant find anything helpful in them, so I have to ask one myself. I have a program that uses TCP socket connection server and client with a total of 5 classes in one package, two of them have a main method (server and clientGUI). But when I use rightclick on server.java -> export -> runnable jar file with server run configuration, it works, I can run it from outside eclipse. But when I do the same for clientGUI.java, nothing happens when I run the clientGUI.jar file. main method in Server looks like this: public static void main(String[] args) { Server s = new Server(); s.start(); } but in ClientGUI i only have this: public static void main(String[] args) { new ClientGUI(); } is that the problem? I don't have start() in ClientGUI, because nothing happens until user input, and everything related to graphics is coded in the constructor, and the rest is in ActionPerformed method that handles buttons. ClientGUI: public class ClientGUI extends JFrame implements ActionListener { private static final long serialVersionUID = -1115273859077115660L; private JTextField textField; private JTextArea chatBox; private static Client client; private JButton resetB; JButton btnConnect; JLabel lblGrid; JLabel lblGrid2; static int port = 56667; String IP; private JTextField txtPort; private JTextField txtIP; final JButton readyB; ClientGUI() { super("Client"); getContentPane().setBackground(Color.LIGHT_GRAY); setResizable(false); setBounds(100, 100, 945, 750); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(null); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBounds(10, 11, 920, 520); getContentPane().add(panel); panel.setLayout(null); readyB = new JButton("READY"); readyB.setEnabled(false); readyB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { lblGrid.setVisible(true); readyB.setEnabled(false); client.sendMessage(new Message(Message.READY, client.myID…
has comment: http://stackoverflow.com/comment/36422229
has comment: http://stackoverflow.com/comment/36420739
tagged with: swing
has comment: http://stackoverflow.com/comment/36421518
type: Question

mockito
tags question: http://stackoverflow.com/q/23632330
tags question: http://stackoverflow.com/q/23681501
tags question: http://stackoverflow.com/q/23675741
tags question: http://stackoverflow.com/q/23652663
tags question: http://stackoverflow.com/q/23641780
tag name: mockito
tags question: http://stackoverflow.com/q/23734185
type: Tag
tags question: http://stackoverflow.com/q/23759690
tags question: http://stackoverflow.com/q/23643985
tags question: http://stackoverflow.com/q/23616285
tags question: http://stackoverflow.com/q/23697622

http://stackoverflow.com/comment/36364211
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23625826
type: Comment
has text: It is a separate issue) And, as I see, already answered http://stackoverflow.com/questions/9626059/window-onbeforeunload-in-chrome-what-is-the-most-recent-fix

http://stackoverflow.com/a/23735250
answers question: http://stackoverflow.com/q/23735163
type: AcceptedAnswer
downvote count: 0
score: 1
has body: You are calling newFragment.changeText(info[1], info[0]); too soon. You need to wait till the Fragment is attached to the Activity. Your views are null. Also use .equalsto compare strings instead of == . if(info[2].equals("1")) Get to know Fragment lifecycle http://developer.android.com/guide/components/fragments.html Adding further to what laalto posted Send data from activity to fragment in android
has comment: http://stackoverflow.com/comment/36525499
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23735163

http://stackoverflow.com/a/23738775
downvote count: 1
has comment: http://stackoverflow.com/comment/36492278
has body: I would set a an action forward variable at the start of the method. ActionForward actionForwardToReturn = null; Then replace each of these two lines return mapping.getInputForward(); return mapping.findForward(ConstantLibrary.FWD_CONTINUE); with these two lines : actionForwardToReturn = mapping.getInputForward() actionForwardToReturn = mapping.findForward(ConstantLibrary.FWD_CONTINUE); finally return the variable. return actionForwardToReturn; This shouldn't be too difficult :) On a side note... (actually the orginal answer to the question) : Multiple return statements can make it hard to debug code. I personally would have just one action object that you return at the end of the method. The benefit of this, is that i can put a break point right on the return statement and look at exactly what that object is. Any logging or other cross cutting concern I would want to add later, would only have to be done at one point. Otherwise I would have to add a log statement to every line where you are returning.
answers question: http://stackoverflow.com/q/23738691
upvote count: 5
score: 4
type: Answer

testing
tags question: http://stackoverflow.com/q/23762443
tags question: http://stackoverflow.com/q/23653583
tags question: http://stackoverflow.com/q/23753439
tag name: testing
tags question: http://stackoverflow.com/q/23681419
tags question: http://stackoverflow.com/q/23624558
tags question: http://stackoverflow.com/q/23655076
tags question: http://stackoverflow.com/q/23675741
tags question: http://stackoverflow.com/q/23756185
type: Tag
tags question: http://stackoverflow.com/q/23732814
tags question: http://stackoverflow.com/q/23654798
tags question: http://stackoverflow.com/q/23736328
tags question: http://stackoverflow.com/q/23697622
tags question: http://stackoverflow.com/q/23632330
tags question: http://stackoverflow.com/q/23773340
tags question: http://stackoverflow.com/q/23628311

http://stackoverflow.com/q/23658494
tagged with: java
has answer: http://stackoverflow.com/a/23702358
has comment: http://stackoverflow.com/comment/36340541
has answer: http://stackoverflow.com/a/23739159
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23702358
has title: Websphere Liberty 8.5: Setting Java classpath
possible better answer: http://stackoverflow.com/a/23739159
type: Question
upvote count: 2
answer count: 2
has body: I am running Websphere Liberty 8.5. My application reads some files from the file system that are obtained via the Java CLASSPATH and I can't seem to find a way to append a directory from the file system to the CLASSPATH Liberty reads from. I've tried manually changing JAVA_CMD and JAVA_DEBUG but none of them take. Does anyone know how this is possible?
tagged with: websphere-liberty

http://stackoverflow.com/comment/36615568
has text: Can you please how how to get dynamically added textbox values (which I created using jquery) to servlet
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23776642
type: Comment

http://stackoverflow.com/q/23731866
has comment: http://stackoverflow.com/comment/36479431
has comment: http://stackoverflow.com/comment/36479675
has answer: http://stackoverflow.com/a/23731975
score: -1
linked to: http://stackoverflow.com/q/15943031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36479430
has comment: http://stackoverflow.com/comment/36479638
tagged with: java
has title: Java: Using TreeSet with a Class type 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36479563
type: Question
has comment: http://stackoverflow.com/comment/36479605
accepted answer: http://stackoverflow.com/a/23731975
has comment: http://stackoverflow.com/comment/36479785
has body: I want to add employee object in TreeSet and want to print object public class DemoTest { public static void main(String[] args) { TreeSet&lt;Employee&gt; list = new TreeSet&lt;Employee&gt;(); list.add(new Employee("A",1)); list.add(new Employee("A1",11)); list.add(new Employee("A1",11)); for(Employee e : list) { System.out.println(e.getName()); System.out.println(e.getId()); } } } Employee class is there but getting this exception
has comment: http://stackoverflow.com/comment/36479498
duplicate of: http://stackoverflow.com/q/15943031
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36477964
type: Comment
type: QuestionComment
has text: you do not have to declare i before the loop
score: 0
comment on: http://stackoverflow.com/q/23730950

http://stackoverflow.com/q/23724857
has comment: http://stackoverflow.com/comment/36466295
has answer: http://stackoverflow.com/a/23743868
has body: I've been getting this error when I press on a JButton too quickly on a JFrame, so it works if there's a slight delay between compiling the program and pressing on the button. I tried to make a splash screen/loading screen to see if I give the program more time to compile if it will work without the delay, yet thus far it still crashes if pressed too quickly. I was wondering if there is a way to pre-load it such that there doesn't need to be a delay before the button is pressed and so that the error won't exist, thanks! (relevant pieces of code are listed, but since the entire package has a few thousand lines I'm not going to put all of it here) This is ran in the main method. Panels panel = new Panels(); panel.getWindow(); This is in a separate "Window" class public Window(JPanel panel) { super("Knight Quest"); //loading screen JWindow window = new JWindow(); window.getContentPane().add(new JLabel("Loading...")); window.getContentPane().add( new JLabel("", new ImageIcon(getClass().getResource("loading.gif")), SwingConstants.CENTER)); window.setBounds(600, 300, 400, 300); window.setVisible(true); try { Thread.sleep(2500); } catch (InterruptedException e) { e.printStackTrace(); } window.setVisible(false); //end of loading screen setLayout(new BorderLayout()); add(panel, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(600,550); setLocation(525, 225); setVisible(true);; } This is at the top of the Panel class private Window window = new Window(main()); This is the main() JPanel that starts off the program (just adds stuff to a JPanel) public JPanel main() { JPanel main = new JPanel(); check = "main"; main.setBackground(lightGrey); Handler handles = new Handler(); one = new JButton("Start "); two = new JButton("Patch Notes"); three = new JButton("Exit "); one.addActionListener(handles); two.addActionListener(handles); three.addActionListener(handles); image = new ImageIcon(getClass().getResource("templar.jpg")); JLabel title = new JLabel("K…
has comment: http://stackoverflow.com/comment/36465996
score: 0
has comment: http://stackoverflow.com/comment/36466342
has answer: http://stackoverflow.com/a/23725075
tagged with: splash-screen
has comment: http://stackoverflow.com/comment/36466281
accepted answer: http://stackoverflow.com/a/23725075
tagged with: multithreading
tagged with: swing
has comment: http://stackoverflow.com/comment/36466308
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36466179
has comment: http://stackoverflow.com/comment/36465917
has comment: http://stackoverflow.com/comment/36466085
has comment: http://stackoverflow.com/comment/36466124
type: Question
has title: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException (Panel displays before fully loaded?)
answer count: 2
has comment: http://stackoverflow.com/comment/36466291
possible better answer: http://stackoverflow.com/a/23743868
has comment: http://stackoverflow.com/comment/36466394

http://stackoverflow.com/comment/36584529
score: 0
comment on: http://stackoverflow.com/q/23680050
type: Comment
type: QuestionComment
has text: any answers on this question? Still stuck with the problem

http://stackoverflow.com/comment/36528219
type: QuestionComment
score: 2
has text: I guess we would need more information about your code design if we are supposed to suggest improvements. What are you trying to achieve with the code? E.g. If you have the property at compile time, why would you want to access it using reflection? If you don't have it at compile time, how do you want to use a compile time reference to retrieve the name?
comment on: http://stackoverflow.com/q/23757561
type: Comment

http://stackoverflow.com/comment/36588875
has text: [CODE] tools:context="com.example.abc.MainActivity$PlaceholderFragment" > <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/buttonhelp" ads:adSize="BANNER" ads:adUnitId="my number goes here" /> </RelativeLayout> [/CODE] here is the link again to the post. hope it works http://androidforums.com/application-development/848598-nullpointerexception-error-problem.html#post6573785
comment on: http://stackoverflow.com/a/23777653
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23652871
type: Answer
has comment: http://stackoverflow.com/comment/36329367
has comment: http://stackoverflow.com/comment/36334112
has comment: http://stackoverflow.com/comment/36329569
has comment: http://stackoverflow.com/comment/36333007
has body: You need to program two applications: A client application and a server application. The client application is installed on the users machine and communicates with the server application installed on a server. The server application then communicates with the backend database. There are many possible ways to do this. It's your decision how much business logic you want to have on the server and how much you want to have on the client. It can be anything between the server being not much more than a proxy for the database while the client does everything or a very thin client which is just a dumb GUI with the whole logic running on the server (that would be what SAP is doing). There are also lots of options for communicating between client and server. Listing all possible options would be too much for a single answer.
answers question: http://stackoverflow.com/q/23652503
score: 0

http://stackoverflow.com/q/23682756
has body: I've written a Java based Windows service that fires off a command every five minutes to monitor certain events on a server. This then reports back to a web server for consolidation. Unfortunately I have to manually drop down the updated jar, on now 65 servers, every time I make a change to the service. I'm reaching a point where it needs to be able to auto - update itself. I'm thinking that the best way to do this would be to: 1. Have the Windows Service be the bare bones of the app. 2. Create a custom plugin loader (I don't have interest in using OSGi). 3. Pull the monitoring portion out of the primary program, and turning it into a plugin so that I may shut it down. 4. Add an auto - updater plugin that is loaded every X amount of time. I have an idea how I want to implement this, and have begun creating a custom plugin loader that works for some small test programs I've written. Though I have no idea how I could test something like an auto update feature, if the plugin properly unloads so it can be edited. TLDR: How do I test to see if my plugins have properly been unloaded, so that they me be edited?
type: Question
downvote count: 0
has title: Custom Java Plugins and Auto Updating
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/36477761
type: QuestionComment
comment on: http://stackoverflow.com/q/23730855
has text: You appear to be closing connections on the client side?
score: 0
type: Comment

http://stackoverflow.com/comment/36278604
score: 0
has text: @JonSkeet the op states that `foo` is a `List`.
type: Comment
comment on: http://stackoverflow.com/q/23627511
type: QuestionComment

http://stackoverflow.com/a/23648021
has comment: http://stackoverflow.com/comment/36319258
has comment: http://stackoverflow.com/comment/36332493
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/23647765
has body: Java applications use jar files and java web-applications use war files. JAR (Java ARchive) is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file to distribute application software or libraries on the Java platform. WAR file (Web application ARchive) is a JAR file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries, static web pages (HTML and related files) and other resources that together constitute a web application. Since the structure of a web application is very much different from a typical java standalone application you need to deploy it into a war file. To run a WAR file you need a java EE based server like apache tomcat, jboss, glassfish etc. Steps required to run the war file are (One of the solutions possible, although there are many other -as pointed out by boris):- 1.Start the web server; 2.Deploy the war file to the web server; 3.Visit JSP pages or servlets in the browser by entering thier links to their path. see this link for more details on deploying war :- deploy war file in tomcat server
downvote count: 1
has comment: http://stackoverflow.com/comment/36330845
has comment: http://stackoverflow.com/comment/36320125
type: Answer

http://stackoverflow.com/comment/36271075
score: 2
comment on: http://stackoverflow.com/q/23623651
has text: Have you tried writing any regex that would do what you would like it to do?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23748422
downvote count: 1
has comment: http://stackoverflow.com/comment/36511182
tagged with: processing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36933877
accepted answer: http://stackoverflow.com/a/23971579
tagged with: oop
has comment: http://stackoverflow.com/comment/36511611
tagged with: java
possible better answer: http://stackoverflow.com/a/23748462
has answer: http://stackoverflow.com/a/23748462
type: Question
has body: Here is my class in Processing ... class Stripe { PShape s; float x, y, w; static Stripe lastStripe; Stripe() { x = width / 2; y = 0; w = 150; s = createShape(); s.beginShape(); s.fill(0); s.noStroke(); s.vertex(w, 0); s.bezierVertex(w + 50, height * 1/4, w - 50 , height * 1/3, w, height); s.vertex(0, height); s.bezierVertex(-50, height * 1/3, 50 , height * 1/4, 0, 0); //s.vertex(0, 0); //s.bezierVertex(50, 50, 50, 50, 100, 100); s.endShape(CLOSE); } void draw() { pushMatrix(); translate(x, y); shape(s); popMatrix(); } void move() { x = x + STRIPE_VEL; if (x &gt; (width + OFFSCREEN_BUFFER)) { x = Stripe.lastStripe.x - STRIPE_SPACING; Stripe.lastStripe = this; } } } When I try and compile I get the following error ... The field lastStripe can only be declared static; static fields can only be declared in static or top level types Looking at this Java tutorial, this seems to be a valid Java pattern. Although the code above is self referential, it still raises the same error if the type is changed to an int or similar. What is the problem here? EDIT: By request, here is the rest of the sketch which is in another tab. I'm starting to think that the Processing way is to just declare such variables as a 'global' rather than a static variable on a class ... I'll probably just do that. float STRIPE_VEL = 0.5; float OFFSCREEN_BUFFER = 500; float STRIPE_SPACING = 50; int numStripes = 0; Stripe[] stripes; void setup() { float offset = 0; size(800, 600, P2D); smooth(); numStripes = (width + 2 * OFFSCREEN_BUFFER) / STRIPE_SPACING; stripes = new Stripe[numStripes]; for (int i=0; i &lt; numStripes; i++) { stripes[i] = new Stripe(); stripes[i].x = offset; offset = offset + inc; } Stripe.lastStripe = stripes[0]; } void draw() { background(255); for (int i=0; i &lt; numStripes; i++) { stripes[i].draw(); stripes[i].move(); } //blurAll(); }
answer count: 2
has comment: http://stackoverflow.com/comment/36511730
linked to: http://stackoverflow.com/q/22297722
score: 0
has comment: http://stackoverflow.com/comment/36510843
has comment: http://stackoverflow.com/comment/36532829
has answer: http://stackoverflow.com/a/23971579
favorite count: 0
has title: Why does this static property in Processing (Java) raise an error?
upvote count: 1

http://stackoverflow.com/a/23646839
score: 1
has comment: http://stackoverflow.com/comment/36316258
has comment: http://stackoverflow.com/comment/36316369
upvote count: 2
answers question: http://stackoverflow.com/q/23646745
has comment: http://stackoverflow.com/comment/36316283
downvote count: 1
has body: The purpose of an interface is not to do things but to define what things the class implementing the interface must do. In your case the interface Animal defines what functions can be invoked on an Animal. So any functions/Classes that rely on the Animal interface know what functions will be implemented by the class implementing the interface Animal. For eg: suppose there is a method that makes the Animal travel , eg : public void goToDestination(Animal a) { a.travel(); } Now this function can call the function travel on the Object of type implementing Animal without knowing what is the exact type of the object (It can be a MammalInt or it can be a Amphibian etc). This is the power of interfaces. This is only a basic layman explanation of interface you can Google and read more about Interfaces.
type: Answer
has comment: http://stackoverflow.com/comment/36316227

http://stackoverflow.com/comment/36316352
comment on: http://stackoverflow.com/q/23644230
has text: Using the code with the `szSrc` value either from the code or from the question results in encrypted value different from both output values in the question. You should really provide exactly one input value that causes the problem and the output values corresponding to it instead of random unrelated data.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36451504
type: Comment
has text: Post this in the SOpt :)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23661336

http://stackoverflow.com/a/23657559
score: 1
has body: If you're looking for error in your implementation, you'd rather put: s = (n % 2) + s; isntead of s+=(n%2); so the code'll be // n should be positive public static String convertBinary(int n){ if (n == 0) return "0"; String s = ""; // for is more compact than while here for (; n &gt; 0; n /= 2) s = (n % 2) + s; return s; } however in real life Integer.toString(n, 2); is much more convenient
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23657327
has comment: http://stackoverflow.com/comment/36338289
type: Answer

http://stackoverflow.com/comment/36537830
has text: Sorry, I don't see which typo you mean. In the xml-File?
comment on: http://stackoverflow.com/a/23762314
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23641089
upvote count: 1
has body: First of all, to quote the javadoc of @ContextConfiguration @ContextConfiguration defines class-level metadata that is used to determine how to load and configure an ApplicationContext for integration tests. Consider how you are using it on OuterService. Does it seem right? Is OuterService meant to be used to load and configure an ApplicationCOntext for integration tests? Unless I'm missing something essential, the answer is: No. So what is OuterService? It's some kind of service. You seem to want to use it as a bean. What is a bean? A bean is an object whose lifecycle is managed by Spring. This includes instantiation of the bean class, initialization of the object, post processing, and, finally, destruction of the object. If you created the object like so OuterService os = new OuterService(); then Spring is not involved. You created the object and there is no way for Spring to hook into that. You cannot therefore expect Spring to autowire its field @Autowired private Dao dao; And since you haven't initialized the field, it remains null, which causes the NullPointerException. So how do we get an OuterService bean, which is managed by Spring? You either declare a @Bean method for OuterService or you annotate OuterService with @Component or any of its specializations and component-scan the package it is in. You then inject the bean into any other bean that uses it. For example, @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = AppConfig.class, loader=AnnotationConfigContextLoader.class) public class TutorialTest { @Autowired private Dao dao; @Autowired private OuterService os; You can then use that variable directly.
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23634827
type: Answer
answers question: http://stackoverflow.com/q/23634827

http://stackoverflow.com/comment/36278458
has text: Ok, but I would have to convert those to a String array --> not really better than using a method in the first place. Although I admit that enums are more elegant.
comment on: http://stackoverflow.com/a/23627257
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36450876
score: 0
comment on: http://stackoverflow.com/q/23714671
type: Comment
type: QuestionComment
has text: please correct me if I am wrong. When you are creating an interceptor then it will be applied to all of the persistence operations for all of the entities not only for a single entity that I want. The second thing, I have to do a persistence operation to invoke one of my interceptors method (e.g. flush). I do not want to. It will be better if my code is transparent.

http://stackoverflow.com/q/23763952
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23764136
accepted answer: http://stackoverflow.com/a/23764136
has title: Connect MySQL to a Java Client/Server Application
upvote count: 3
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36540395
has comment: http://stackoverflow.com/comment/36540460
type: AnsweredQuestion
score: 2
has body: I have to allow the client to execute queries for my project, but I don't know how to connect my Client/Server application to MySQL. I only know how to connect to MySQL in a separate class. Any suggestions? Server: import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; public class Server { private ServerSocket serverSocket; private int port; public Server(int port) { this.port = port; } public void start() throws IOException { System.out.println("Starting the socket server at port:" + port); serverSocket = new ServerSocket(port); //Listen for clients. Block till one connects System.out.println("Waiting for clients..."); Socket client = serverSocket.accept(); //A client has connected to this server. Send welcome message sendWelcomeMessage(client); } private void sendWelcomeMessage(Socket client) throws IOException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(client.getOutputStream())); writer.write("Hello. You are connected to Server. What is your name?"); writer.flush(); } /** * Creates a SocketServer object and starts the server. * * @param args */ public static void main(String[] args) { // Setting a default port number. int portNumber = 1234; try { // initializing the Socket Server Server socketServer = new Server(portNumber); socketServer.start(); } catch (IOException e) { e.printStackTrace(); } } } Client: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; import java.net.UnknownHostException; public class Client { private String hostname; private int port; Socket socketClient; public Client(String hostname, int port){ this.hostname = hostname; this.port = port; } public void connect() throws UnknownHostException, IOException{ System.out.println("Attempting to connect to "+hostname+":"+port); socketClient = new Socket(hostname,port); System.out.println("Connection Established"); } …
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/23637320
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36298930
type: Answer
has comment: http://stackoverflow.com/comment/36297495
answers question: http://stackoverflow.com/q/23637277
has body: This code can be used to set background image programmattically RelativeLayout layout =(RelativeLayout)findViewById(R.id.relativelayout); layout.setBackgroundResource(R.drawable.img1);
has comment: http://stackoverflow.com/comment/36297684
upvote count: 5
has comment: http://stackoverflow.com/comment/36297428
has comment: http://stackoverflow.com/comment/36298973
accepted answer of: http://stackoverflow.com/q/23637277
score: 5

http://stackoverflow.com/q/23712118
has title: How to allow Eclipse to use more CPU resources
has answer: http://stackoverflow.com/a/23712158
accepted answer: http://stackoverflow.com/a/23712158
has body: I am working on Traveling Salesman Problem algorithm. When I execute the program it takes 3-4 hours to finish (not a big surprise for TSP). However, my Task manager tells that CPU is used only by 5% and ram by 27%. Is it possible to add more CPU resource for program execution, without modifying the code (I am not allowed to modify it)?
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/a/23727684
has comment: http://stackoverflow.com/comment/36472040
upvote count: 9
has body: The File class doesn't represent the physic file in the hard drive, it is just an abstract representation. Creating a new instance of File class doesn't mean you are creating a physical file. By knowing this, you can rename your file using a new File without worrying about creating new physical files. Code adapted from Rename a file using Java: public static void renameFile(File toBeRenamed, String new_name) throws IOException { //need to be in the same path File fileWithNewName = new File(toBeRenamed.getParent(), new_name); if (fileWithNewName.exists()) { throw new IOException("file exists"); } // Rename file (or directory) boolean success = toBeRenamed.renameTo(fileWithNewName); if (!success) { // File was not successfully renamed } } EDIT: Based on your question update and on this comment: I took a pic of the error. "Unhandled Exception Type IO Exception" Looks one of these: You don't know how to handle checked exceptions. To do this, you should wrap the method that throws the Exception (or subclass) in a try-catch statement: String new_name = getFilename(file); try { renameFiles(files[i], new_name); } catch (IOException e) { //handle the exception //using a basic approach e.printStacktrace(); } More info: Java Tutorial. Lesson: Exceptions. You don't want your method to throw a checked exception. In this case, it would be better to throw an unchecked exception instead, so you don't need to handle the exception manually. This can be done by throwing a new instance of RuntimeException or a subclass of this: public static void renameFile(File toBeRenamed, String new_name) { File fileWithNewName = new File(new_name); if (fileWithNewName.exists()) { throw new RuntimeException("file exists."); } // Rename file (or directory) boolean success = toBeRenamed.renameTo(fileWithNewName); if (!success) { // File was not successfully renamed } } More info in the link posted in the above section. You don't want to throw an exception at all. In this case, it would be better to at…
has comment: http://stackoverflow.com/comment/36472122
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23727648
score: 8
has comment: http://stackoverflow.com/comment/127745172
has comment: http://stackoverflow.com/comment/127739241
has comment: http://stackoverflow.com/comment/36472071
type: Answer
has comment: http://stackoverflow.com/comment/36471882
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23727648

http://stackoverflow.com/comment/36341071
comment on: http://stackoverflow.com/a/23659310
has text: This is helpful but i was also looking for a paragraph or two summary similar to which I wrote about GWT if possible.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23620045
type: Answer
has body: I find final keywords useful on methods when you don't other programmers to override the method. Take for instance I had a trigometery class that found the hypotenuse of a right triangle by the 2 sides is the law square root of side a to the power of 2 plus side b to the power of 2. That's a mathematical law. To stop programmer's from overriding it and possibly making a mistake. make the method final public class Trig { public final double hytpotenuseOfRightTriangle(double sideA, double sideB) { return Math.sqrt(Math.pow(sideA, 2) + Math.pow(sideB, 2)); } }
answers question: http://stackoverflow.com/q/23616285
score: 0

http://stackoverflow.com/a/23679110
answers question: http://stackoverflow.com/q/23676719
has comment: http://stackoverflow.com/comment/36381111
score: 0
has comment: http://stackoverflow.com/comment/36381449
has body: TagTester has an open tag, a close tag and a parser. So when you create a TagTester for your example you will have : open tag = &lt;table&gt; and close tag= &lt;/table&gt;. Currently TagTester allow you to : hasChildTag(String tagName) : for searching tag by name, getChild(String attribute, String value) : for getting the first TagTester child with attribute equals to value. If you want to get a Tag inside your markup you can do it by searching your self inside the markup myTagTester.getMarkup() that returns a String.
has comment: http://stackoverflow.com/comment/36382237
has comment: http://stackoverflow.com/comment/36382154
type: Answer
has comment: http://stackoverflow.com/comment/36378932
has comment: http://stackoverflow.com/comment/36380908

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23737297
tags question: http://stackoverflow.com/q/23718183
tag name: deserialization
tags question: http://stackoverflow.com/q/23660334
tags question: http://stackoverflow.com/q/23636565
tags question: http://stackoverflow.com/q/23718466

http://stackoverflow.com/q/23673406
possible better answer: http://stackoverflow.com/a/23673500
favorite count: 0
accepted answer: http://stackoverflow.com/a/23673712
has answer: http://stackoverflow.com/a/23673712
downvote count: 0
has body: I am trying to calculate taken my all the thread created by my program in total but my code is calculating the time only for invoking. I am sure because in the output i see difference printed before all the threads are finished below is my main program RequestProcessor here is my thread class int i = 0; List&lt;Customer&gt;customers = customer.getCustomers(); long startTimestamp = System.currentTimeMillis(); for (Customer c: customers){ new RequestProcessor(c, i).start(); i++; } long endTimestamp = System.currentTimeMillis(); System.out.println("difference = "+(endTimestamp - startTimestamp)); below is the Request Processor class public RequestProcessor( Customer customer , int threadSeq ) { super(); this.customer = customer; this.threadSeq = threadSeq; } @Override public void run() { // TODO Auto-generated method stub processRequest(); super.run(); } public void processRequest(){ //performing execution on customer here System.out.println("processing "+ customer.getName()+" thread seq "+threadSeq); } below is the the output that I am getting processing customer9 thread seq 9 processing customer7 thread seq 7 difference = 4 processing customer3 thread seq 3 processing customer2 thread seq 2 I tried using join but didn't work for me
tagged with: multithreading
has answer: http://stackoverflow.com/a/23673500
has title: How to calculate the running time of my multithreaded program
type: AnsweredQuestion
tagged with: oop
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/36454315
type: QuestionComment
has text: JSP: mc.getMap(); main: ta.jname1. Is it really same? Why do you not use ta.getMap() in main as well to verify that it works?
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23718474

http://stackoverflow.com/q/23734280
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13072312
has answer: http://stackoverflow.com/a/23734494
tagged with: javax.imageio
score: 1
tagged with: java
has title: Colors appear wrong in image file if image type is TYPE_INT_ARGB and writing with ImageIO
upvote count: 1
has comment: http://stackoverflow.com/comment/36486655
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/36489447
has comment: http://stackoverflow.com/comment/36494175
has body: The code below creates apparently wrong image file. It appears as while it should be or something. Anyway, circle should be yellow. How to fix? The code is below package tests.org.piccolo2d; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import org.piccolo2d.nodes.PPath; public class Try_SaveImage { public static void main(String[] args) throws IOException { /* PPath path = PPath.createEllipse(0, 0, 100, 100); path.setPaint(new Color(0xECB77E)); path.setStrokePaint(Color.black); BufferedImage image = (BufferedImage) path.toImage(); */ //BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); // works good BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); // works bad Graphics2D g2 = (Graphics2D) image.getGraphics(); g2.setColor(Color.yellow); g2.fillOval(0, 0, 100, 100); g2.setColor(Color.black); g2.drawOval(0, 0, 100, 100); JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); frame.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); ImageIO.write(image, "JPG", new File("testdata/circle.jpg")); } }
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36484070
has answer: http://stackoverflow.com/a/33966375

http://stackoverflow.com/a/23745956
answers question: http://stackoverflow.com/q/23745844
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: If the variables are initialized to 0, then just create the array with the appropriate size: int[] array = new int[10]; All elements in the array are initialized to 0.

http://stackoverflow.com/q/23643876
tagged with: casting
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36310895
has title: java.lang.Integer cannot be cast to java.lang.Long with an array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36310854
has body: I'm trying to loop through a userSet with where the id's in the array userSet are Int. I keep getting this error: java.lang.Integer cannot be cast to java.lang.Long Is there a simple way to do this? Casting variables are easy but is there an easy way to cast all variables in an array to Long? Very new to Java here. Set &lt;Long&gt; userSet = getUniqueFollowers("/tmp/followers.txt") for (long id : userSet) { System.out.println("Starting twitter account: " + id);
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23643997
has comment: http://stackoverflow.com/comment/36310864
tagged with: java
score: -1

http://stackoverflow.com/q/23698446
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23698797
accepted answer: http://stackoverflow.com/a/23698797
tagged with: jtable
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36415089
has body: I got a problem when filtering my JTable. In fact, on my first row I have JComboBoxes in each column. And when I sort which the items of JCombo the first row is also being filtered and disappear. Here is my Table model: public static class MyModel extends AbstractTableModel { private static final long serialVersionUID = -768739845735375515L; private List&lt;Object[]&gt; data; private List&lt;String&gt; columnNames; public MyModel(List&lt;String&gt; columnNames, List&lt;Object[]&gt; data) { super(); this.columnNames = columnNames; this.data = data; } @Override public int getRowCount() { return data.size(); } @Override public int getColumnCount() { return columnNames.size(); } @Override public String getColumnName(int column) { return columnNames.get(column); } @Override public Object getValueAt(int rowIndex, int columnIndex) { return data.get(rowIndex)[columnIndex]; } @Override public boolean isCellEditable(int row, int col) { // Pour modifier uniquement la cellule Statut if (row == 0) { return true; } else { return false; } } public void setValueAt(Object value, int row, int col) { data.get(row)[col] = value; fireTableCellUpdated(row, col); } public void removeRow(int row) { data.remove(row); } } And the combo listener : private void ComboListener(final JComboBox comboBox){ comboBox.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e){ try{ String selectedItem = comboBox.getSelectedItem().toString(); sorter.setRowFilter(RowFilter.regexFilter(selectedItem)); }catch(Exception ex){} } } ); }
has comment: http://stackoverflow.com/comment/36415321
linked to: http://stackoverflow.com/q/16673437
has comment: http://stackoverflow.com/comment/36415126
has title: Exclude first row filtering JTable
tagged with: jcombobox
type: AnsweredQuestion

http://stackoverflow.com/q/23745537
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/23745922
score: 0
has comment: http://stackoverflow.com/comment/36505554
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23745617
has comment: http://stackoverflow.com/comment/36505040
tagged with: java
type: Question
has body: public static void createAI() { AI a = new AI(10,10,15,15); frame.add(a); AI b = new AI(100,100,15,15); frame.add(b); } This only shows b; however this prints out a. public static void createAI() { AI a = new AI(10,10,15,15); frame.add(a); } Why cant I do both in one method? Thanks for your feedback
has title: My Output only prints one Rectangle in JAVA

http://stackoverflow.com/comment/36564643
has text: By implementing [`Processor`](http://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) interface.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23776644
type: QuestionComment

http://stackoverflow.com/comment/36475481
has text: Thank you -- with the logcat added, Lawrence Choy, below, was able to answer you in minutes.
score: 0
comment on: http://stackoverflow.com/q/23729264
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23653779
answers question: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/65054813
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/65054960
score: 74
has comment: http://stackoverflow.com/comment/65054884
has comment: http://stackoverflow.com/comment/65054922
has body: The tutorial is probably outdated, attempting to create an activity-based UI instead of the fragment-based UI preferred by wizard-generated code. The view is in the fragment layout (fragment_main.xml) and not in the activity layout (activity_main.xml). onCreate() is too early in the lifecycle to find it in the activity view hierarchy, and a null is returned. Invoking a method on null causes the NPE. The preferred solution is to move the code to the fragment onCreateView(), calling findViewById() on the inflated fragment layout rootView: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); View something = rootView.findViewById(R.id.something); // not activity findViewById() something.setOnClickListener(new View.OnClickListener() { ... }); return rootView; } As a side note, the fragment layout will eventually be a part of the activity view hierarchy and discoverable with activity findViewById() but only after the fragment transaction has been run. Pending fragment transactions get executed in super.onStart() after onCreate().
accepted answer of: http://stackoverflow.com/q/23653778
type: AcceptedAnswer
upvote count: 75

http://stackoverflow.com/q/23670904
answer count: 3
has answer: http://stackoverflow.com/a/23862476
tagged with: apache-commons-httpclient
has answer: http://stackoverflow.com/a/23845826
has comment: http://stackoverflow.com/comment/36746117
favorite count: 0
has comment: http://stackoverflow.com/comment/36562546
upvote count: 5
has comment: http://stackoverflow.com/comment/36743620
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23808194
has title: HttpClient ignoring encoding, on a single computer
has comment: http://stackoverflow.com/comment/36759967
downvote count: 0
has comment: http://stackoverflow.com/comment/36649651
tagged with: java
has comment: http://stackoverflow.com/comment/36753534
tagged with: character-encoding
type: Question
has comment: http://stackoverflow.com/comment/36561812
has comment: http://stackoverflow.com/comment/36571289
score: 5
has body: I am using HttpClient (version 3.1) on several different (but apparently identical) computers to read a UTF-8 encoded JSON data from a URL. On all the machines, save one, it works fine. I have some Spanish language words and they come through with accents and tildes intact. One computer stubbornly refuses to cooperate. It is apparently treating the data as ISO-8859-1, despite a Content-Type: application/json;charset=utf-8 header. If I use curl to access that URL from that computer, it works correctly. On every other computer, both curl and my HttpClient-based program work correctly. I did an md5sum on the common-httpclient.jar file on each machine: the same. Is there some setting, deep in Linux, that might be different and be messing with me? Any other theories, or even places to look? EDIT: some people asked for more details. Originally I had the problem deep in the bowels of a complex Tomcat app, but I lightly adapted the sample to just retrieve the URL in question, and (fortunately) had the same problem. These are Linux 2.6 machines running jdk1.7.0_45. An env command yields a bunch of variables. The only one that looks remotely on point is LANG=en_US.UTF-8.

http://stackoverflow.com/comment/36492045
comment on: http://stackoverflow.com/q/23738691
score: 24
has text: There really is nothing wrong with multiple returns in a method... Sometimes it makes more sense to have multiple returns, sometimes it makes more sense to have a single return. Pick the right one for the situation. Forcing single return per method isn't necessarily the best idea.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36267778
has text: So does search work then? Also I think it'd be easier to use compareTo or compareToIgnoreCase.
comment on: http://stackoverflow.com/a/23620852
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36310891
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23643913
has text: It's called [shadowing](http://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.4.1)

http://stackoverflow.com/q/23662659
has comment: http://stackoverflow.com/comment/36347495
has answer: http://stackoverflow.com/a/23662691
type: AnsweredQuestion
has body: In a class i can have as many constructors as I want with different argument types. I made all the constructors as private,it didn't give any error because my implicit default constructor was public But when i declared my implicit default constructor as private then its showing an error while extending the class. WHY? this works fine public class Demo4 { private String name; private int age; private double sal; private Demo4(String name, int age) { this.name=name; this.age=age; } Demo4(String name) { this.name=name; } Demo4() { this("unknown", 20); this.sal=2000; } void show(){ System.out.println("name"+name); System.out.println("age: "+age); } } This can not be inherited public class Demo4 { private String name; private int age; private double sal; private Demo4(String name, int age) { this.name=name; this.age=age; } Demo4(String name) { this.name=name; } private Demo4() { this("unknown", 20); this.sal=2000; } void show() { System.out.println("name"+name); System.out.println("age: "+age); } }
tagged with: constructor
has answer: http://stackoverflow.com/a/23662792
accepted answer: http://stackoverflow.com/a/23662792
possible better answer: http://stackoverflow.com/a/23662691
has comment: http://stackoverflow.com/comment/36347796
type: Question
has answer: http://stackoverflow.com/a/23663362
tagged with: java
has comment: http://stackoverflow.com/comment/36348461
score: 0
has title: why a class can not be subclassed if i declare its default constructor as private
linked to: http://stackoverflow.com/q/215497
answer count: 3

http://stackoverflow.com/comment/36468288
type: Comment
type: QuestionComment
has text: Look harder -- if it were easy anyone could do it.
comment on: http://stackoverflow.com/q/23725697
score: 0

http://stackoverflow.com/comment/36298004
type: QuestionComment
score: 0
has text: Yeah basically, the application will get XML files from another source and will render them on the screen
comment on: http://stackoverflow.com/q/23637615
type: Comment

http://stackoverflow.com/q/23766841
score: 0
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/29045287
has comment: http://stackoverflow.com/comment/36549968
tagged with: oracle-sqldeveloper
tagged with: oracle-database
has answer: http://stackoverflow.com/a/23767231
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23767231
has title: Using Java in Oracle Database 11g
tagged with: java
possible better answer: http://stackoverflow.com/a/29045287
tagged with: oracle11g
has body: I have Java Files (that use external libraries) that I am trying to run in Oracle SQL Developer 11g Enterprise Edition 11.2.0.3.0 . I compiled and uploaded my code (using JDK 1.5x, I know it does not support anything higher) to the Database Java folder using these lines below from command prompt. loadjava -user username/password@MyInstance -force -verbose -resolve -fileout Javawriter.log -genmissing MyLibrary.jar loadjava -user username/password@MyInstance -force -verbose -resolve -fileout Javawriter.log -genmissing MyJavaFile.java I am wondering how can I use this Java file using SQL procedure or the Worksheet. How can I call methods in my Java Classes and return some value? P.S. Something like this does not return me any value Varchar(20) summaryCall = MyJavaClass.MyMethod(5,3); What am I doing wrong? :S
type: Question

http://stackoverflow.com/q/23625336
has comment: http://stackoverflow.com/comment/36274375
has comment: http://stackoverflow.com/comment/36274391
downvote count: 0
has comment: http://stackoverflow.com/comment/36274168
has answer: http://stackoverflow.com/a/23625594
has comment: http://stackoverflow.com/comment/36274575
type: UnansweredQuestion
has body: I'm trying to serialize and object, parse to String and deserialize, but it doesn't work. I guess I'm missing something when I parse the byte[] to String or viceversa. String obj = new String(SerializationUtils.serialize(configuration)); Configuration test = (Configuration)SerializationUtils.deserialize(obj.getBytes()); Why doesn't it work? I get this error: org.apache.commons.lang.SerializationException: java.io.StreamCorruptedException: invalid stream header: EFBFBDEF at org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:168) at org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:193) Solution: There're to encode and decote the byte[] to Base64
has title: Serialize object, parse to String and deserialize
tagged with: java
has answer: http://stackoverflow.com/a/31326601
has comment: http://stackoverflow.com/comment/36274338
type: Question
upvote count: 2
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/48706477
score: 2
tagged with: serialization

http://stackoverflow.com/comment/36549093
score: 0
has text: you want me to check all JobProducer's boolean field in main method?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23768116

http://stackoverflow.com/comment/36309693
has text: ... How does that help? I can't reproduce this on the fly -- it's something that crops up over time. Something I'm tempted to do is put the value in a static variable and , instead of pulling it from the database every time, to pull it only the first time and after that read the static variable, even though I'll still continue to write the updates. That way I wouldn't be dependent on a hibernate call every time I need the value -- the value returned would always be in memory, and perhaps better protected by synchronization.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23642734
score: 0

http://stackoverflow.com/q/23627393
has answer: http://stackoverflow.com/a/23628980
possible better answer: http://stackoverflow.com/a/23627574
has comment: http://stackoverflow.com/comment/36279685
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36278190
score: 2
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23628980
has title: Display a Set of Objects in JSP page, with Spring MVC
has comment: http://stackoverflow.com/comment/36278265
favorite count: 0
has comment: http://stackoverflow.com/comment/36278727
upvote count: 2
has body: I'm new in spring mvc and jstl, and i want to display a set of objects in my jsp page, that are my two classes : Class Phase{ private Set&lt;Tache&gt; taches; } Class Tache{ private String name; } Class Controller{ @RequestMapping(value="/pages/index") public String pageProject(Model model){ model.addAttribute("phaseList", phaseService.getAllPhases()); return "/pages/createProject"; } Class PhaseDAO{ @Override public List&lt;Phase&gt; getAllPhases() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); return session.createQuery("from Phase").list(); } } Class PhaseService{ @Transactional public List&lt;Phase&gt; getAllPhases() { // TODO Auto-generated method stub return phaseDao.getAllPhases(); } } And in my JSP : j:forEach items="phaseList" var="phase" &lt;br&gt; ${phase.taches} &lt;br&gt; /j:forEach So i want to display in a jsp page Taches per Phase. Please help me !
has comment: http://stackoverflow.com/comment/36279868
tagged with: spring
has answer: http://stackoverflow.com/a/23627574
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23653853
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36331495
has comment: http://stackoverflow.com/comment/36329968
has body: Garbage collection does happen in permgen space of heap too. And static variables are garbage collected when their respective class loaders unload from memory. String literal pool is probably never garbage collected. EDIT If permgen is full, OutOfMemoryError : PermGen occurs.
has comment: http://stackoverflow.com/comment/36329640
has comment: http://stackoverflow.com/comment/36331466
has comment: http://stackoverflow.com/comment/36331587
downvote count: 0
has comment: http://stackoverflow.com/comment/36330656
has comment: http://stackoverflow.com/comment/36330346
type: Answer
has comment: http://stackoverflow.com/comment/36332416
answers question: http://stackoverflow.com/q/23653785

http://stackoverflow.com/q/23684448
type: UnansweredQuestion
has title: Call onAcitivityResult in BaseAdapter
tagged with: java
has answer: http://stackoverflow.com/a/23684918
type: Question
score: 0
answer count: 1
has body: I pass a parameter from a second activity to the first activity but the program doesn't enter the method onActivityResult that is in the first activity and it doesn't anything. In my first Acitivity I have 2 clases. The first one I do a query and I call the second class ListAdapter: public class view_records extends Activity { public void getProduct() { comandSQL = "Select * from Inventario"; try { Statement statement = MainActivity.connect.createStatement(); rs = statement.executeQuery(comandSQL); ArrayList&lt;product_model&gt; product_list = new ArrayList&lt;product_model&gt;(); String tidno = "", tdesc = ""; while(rs.next()){ tidno = rs.getString("No_"); tdesc = rs.getString("Descripción Completa"); product_model _ProductModel = new product_model(); _ProductModel.setIdno(tidno); _ProductModel.setProductDesc(tdesc); _productlist.add(_ProductModel); } listview.setAdapter(new ListAdapter(this)); } catch (Exception e) { Log.e("ERROR",e.getMessage()); } } ` In the Second Class I call a second activity private class ListAdapter extends BaseAdapter { LayoutInflater inflater; ViewHolder viewHolder; int request_code = 1; @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.modelo_productos, null); viewHolder = new ViewHolder(); viewHolder.txt_prod = (TextView) convertView.findViewById(R.id.tv_productos); viewHolder.txt_desc = (TextView) convertView.findViewById(R.id.tv_desc); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.txt_prod.setText(_productlist.get(position).getIdno().trim()); viewHolder.txt_desc.setText(_productlist.get(position).getProductDesc().trim()); final int temp = position; (convertView.findViewById(R.id.bt_modificar)).setOnClickListener(new OnClickListener() { public void onClick(View arg0) { modificarProd(temp); } }); return convertView; } protected void modificarProd(int temp) { String pos = Integer.toStr…
tagged with: android

http://stackoverflow.com/comment/36625305
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23704641
has text: Sorry. Missed this question. Updated the code in answer. You could just iterate through the array of object then cast it to appropriate type and do whatever you want. Basically the types will ARRAY, DATA, DATE, DICT, REAL, INTEGER, STRING, TRUE or FALSE. So each object have appropriate methods to extract value from them.
score: 0

http://stackoverflow.com/q/23661038
has comment: http://stackoverflow.com/comment/36344465
has comment: http://stackoverflow.com/comment/36344273
has comment: http://stackoverflow.com/comment/36344533
has comment: http://stackoverflow.com/comment/36344958
has comment: http://stackoverflow.com/comment/36344434
answer count: 0
type: UnansweredQuestion
has title: Problems creating new File in Java
tagged with: file
has comment: http://stackoverflow.com/comment/36344937
has comment: http://stackoverflow.com/comment/36345457
has body: I Have a function that receives a File, when i put new File("filepath") in the arguments it works, but when try to use new File(string) it returns Exception in thread "main" java.util.InputMismatchException. Also i tested if the strings are equal and the test returns true. Here is part of my code: System.out.println(filev.getPath()); String str = filev.getPath(); str = str.replace("\\", "/"); System.out.println(str); if(str.equals("D:/POO/TF_V2_7/account_info/1234567890989.csv")) { System.out.println("EQUALS"); } Account acc = Account.newAccount(new File(str)); // Returns InputMismatchException Account acc = Account.newAccount(new File("D:/POO/TF_V2_7/account_info/1234567890989.csv")); // Runs well P.S. In the newAccount() function the file is read with a Scanner.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36344362
has comment: http://stackoverflow.com/comment/36344591
score: 0
has comment: http://stackoverflow.com/comment/36344193
has comment: http://stackoverflow.com/comment/36344513

lock-free
tag name: lock-free
type: Tag
tags question: http://stackoverflow.com/q/23724249

http://stackoverflow.com/q/23630681
linked to: http://stackoverflow.com/q/40358903
linked to: http://stackoverflow.com/q/40358839
linked to: http://stackoverflow.com/q/40358865
has answer: http://stackoverflow.com/a/23631544
has answer: http://stackoverflow.com/a/27335633
downvote count: 1
linked to: http://stackoverflow.com/q/40358889
has answer: http://stackoverflow.com/a/45488759
type: Question
linked to: http://stackoverflow.com/q/40358863
score: 31
has title: How to parse JSON results from Unirest call
has answer: http://stackoverflow.com/a/29038649
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: unirest
has answer: http://stackoverflow.com/a/38473599
linked to: http://stackoverflow.com/q/40358860
has comment: http://stackoverflow.com/comment/36285347
linked to: http://stackoverflow.com/q/40358872
possible better answer: http://stackoverflow.com/a/29038649
linked to: http://stackoverflow.com/q/40358891
linked to: http://stackoverflow.com/q/40358875
linked to: http://stackoverflow.com/q/40358855
accepted answer: http://stackoverflow.com/a/27335633
has comment: http://stackoverflow.com/comment/71119310
answer count: 7
has body: I'm using the Unirest library to retrieve JSON from a Mashape API. I have the call working using the following code: HttpResponse&lt;JsonNode&gt; request = Unirest.get(URL) .header("X-Mashape-Authorization", MASHAPE_AUTH) .asJson(); This returns my JSON in the form of HttpResponse&lt;JsonNode&gt;, which I am unfamiliar with. From reading the limited documentation, It seems that I have to call getBody() on the response object in order to get a JsonNode object back. I still have no idea what to do with the JsonNode object however. What is the best way to begin to parse this data? Edit: In case it helps with giving examples, the JSON I want to parse looks like this: { "success": "1", "error_number": "", "error_message": "", "results": [ { "name": "name1", "formatedName": "Name 1" }, { "name": "testtesttest", "formatedName": "Test Test Test" }, { "name": "nametest2", "formatedName": "Name Test 2" }, { "name": "nametest3", "formatedName": "Name Test 3" } ] }
linked to: http://stackoverflow.com/q/40358852
favorite count: 0
has answer: http://stackoverflow.com/a/40358944
linked to: http://stackoverflow.com/q/40358884
linked to: http://stackoverflow.com/q/40358870
linked to: http://stackoverflow.com/q/40358892
linked to: http://stackoverflow.com/q/40358910
linked to: http://stackoverflow.com/q/40358877
linked to: http://stackoverflow.com/q/40358895
linked to: http://stackoverflow.com/q/40358857
has answer: http://stackoverflow.com/a/23632005
tagged with: android
has comment: http://stackoverflow.com/comment/36285119
tagged with: mashape
upvote count: 32
linked to: http://stackoverflow.com/q/40358880
linked to: http://stackoverflow.com/q/40358858
has comment: http://stackoverflow.com/comment/36284401
linked to: http://stackoverflow.com/q/40358849
type: AnsweredQuestion

http://stackoverflow.com/comment/36524831
type: Comment
comment on: http://stackoverflow.com/q/23755741
type: QuestionComment
score: 1
has text: Look at this link, I think is the thing you want to do: http://stackoverflow.com/questions/1925614/javascript-change-form-action-based-on-selection

http://stackoverflow.com/a/23689225
has comment: http://stackoverflow.com/comment/36398604
has comment: http://stackoverflow.com/comment/36398711
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/36398769
has comment: http://stackoverflow.com/comment/36400040
has comment: http://stackoverflow.com/comment/36400171
accepted answer of: http://stackoverflow.com/q/23689137
has body: Your thread pool contains 1 thread. It can only execute one callable/runnable at a time. All other submitted tasks are queued until a thread is available to execute them. Increase your pool size.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36399296
answers question: http://stackoverflow.com/q/23689137
type: Answer
has comment: http://stackoverflow.com/comment/36398631

http://stackoverflow.com/q/23649578
downvote count: 0
tagged with: tomcat
favorite count: 0
linked to: http://stackoverflow.com/q/23885592
upvote count: 2
type: UnansweredQuestion
tagged with: session-timeout
tagged with: request
score: 2
has answer: http://stackoverflow.com/a/23678960
tagged with: java
type: Question
has body: I am using Tomcat 7.0, Spring 4.0.2, Web Module 3.0 in eclipse for my web application. And I configured my session timeout in app/web.xml as well as tomcat/conf/web.xml. 30 I know that tomcat must reset it's internal timer for calculate this 30 mins and invalidate session (session timeout) on some events/actions/requests. I am sending one request called captureLastActiveTimeForCurrentFile after every 5 mins. So now application server will never invalidate session because I am sending request after every 5 mins, so it will reset it's session timeout timer after every 5 mins. Now my problem is that how to ignore any particular request (here, captureLastActiveTimeForCurrentFile) for resetting session timeout timer. It means when I send captureLastActiveTimeForCurrentFile request, server must not reset it's timer. For All others requests it should work as it is how it is already working. So suppose if I do not send any other (excluding captureLastActiveTimeForCurrentFile) requests to server, it must be invalidate session after 30 mins. The solution I can think : --> I will configure session timeout very long time in web.xml file. --> I will capture last request time in one Global variable after every request call on server excluding captureLastActiveTimeForCurrentFile --> I will start my own scheduler which will run after every 5 min and It will check last request time - current time > 30 mins, then I will invalidate session manually. But I think this solution is complicated and performance wise not a good idea. Is there any other way by which I can configure excluded requests on server, so that Server will ignore that particular request. Correct me if any of my assumptions are wrong. Thanks in advance. Any help would be appreciate.
tagged with: session
has title: Define custom events/actions/requests for resetting timer for Session Timeout in Java Web App?
answer count: 1

http://stackoverflow.com/comment/36495470
type: QuestionComment
has text: @artbristol: I've googled dynamic port forwarding on JSCH, and it appears to be missing it, sadly. I'll check out https://code.google.com/p/ssh-persistent-tunnel/source/browse/src/org/ayal/SPT/DynamicForwarder.java which seems to be the dynamic port forwarding option built on top of JSCH, which is, I am pretty sure, quite ineffective.
comment on: http://stackoverflow.com/q/23739696
score: 0
type: Comment

http://stackoverflow.com/comment/36482201
type: QuestionComment
comment on: http://stackoverflow.com/q/23733374
type: Comment
score: 2
has text: Your design is broken and needs to be fixed.

http://stackoverflow.com/q/23617942
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/23618180
accepted answer: http://stackoverflow.com/a/23618180
type: Question
has title: How should I switch to new activity from a listview that contains an array of data?
score: 0
answer count: 1
has body: I want to switch to a new activity from the listview that contains an array of data from a mysql database? File: TampilGambarActivity.java package com.tes.menu; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; //import android.content.Intent; import android.os.Bundle; //import android.view.View; import android.widget.ListView; //import android.widget.Toast; public class TampilkanGambarActivity extends Activity { static String in_idmenu = "id_menu"; static String in_jenismenu = "jenis_menu"; static String in_image_menu = "image_menu"; JSONArray str_json = null; public String lo_Koneksi,isi ; ListView list; LazyAdapter adapter; ArrayList&lt;HashMap&lt;String, String&gt;&gt; data_map = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Koneksi lo_Koneksi = new Koneksi(); isi = lo_Koneksi.isi_koneksi(); String link_url = isi+"menu.php"; JSONParser jParser = new JSONParser(); JSONObject json = jParser.AmbilJson(link_url); try { str_json = json.getJSONArray("menu"); for(int i = 0; i &lt; str_json.length(); i++){ JSONObject ar = str_json.getJSONObject(i); String id_menu = ar.getString("id_menu"); String image_menu = ar.getString("image_menu"); String jenis_menu = ar.getString("jenis_menu"); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(in_idmenu, id_menu); map.put(in_image_menu, image_menu); map.put(in_jenismenu, jenis_menu); data_map.add(map); } } catch (JSONException e) { e.printStackTrace(); } list=(ListView)findViewById(R.id.list); adapter=new LazyAdapter(this, data_map); list.setAdapter(adapter); } }
tagged with: android

http://stackoverflow.com/a/23630111
has comment: http://stackoverflow.com/comment/36284084
has comment: http://stackoverflow.com/comment/36284887
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36283853
has comment: http://stackoverflow.com/comment/36284410
has comment: http://stackoverflow.com/comment/36283926
has body: Use matches instead if you want to use a regular expression as an argument: if (somestring.matches(".*LOOP\\swith\\sspaces.*")){ Note that (1) .* means any number of any character and, (2) you need to escape the backslash in Java: \\ is interpreted as \.
has comment: http://stackoverflow.com/comment/36284747
answers question: http://stackoverflow.com/q/23630051
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36285866
accepted answer of: http://stackoverflow.com/q/23630051
type: Answer

swt
tags question: http://stackoverflow.com/q/23721329
tags question: http://stackoverflow.com/q/23707562
tags question: http://stackoverflow.com/q/23755960
tags question: http://stackoverflow.com/q/23752216
tags question: http://stackoverflow.com/q/23754511
tags question: http://stackoverflow.com/q/23632775
tags question: http://stackoverflow.com/q/23702296
tags question: http://stackoverflow.com/q/23729981
tags question: http://stackoverflow.com/q/23753698
tags question: http://stackoverflow.com/q/23750741
tags question: http://stackoverflow.com/q/23652232
tags question: http://stackoverflow.com/q/23637451
tags question: http://stackoverflow.com/q/23700397
type: Tag
tags question: http://stackoverflow.com/q/23708546
tags question: http://stackoverflow.com/q/23735828
tags question: http://stackoverflow.com/q/23755929
tags question: http://stackoverflow.com/q/23698936
tags question: http://stackoverflow.com/q/23752432
tags question: http://stackoverflow.com/q/23659414
tags question: http://stackoverflow.com/q/23774319
tags question: http://stackoverflow.com/q/23658623
tags question: http://stackoverflow.com/q/23677790
tags question: http://stackoverflow.com/q/23623590
tags question: http://stackoverflow.com/q/23732512
tag name: swt
tags question: http://stackoverflow.com/q/23740515
tags question: http://stackoverflow.com/q/23739246
tags question: http://stackoverflow.com/q/23624053

http://stackoverflow.com/comment/36356318
score: 0
comment on: http://stackoverflow.com/q/23667005
type: Comment
type: QuestionComment
has text: @Pshemo Now clearly my code has bugs, I think I shall wait for an answer here :).

http://stackoverflow.com/comment/36276544
type: Comment
type: QuestionComment
has text: This may help you http://stackoverflow.com/a/20559197/1608643
comment on: http://stackoverflow.com/q/23626488
score: 0

http://stackoverflow.com/comment/36262990
type: AnswerComment
score: 0
type: Comment
has text: Oh I see, I didn't realize that getCurrentDirectory would know its last location even if the dialog was cancelled. It works now. Thanks!
comment on: http://stackoverflow.com/a/23619137

http://stackoverflow.com/comment/36731834
has text: Hi, I try this code and works for me. Anyway I review your updated code to check if I can make it works
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23777474

http://stackoverflow.com/comment/36504392
score: 0
has text: You can always use static variables, which is not preferable, but they can be shared across multiple instances. You set them anywhere, and you can access them anywhere. You need to change the variable declaration to `public static`, as well as the getters and setters
type: Comment
comment on: http://stackoverflow.com/a/23745071
type: AnswerComment

http://stackoverflow.com/q/23643364
tagged with: java
accepted answer: http://stackoverflow.com/a/23643466
tagged with: import
type: Question
answer count: 1
has title: JAWS import issue
has body: I am using JAWS (Java API for WordNet Searching) and have set up the wordnet dictionary with VM Arguments in eclipse. I downloaded the jaws-bin.jar file and placed it in my project directory C:\Users\My-pc\Projects\MyApp\src. After this, I ran the code successfully using: java -classpath .;C:\Users\My-pc\Projects\MyApp\bin\jaws-bin.jar -Dwordnet.database.dir=C:\WordNet-3.0\dict MyAppName Now when I import the package "edu.smu.tspell.wordnet.*", it is giving the error "The import edu cannot be resolved". I followed the set-up guide closely but can't figure out what is wrong. Can anyone please help me in resolving this. Thanks.
has answer: http://stackoverflow.com/a/23643466
score: 0
tagged with: jaws-wordnet
tagged with: wordnet
type: AnsweredQuestion

http://stackoverflow.com/q/23776397
has comment: http://stackoverflow.com/comment/36564266
has comment: http://stackoverflow.com/comment/36564445
has body: I'm writing this method that looks at any variation of this kind of string: "Movie:Forrest Gump Genre:Drama, Romance Rating:8.8 Cost:12.50 Year:1994 Top Actors:Tom Hanks Box Office:55,000,000" The strings can vary from name, genre, etc. so I'm trying to write a method that would simply retrieve the Cost (in this example it would retrieve 12.50 for me). Here is my snippet of code public static String getPrice(String movieInfo)//returns the current price in the movie info { String price=movieInfo.substring(movieInfo.indexOf(" Cost: "), movieInfo.indexOf(" Year: ")); return price; } I'm not sure if i'm even applying the substring method correctly or if it even suitable within this context, so please let me know if i am wrong for using that substring method in this context.
score: -1
tagged with: substring
answer count: 3
has title: Trying to extract a specific portion of a string using substrings
has answer: http://stackoverflow.com/a/23776775
favorite count: 0
has answer: http://stackoverflow.com/a/23777125
accepted answer: http://stackoverflow.com/a/23777125
has comment: http://stackoverflow.com/comment/36564480
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23776626
has comment: http://stackoverflow.com/comment/36564379
has comment: http://stackoverflow.com/comment/36564617
type: Question
has answer: http://stackoverflow.com/a/23776626

http://stackoverflow.com/a/23730657
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23729665
answers question: http://stackoverflow.com/q/23729665
has body: Here is an example of iterating over elements of an ArrayList and inserting them to a JTextPane: public class Texting extends JFrame { Texting() { List&lt;String&gt; list = new ArrayList&lt;&gt;(); list.add("AAAAAAA"); list.add(" "); list.add("BBBB"); JTextPane pane = new JTextPane(); Document doc = pane.getDocument(); for (String s : list) try { doc.insertString(doc.getLength(), s, null); } catch (BadLocationException e) { e.printStackTrace(); } add(pane); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String args[]) { new Texting(); } }

http://stackoverflow.com/comment/36309024
has text: Is it that your database password will be in the app?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23642936
score: 0

http://stackoverflow.com/comment/36556202
type: QuestionComment
comment on: http://stackoverflow.com/q/23771898
score: 1
has text: A [Model–view–controller](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) would be my primary suggestion, this way you can separate the individual requirements into areas of pluggable responsibility and easily interchange them. For example, the view for each of the states shouldn't really change, but the way the data is model might and the way that the program is controlled will...for example...ps - Nice space screen ;)
type: Comment

http://stackoverflow.com/comment/36495869
has text: `anything % 60` will always give an answer between `0` and `59`. What were you expecting to see?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23740634

http://stackoverflow.com/comment/36567951
has text: How to do can u tell Me Shashank
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23778184

http://stackoverflow.com/comment/36313276
comment on: http://stackoverflow.com/a/23645206
score: 0
type: AnswerComment
has text: Nailed it, I owe you my sanity
type: Comment

http://stackoverflow.com/a/23639189
answers question: http://stackoverflow.com/q/23639064
upvote count: 1
score: 1
has body: try this retular expression \[[^\[\]]*\] http://rubular.com/r/heMGeTMjuB alternatively, this one is similar, and will parse things such as "[foo[bar]" as foo[bar \[(.*?)\] http://rubular.com/r/IzPI0RcLmS
downvote count: 0
type: Answer

http://stackoverflow.com/q/23775647
has answer: http://stackoverflow.com/a/47859669
accepted answer: http://stackoverflow.com/a/23775756
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/23775756
tagged with: maven
score: 11
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/47859669
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to configure "tomcat7-maven-plugin" in pom.xml?
answer count: 2
has body: I am trying to add a tomcat7-maven-plugin dependency to pom.xml file and getting an error. I am following the instructions on tomcat.apache.org. cvc-complex-type.2.4.a: Invalid content was found starting with element 'configuration'. One of '{"http://maven.apache.org/POM/4.0.0":type, "http:// maven.apache.org/POM/4.0.0":classifier, "http://maven.apache.org/POM/4.0.0":scope, "http://maven.apache.org/POM/4.0.0":systemPath, "http:// maven.apache.org/POM/4.0.0":exclusions, "http://maven.apache.org/POM/4.0.0":optional}' is expected. My full pom.xml config 4.0.0 com.tastyminerals.poems poemcollection 0.0.1-SNAPSHOT war maven-war-plugin 2.3 maven-compiler-plugin 3.1 1.7 1.7 <hibernate.version>4.3.5.Final</hibernate.version> <mysql.connector.version>5.1.30</mysql.connector.version> <spring.version>4.0.3.RELEASE</spring.version> org.hibernate hibernate-core ${hibernate.version} org.hibernate hibernate-entitymanager ${hibernate.version} mysql mysql-connector-java ${mysql.connector.version} commons-dbcp commons-dbcp 1.4 org.springframework spring-webmvc ${spring.version} org.springframework spring-tx 4.0.3.RELEASE javassist javassist 3.12.1.GA org.springframework spring-jdbc ${spring.version} org.springframework spring-orm ${spring.version} cglib cglib 3.1 jstl jstl 1.2 org.eclipse.jetty jetty-jndi 8.1.14.v20131031 org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http://localhost:8080/manager localhost /${project.build.finalName}
upvote count: 11
tagged with: tomcat

http://stackoverflow.com/a/23693174
downvote count: 0
type: Answer
has body: See my answer on this post here for an example of how to wire in a custom AuthenticationSuccessHandler into your security context. However, in your case, instead of implementing AuthenticationSuccessHandler, you want to extend DCAuthenticationSuccessHandler and call super.onAuthenticationSuccess(request, response, authentication) on the last line of your CPAuthenticationSuccessHandler. Something like this: public class CPAuthenticationSuccessHandler extends DCAuthenticationSuccessHandler{ @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication){ /* Do anything that you want to do here. Any changes to the HttpServletResponse * will be overwritten when you call super. So when you call super will * depend on what logic you want to implement. */ super.onAuthenticationSuccess(request, response, authentication); } } If there is anything you don't understand, let me know
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23692094
has comment: http://stackoverflow.com/comment/36413563
answers question: http://stackoverflow.com/q/23692094
type: AcceptedAnswer

http://stackoverflow.com/comment/36357244
has text: The black bars along the edges can have breaks in them. I'm pretty sure this is explained in the official 9patch docs, but if you're too lazy to Google it, then so am I.
comment on: http://stackoverflow.com/q/23667253
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36439948
type: Comment
comment on: http://stackoverflow.com/a/23708545
score: 0
type: AnswerComment
has text: I already answered OPs question in 1st part. Just wanted to demonstrate final variable cannot be instantiated for second time. In this case local but is true irrespective of that.

http://stackoverflow.com/q/23760317
tagged with: java
has body: I have a boolean to initialize depending on conditions. I am wondering what is the best way to do it, if there is one, according to code optimization, or if it is only a matter of personal taste. Way #1: boolean conditionIsTrue; if(object == whatItShould){ conditionIsTrue = true; } else { conditionIsTrue = false; } Way #2: boolean conditionIsTrue = false; if(object == whatItShould){ conditionIsTrue = true; } edit: I am not looking for an alternative to change the code with object.equals or other, this condition was an example and usually they are more complex. I would like to do what is the best way only between #1 and #2.
downvote count: 3
has comment: http://stackoverflow.com/comment/36533195
type: Question
has comment: http://stackoverflow.com/comment/36533244
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36533318
has answer: http://stackoverflow.com/a/23760421
tagged with: if-statement
has comment: http://stackoverflow.com/comment/36534134
linked to: http://stackoverflow.com/q/11227809
has comment: http://stackoverflow.com/comment/36533431
has title: Java guidelines on if else and initialization
tagged with: boolean
possible better answer: http://stackoverflow.com/a/23760411
upvote count: 0
has comment: http://stackoverflow.com/comment/36534928
has comment: http://stackoverflow.com/comment/36533111
has comment: http://stackoverflow.com/comment/36533126
has answer: http://stackoverflow.com/a/23760521
accepted answer: http://stackoverflow.com/a/23760521
favorite count: 0
has comment: http://stackoverflow.com/comment/36533158
has comment: http://stackoverflow.com/comment/36533387
score: -3
has answer: http://stackoverflow.com/a/23761060
has comment: http://stackoverflow.com/comment/36533071
answer count: 4
has answer: http://stackoverflow.com/a/23760411

http://stackoverflow.com/q/23677364
downvote count: 3
has body: I am trying to write a Regex with the following rule. Text on which Regex match needs to be done: Key: "employeeNo" with value "ABC12345" is already used. Rule: 1. Only the number after ABC is changing. 2. Key: "employeeNo" with value "ABC[Any Number with any length]" is already used. True cases Key: "employeeNo" with value "ABC12345" is already used. Key: "employeeNo" with value "ABC987858547" is already used. Key: "employeeNo" with value "ABC7" is already used. Falsecases key is not used Key: "employeeNo" with value "ABCXYZYZ" is already used. Key: employeeNo with value ABC7 is already used. Regex tried Key: "employeeNo" with value "ABC[0-9]+" is already used. I also want to check quotes "".
has comment: http://stackoverflow.com/comment/36375839
has comment: http://stackoverflow.com/comment/36375962
accepted answer: http://stackoverflow.com/a/23678609
has comment: http://stackoverflow.com/comment/36375936
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36375890
has title: checking quotes matches in regex
has comment: http://stackoverflow.com/comment/36375598
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23678609
upvote count: 1
score: -2
tagged with: regex
answer count: 1
has comment: http://stackoverflow.com/comment/36375712
has comment: http://stackoverflow.com/comment/36376005
has comment: http://stackoverflow.com/comment/36375478
has comment: http://stackoverflow.com/comment/36375846
tagged with: java

http://stackoverflow.com/a/29870599
type: Answer
answers question: http://stackoverflow.com/q/23717543
score: 0
has body: PS: This is WAY WAY longer than it needs to be. /* Alright here is what we need to do... Step 1: Get all the 'x' chars into a String. Step 2: Get all NON 'x' chars into a String. Step 3 (goal): Concencate (combine) the NON 'x' String first then the 'x' String in that order. Solution Notes: Instead of using an index variable to go through a String, we could 'substring' off the first char in the String each time, cutting until we are down to the base case, for the sake of showing recursive logic I used an index varible. However on Arrays or any other collection, you need an index varible to access that element ant that spot or (index). */ public String endX(String str) { //Ternary operator used here...could be written as a full if then else statement. //Ternary operator logic: if the length is 0 return "", else return getNonX(str, "", 0) + getX(str, "", 0); return (str.length() == 0) ? "" : getNonX(str, "", 0) + getX(str, "", 0); //NOTICE in the parts [getNonX(str, "", 0)] and [getX(str, "", 0)] //there is an empty String in the middle, that is there to hold or gather the //chars, 'x' or not. We fill those empty Strings up in each recursive helper } public String getX(String str, String x, int index) { //We are at the end, and if the last char IS an 'x'... if(index == str.length() - 1 &amp;&amp; str.charAt(index) == 'x'){ return x + 'x'; //...put that last 'x' on the 'x' String. } //We are at the end and if the last char IS NOT an 'x'... else if(index == str.length() - 1 &amp;&amp; str.charAt(index) != 'x'){ return x; //...just return what we got. } //When we see an 'x' but we aren't at the end... if(index &lt; str.length() - 1 &amp;&amp; str.charAt(index) == 'x'){ x += 'x'; //...append 'x' to the 'x' String. } return getX(str, x, index + 1); //recur, moving the index up } public String getNonX(String str, String nonX, int index) { //We are at the end, and if the last char IS NOT an 'x'... if(index == str.length() - 1 &amp;&amp; str.charAt(index) != 'x'){ return (nonX…

http://stackoverflow.com/comment/36500334
score: 0
type: Comment
type: QuestionComment
has text: Are you asking how to not lose image quality for an icon if you alter the size ?
comment on: http://stackoverflow.com/q/23742790

http://stackoverflow.com/comment/36454350
score: 1
comment on: http://stackoverflow.com/q/23718882
has text: Where did `on Friday` go?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36478113
score: 0
type: Comment
has text: Thanks for the update, this info is definitely helpful.I will try to do what you mentioned.
type: AnswerComment
comment on: http://stackoverflow.com/a/23680000

http://stackoverflow.com/comment/36537207
type: QuestionComment
comment on: http://stackoverflow.com/q/23761766
type: Comment
score: 0
has text: Hmm, with a bit more experimentation I can't get either Java 7 or Java 8 to object to this (except for a "you could use diamond inference" on the `return new EntityCollection<M>(map)`). Other than that its very happy. I'm using netbeans

http://stackoverflow.com/comment/36518172
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23752048
has text: Simply If i had Class1, Class2, Class3, ..., Class10 that uses ClassA. I could rename the method in ClassA, compile only ClassA and run tests for it. If it's good, then I adopt Class1..Class10 files to ClassA changes.
score: 0

http://stackoverflow.com/comment/36289489
type: QuestionComment
has text: Ah, I note that you're using the old (Jackson 1) mapper class, so it may be that you have a version mismatch.
type: Comment
comment on: http://stackoverflow.com/q/23631868
score: 0

http://stackoverflow.com/q/23767069
has comment: http://stackoverflow.com/comment/36546953
tagged with: oop
has comment: http://stackoverflow.com/comment/36546599
tagged with: java
upvote count: 1
answer count: 1
has body: Hello guys i am just beginner in java language.My program is Multilevel inheritance in java by using constructor.So in which i am facing some error while compiling my program.I will feel great if any one here solve my problem. class bee { int x,y,z; bee(int x1,int y1,int z1) { x=x1; y=y1; z=z1; } void vol() { int vol1=x*y*z; System.out.println("Volume1="+vol1); } } class be extends bee { be(int x2,int y2,int z2) { x=x2; y=y2; z=z2; } } class inh3 { public static void main(String args[]) { be c=new be(10,20,30); c.vol(); } }
has answer: http://stackoverflow.com/a/23767223
downvote count: 9
type: UnansweredQuestion
score: -8
has comment: http://stackoverflow.com/comment/36546600
has title: Multilevel inheritance in java by using constructor
has comment: http://stackoverflow.com/comment/36546794
favorite count: 0
type: Question

http://stackoverflow.com/comment/38203953
has text: It is as good as downloading an video, So why dont you just download it and play it in videoview? send it as attachment the whole video instead of sending it in chunks. Its just my suggestion.
comment on: http://stackoverflow.com/q/23703278
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23639289
has comment: http://stackoverflow.com/comment/36314369
has title: how to dynamically allocate size of string array in java
has comment: http://stackoverflow.com/comment/36301613
downvote count: 1
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/36302083
has answer: http://stackoverflow.com/a/23639326
has comment: http://stackoverflow.com/comment/36314305
answer count: 4
has answer: http://stackoverflow.com/a/23639379
has comment: http://stackoverflow.com/comment/36301455
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23639446
has body: hello I am beginner to work with java. I have following code, where I wanted to initialize the string array word[] dynamically consisting of size of total no. of tokens in all documents [] array. how should I do that? String []result = {"Shipment of Gold damaged in fire","Delivery of silver arrived in silver truck","shipment of Gold arrived in Truck"}; String []documents = new String[result.length]; for (int k =0; k&lt;result.length; ++k){ documents[k] = result[k].toLowerCase(); System.out.println("document["+k+"] :" + documents[k]); } /*step 2: Tokenize all documents and create vocabulary from it*/ int i=0; String [] word = new String [30]; // how to do dynamic allocation here int no_of_tokens=0; for(String document:documents){ StringTokenizer st = new StringTokenizer(document," "); System.out.print("tokens in document"+ i +":"+ st.countTokens()+"\n"); while(st.hasMoreTokens()) { word[no_of_tokens]=st.nextToken(); System.out.print(word[no_of_tokens] + "\n"); no_of_tokens++; } i++; }
type: Question
tagged with: dynamic-arrays
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36314119
has answer: http://stackoverflow.com/a/23639404
score: -1
has comment: http://stackoverflow.com/comment/36301633
tagged with: stringtokenizer
possible better answer: http://stackoverflow.com/a/23639379
accepted answer: http://stackoverflow.com/a/23639326
linked to: http://stackoverflow.com/q/2697182

http://stackoverflow.com/a/23686823
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36396108
score: 1
has body: That's not possible. You can, instead, make an ajax call to your servlet and the servlet may return the necessary data in a format that will help the view to work. An example is by writing the response using JSON format, then handle this JSON response in JavaScript to add the necessary data in your view accordingly. You could also return a "text/html" response where you write the content of the &lt;div&gt; with the necessary content to just write the HTML response directly in your view. The response used in this approach is easier to use in your view (JSP), but note that will couple your Servlet request to mere HTML responses only. The decision is up to you. More info: How to use Servlets and Ajax?
answers question: http://stackoverflow.com/q/23686801

global-temp-tables
tags question: http://stackoverflow.com/q/23775370
tag name: global-temp-tables
type: Tag

http://stackoverflow.com/comment/36541682
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23764500
type: AnswerComment
has text: What error? With what code? You need to be much more specific with your questions.

http://stackoverflow.com/comment/43307829
has text: Hi Jan, could you please explain a possible solution in more details? I have a similar problem, I need to run a task on all Weblogic nodes (currently there are 2). I'd like to be able to do it ad hoc (e.g. from a servlet). I'm already using quartz for some scheduled jobs, so I was wondering if it's possible to delegate this task distribution to it. Thanks
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23673652

http://stackoverflow.com/q/23751629
tagged with: android
has body: I implemented googleMap by following code. it works fine but do not cluster these markes. The coordinates are being gotten from database. My question is how can I cluster markers. Here is code map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); if (map!=null) { try { SQLiteDatabase db = openOrCreateDatabase("Swaponce", MODE_PRIVATE, null); Cursor cursor = db.rawQuery("SELECT * FROM cord", null); cursor.moveToFirst(); //ConnUrl=new String[cursor.getCount()]; int i=0; do { double lng = Double.parseDouble(cursor.getString(cursor .getColumnIndex("lng"))); double lang =Double.parseDouble(cursor.getString(cursor .getColumnIndex("lat"))); try { LatLng cord = new LatLng(lang, lng); Marker hamburg = map.addMarker(new MarkerOptions().position(cord) .title("").snippet("") .icon(BitmapDescriptorFactory .fromResource(R.drawable.mappeopleindicator))); } catch(Exception e) { } } while (cursor.moveToNext()); cursor.close(); db.close(); } catch (Exception e) { int i = 0; } map.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker arg0) { int i=0; //swapview(); i++; return false; } }); } } Thanks in advance
has title: Clustering In google Map in Android
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23751683
tagged with: android-layout
score: 0
tagged with: google-maps
answer count: 1
has answer: http://stackoverflow.com/a/23751683

http://stackoverflow.com/a/23768567
score: 1
answers question: http://stackoverflow.com/q/23768328
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23768328
type: Answer
has comment: http://stackoverflow.com/comment/36549944
has body: It seems your file is having replacement character http://www.utf8-chartable.de/unicode-utf8-table.pl?start=65280&amp;utf8=dec U+FFFD � 239 191 189 REPLACEMENT CHARACTER Not the 0xA8 , i did created one simple file using the following code File f = new File("0xA8.hex"); FileOutputStream stream = new FileOutputStream(f); stream.write(0xA8); stream.flush(); stream.close(); Note** just for demo And used your program to read it is working as excepted. Find how the file corrupted .
downvote count: 0

http://stackoverflow.com/q/23762560
favorite count: 0
has comment: http://stackoverflow.com/comment/36542679
accepted answer: http://stackoverflow.com/a/23769729
has comment: http://stackoverflow.com/comment/36538555
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23769729
tagged with: swing
type: Question
tagged with: java
score: -1
tagged with: jtable
has body: What I wanted to know is that is it possible that Jtable fills say 4 out of 5 fields from database and the 5th field remains static.(In the sense that say the 5th field has button for all rows. based on the value of a particular field, the button when pressed displays different popups). So is it possible for such kind of requirement ? If so kindly provide me with some working examples.
has title: Is it possible to partially populate Jtable with values from database
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36540678

http://stackoverflow.com/comment/36477608
has text: Posted an answer with a kick-off example to implement your stack using a single linked list and the power of generics. It will be up to you to continue implementing the other methods for a stack.
comment on: http://stackoverflow.com/q/23730416
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23652994
tagged with: debugging
answer count: 2
has answer: http://stackoverflow.com/a/47671381
possible better answer: http://stackoverflow.com/a/23653412
has answer: http://stackoverflow.com/a/23653412
has comment: http://stackoverflow.com/comment/36328961
favorite count: 0
has body: Why does adding a method level breakpoint have such a negative impact on program performance in debug mode? Take the following (somewhat contrived) example: public static void main(String[] args) { long start = System.currentTimeMillis(); for(int a = 0; a &lt;Integer.MAX_VALUE; a++) { long v = a * a; if(v == 100) { doSomething(); } } System.out.println("Time: " + (System.currentTimeMillis() - start) + " ms"); } private static void doSomething() { //*** BREAKPOINT 2 System.out.println("done something"); //*** BREAKPOINT 1 } The performance of this is approximately: Not in debug: 4.5 seconds Debug, breakpoint 1: 6.0 seconds Debug, breakpoint 2: 47.0 seconds What's going on? What benefit does the method level debug give us that normal ones can't? Thanks! EDIT The timings are only approximations and include the time it takes me to react to the breakpoint and continue the application (which looks to be roughly about 1 second). I appreciate that System.currentTimeMillis() is not 100% accurate, however the results are consistent over multiple tests and the difference in performance is massive! In fact, adding the method level breakpoint results in a warning from IntelliJ that it will have an impact on performance.
has comment: http://stackoverflow.com/comment/36328560
tagged with: jvm
has comment: http://stackoverflow.com/comment/36349864
accepted answer: http://stackoverflow.com/a/47671381
has comment: http://stackoverflow.com/comment/102439432
upvote count: 14
has comment: http://stackoverflow.com/comment/36329607
linked to: http://stackoverflow.com/q/751105
score: 13
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36329415
has comment: http://stackoverflow.com/comment/36329972
has comment: http://stackoverflow.com/comment/36328442
tagged with: java
has comment: http://stackoverflow.com/comment/36329581
has title: Why do method breakpoints impact performance so negatively?
type: Question

http://stackoverflow.com/q/23636083
possible better answer: http://stackoverflow.com/a/23637428
has answer: http://stackoverflow.com/a/23637428
tagged with: java
tagged with: hibernate
has body: I am working on an application consisting of Spring and Hibernate frameworks. In one particular module, the application fetches the data from database (select queries). Along with the select queries, application also issues an update statement. After further debugging, I found that the update query is fired from some TransactionInterceptor. I think, transaction interceptor is not required here as all are select queries. Can anyone please suggest me a way to disable/suppress this interceptor at runtime? This problem might sound too abstract at first. However, I am new to this application and don't have much knowledge about it's architecture. If you need any configuration details, please let me know. Thanks in advance.
has answer: http://stackoverflow.com/a/76704873
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36295348
has answer: http://stackoverflow.com/a/23652382
tagged with: spring
has comment: http://stackoverflow.com/comment/36297736
answer count: 6
accepted answer: http://stackoverflow.com/a/23652382
upvote count: 2
has answer: http://stackoverflow.com/a/23656032
has title: Disable/Ignore Transaction Interceptor at runtime
has answer: http://stackoverflow.com/a/23923554
has answer: http://stackoverflow.com/a/23636488

http://stackoverflow.com/q/23745823
has comment: http://stackoverflow.com/comment/36505777
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23746704
has comment: http://stackoverflow.com/comment/36505715
tagged with: selenium-webdriver
tagged with: java
has title: How to select an element with multiple CSS attributes using Selenium Webdriver
type: Question
has body: Ok so I did my research for sure but couldn't find an answer to my problem. Using Selenium Webdriver and on the webpage there are a list of items below is a sample HTML So I created an enum that contains all of the products with it's respective index location number. And that works great but the only problem is if the indexes change, let's say adding a new item not adding to the last index, then I have to go and change each and every index, therefore not very efficient. The only static attribute that I see is the product_id, which is unlikely to change. And if a new product_id is added I can just add it to the enum without having to change any indices and such. My question then becomes how can I click on the element based on the product_id? I know how to get the attribute, but of course that returns a string but somehow I want to click on the item based on the product_id. Any help would be greatly appreciated! I use CSS for finding elements by the way. And this is not part of any dropdown list
score: 0
has answer: http://stackoverflow.com/a/23769451
answer count: 2
tagged with: css-selectors

http://stackoverflow.com/q/23767586
has title: File upload interceptor does not call setter methods
tagged with: file-upload
has body: I need to do very basic file upload operation, but in my case setter methods are not called by file upload interceptor. I have checked the solution of similar questions like this on stackoverflow but they didnot resolve my issue. Please let me know what mistake i am doing in code. Action class public class ResultFileUploadAction extends ActionSupport { private File upload; private String uploadFileName; private String uploadContentType; private Logger logger = Logger.getRootLogger(); @Override public String execute() throws Exception { logger.info("ResultFileUploadAction->execute"); String destPath = "C:/work/"; try { System.out.println("Src File name: " + upload); System.out.println("Dst File name: " + uploadFileName); File destFile = new File(destPath, uploadFileName); FileUtils.copyFile(upload, destFile); } catch (IOException e) { e.printStackTrace(); return ERROR; } return super.execute(); } public void setUpload(File upload) { this.upload = upload; } public void setUploadContentType(String uploadContentType) { this.uploadContentType = uploadContentType; } public void setUploadFileName(String uploadFileName) { this.uploadFileName = uploadFileName; } } Jsp file <s:form action="upload" method="post" enctype="multipart/form-data"> </s:form> Struts.xml /AddResultBullk.jsp Since, setters are not called therefore i am getting NPE in execute().
has comment: http://stackoverflow.com/comment/36553512
has comment: http://stackoverflow.com/comment/36547772
has answer: http://stackoverflow.com/a/23780238
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20071698
tagged with: java
linked to: http://stackoverflow.com/q/20733554
has comment: http://stackoverflow.com/comment/36548254
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23780238
tagged with: struts2
has answer: http://stackoverflow.com/a/23768401
accepted answer: http://stackoverflow.com/a/23768401
has comment: http://stackoverflow.com/comment/36549287

http://stackoverflow.com/comment/36377722
type: QuestionComment
comment on: http://stackoverflow.com/q/23659004
has text: I'm actually trying to develop a document indexing application and I have multiple pieces of data that are being transferred back and forth between the servlet and the JSP
score: 0
type: Comment

jcombobox
tags question: http://stackoverflow.com/q/23653739
tags question: http://stackoverflow.com/q/23711776
tags question: http://stackoverflow.com/q/23722706
tags question: http://stackoverflow.com/q/23671101
type: Tag
tag name: jcombobox
tags question: http://stackoverflow.com/q/23734947
tags question: http://stackoverflow.com/q/23680161
tags question: http://stackoverflow.com/q/23719744
tags question: http://stackoverflow.com/q/23698220
tags question: http://stackoverflow.com/q/23698446

http://stackoverflow.com/q/23772151
accepted answer: http://stackoverflow.com/a/23772530
has answer: http://stackoverflow.com/a/23772222
type: Question
has comment: http://stackoverflow.com/comment/36556651
tagged with: arrays
has title: Abstract Data Type: Array of objects
tagged with: data-structures
possible better answer: http://stackoverflow.com/a/23772222
has answer: http://stackoverflow.com/a/23772278
score: 0
answer count: 3
has body: So I have this class, and I want to method that takes in an int, and creates a new array of that size. If I declare newArray&lt;Object&lt;int,int&gt;&gt; array1 = new newArray&lt;Object&lt;int,int&gt;&gt;(10); This would create an array of size 10. I've tried doing public class newArray&lt;O&gt; { private O[] array; public newArray(int newArraySize) { newArray&lt;O&gt;[] = new newArray&lt;O&gt;[newArraySize]; } } but I get an " Cannot create a generic array of newArray " error.
has answer: http://stackoverflow.com/a/23772530
has comment: http://stackoverflow.com/comment/36556730
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36557268

http://stackoverflow.com/comment/36387826
comment on: http://stackoverflow.com/q/23638291
has text: @selena http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html#getContentPane()
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36475341
comment on: http://stackoverflow.com/a/23729243
score: 0
type: AnswerComment
has text: You're not actually accessing the the cursor in getRecord. Add something like `if( crsRecord.moveToFirst() ) { return new String{} { crsRecord.getString(0), crsRecord.getString(1), crsRecord.getString(2) }; } else { ... return null record ... }`
type: Comment

http://stackoverflow.com/a/23656030
score: 1
answers question: http://stackoverflow.com/q/23655885
upvote count: 1
has body: you can use Services and Notifications ... I did a little application that lunches a notification from a service . it is free without license ... you can find it here . good luck
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36541528
type: AnswerComment
has text: I checked it right now and it seems Wildfly has stable support for Java up to 1.7 ( http://wildfly.org/downloads/ )
type: Comment
comment on: http://stackoverflow.com/a/23764629
score: 0

http://stackoverflow.com/q/23632169
linked to: http://stackoverflow.com/q/21814825
has comment: http://stackoverflow.com/comment/37026759
has comment: http://stackoverflow.com/comment/36308209
has answer: http://stackoverflow.com/a/23881611
answer count: 2
has comment: http://stackoverflow.com/comment/36766522
linked to: http://stackoverflow.com/q/22364433
downvote count: 0
has comment: http://stackoverflow.com/comment/47761049
favorite count: 0
has comment: http://stackoverflow.com/comment/41833050
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/48734662
tagged with: android-actionbar
tagged with: android-actionbar-compat
linked to: http://stackoverflow.com/q/28843304
has comment: http://stackoverflow.com/comment/50548421
has comment: http://stackoverflow.com/comment/48734581
linked to: http://stackoverflow.com/q/18063395
tagged with: java
has comment: http://stackoverflow.com/comment/48045292
has answer: http://stackoverflow.com/a/23865775
has comment: http://stackoverflow.com/comment/45763904
has comment: http://stackoverflow.com/comment/48732729
tagged with: unit-testing
type: Question
score: 37
has comment: http://stackoverflow.com/comment/48742838
has title: "You need to use a Theme.Appcompat theme..." when testing ActionBarActivity, but I am
upvote count: 37
has body: I have a problem when testing an app which uses ActionBarActivity from android-support-v7-appcompat via Android JUnit test in Eclipse. When running in an emulator or device everything seems to work fine. I tried using a mock application as in ActivityUnitTestCase and startActivity with ActionBarActivity and changed the parent theme in values-v11 etc. as suggested in ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat but it still does not work. You need to use a Theme.AppCompat theme (or descendant) with this activity does not give an answer either, als the person asking the question neither had an Theme.AppCompat specified in his manifest (which I do), nor did he really want to extend ActionBarActivity (which I do). His solution was to simply extend Activity instead. What am I doing wrong? This is the error I get (Failure-Trace from the Junit-Window): java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108) at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57) at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) at android.hello.HelloWorldActivity.onCreate(HelloWorldActivity.java:14) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.test.ActivityUnitTestCase.startActivity(ActivityUnitTestCase.java:158) at android.hello.test.HelloWorldActivityTest.setUp(HelloWorldActivityTest.java:26) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661) HelloWorldActivity.java packag…

http://stackoverflow.com/a/23640082
has comment: http://stackoverflow.com/comment/36328882
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36329565
score: 4
type: Answer
upvote count: 4
has body: Good for you that you wrote an unit test! For future reference: You want to test all kinds of edge values, which means for numbers at least 0, -1, 1, MAX_VALUE, MIN_VALUE - that would've caught the second bug you missed :-) The problem with your code is that: synchronized(l) {} translates to: synchronized(Long.valueOf(l)){}. valueOf caches Longs in the range -128, 127 but even this is optional (the JLS only requires it for integers surprisingly!). Consequently as soon as your ids are larger than 127 your whole scheme falls apart. Your second method is the way to go, but you cannot just make the method synchronized - that will just synchronize on this, so doesn't guarantee atomicity for the static map. Instead do something like this: Object newLock = new Object(); Object oldLock = map.putIfAbsent(id, newLock); Object lock = oldLock != null ? oldLock : newLock; synchronized(lock) { }
has comment: http://stackoverflow.com/comment/36303886
downvote count: 0
has comment: http://stackoverflow.com/comment/36303155
has comment: http://stackoverflow.com/comment/36303303
has comment: http://stackoverflow.com/comment/36303281
answers question: http://stackoverflow.com/q/23638792
accepted answer of: http://stackoverflow.com/q/23638792

http://stackoverflow.com/q/23701142
has comment: http://stackoverflow.com/comment/36421793
has comment: http://stackoverflow.com/comment/36420833
tagged with: java
tagged with: memory
has answer: http://stackoverflow.com/a/23701517
type: Question
has body: public static void main(String args[]) throws FileNotFoundException, IOException { FileReader in = new FileReader("/home/aoblah/Downloads/file1.txt"); BufferedReader br = new BufferedReader(in); // Scanner in = null; String answer = null; String verb = null; String line = null; String [] split_npn = null; String [] split_pn = null; String [] split_dp2 = null; String [] split_dp3 = null; HashMap&lt;String, HashMap&lt;String, ArrayList&lt;String&gt;&gt;&gt; hmap = new HashMap&lt;String, HashMap&lt;String, ArrayList&lt;String&gt;&gt;&gt;(); try { while ((line = br.readLine()) != null) { if(line.contains("verb")) { verb = line.substring(0, line.indexOf("(")); if(line.contains("npn")){ String test = line.substring(line.indexOf("npn")); answer = test.substring(test.indexOf("npn"),test.indexof(']')); answer = answer.replace(",", " " ); split_npn = answer.split(" "); } if(line.contains("pn")){ String test = line.substring(line.indexOf("pn")); answer = test.substring(test.indexOf("pn"), test.indexOf(']')); answer = answer.replace(",", " " ); split_pn = answer.split(" "); } if(line.contains("dp2")){ String test = line.substring(line.indexOf("dp2")); answer = test.substring(test.indexOf("dp2"), test.indexOf(']')); answer = answer.replace(",", " " ); split_dp2 = answer.split(" "); } if(line.contains("dp3")){ String test = line.substring(line.indexOf("dp3")); answer = test.substring(test.indexOf("dp3"), test.indexOf(']')); answer = answer.replace(",", " " ); split_dp3 = answer.split(" "); } } if(split_npn != null){ ArrayList&lt;String&gt; npn = new ArrayList&lt;String&gt;(); hmap.put(verb, new HashMap&lt;String, ArrayList&lt;String&gt;&gt;()); for(int i = 1; i&lt; split_npn.length; i++){ npn.add(split_npn[i]); } npn.trimToSize(); hmap.get(verb).put("npn", npn); } if(split_pn != null){ ArrayList&lt;String&gt; pn = new ArrayList&lt;String&gt;(); hmap.put(verb, new HashMap&lt;String, ArrayList&lt;String&gt;&gt;()); for(int i = 1; i&lt; split_pn.length; i++){ pn.add(split_pn[i]); } …
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36420577
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/36420650
linked to: http://stackoverflow.com/q/9619092
type: UnansweredQuestion
has title: Facing Problems while displaying entire hashmap - java out of heap space
has answer: http://stackoverflow.com/a/23701499
tagged with: hashmap

http://stackoverflow.com/comment/36554751
comment on: http://stackoverflow.com/a/23768393
type: Comment
has text: analyze what? I put println in the code and I know that the error starts in readline (), because at some point the line is blank inside BufferedReader master and slave expect each other ... but it is not defined in a moment sometimes this testing everything, sometimes only 50, sometimes more ... i thing is because i put "\n" in outToServer.writeBytes but this is Necessary ...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36491370
score: 0
comment on: http://stackoverflow.com/q/23737958
type: Comment
type: QuestionComment
has text: Sure, but if I bundle my entity layer in the same EAR as my app, then I am coupling the two. App#2 will need App#1 deployed if it wants to use the entity layer.

http://stackoverflow.com/q/23642529
has comment: http://stackoverflow.com/comment/36308285
tagged with: string
has comment: http://stackoverflow.com/comment/36308706
has body: I am not 100% sure if this is a relevant question around here, but I find this thing interesting. When splitting a string into an array of strings in Java like this: String[] array = "yolo".split(""); The implementation in Java 7 and Java 8 is a little bit different. In Java 8: array.length is 4 and the array looks like this ["y","o","l","o"] In Java 7: array.length is 5 and the array looks like this ["","y","o","l","o"] Is this a bug that wasn't fixed until Java 8 (I seem to remember that you would get Java 7 result in older versions of Java aswell)? Shouldn't code like this be backward compatible, which means that the method should return the same result in Java 7 and Java 8?
type: UnansweredQuestion
tagged with: java-8
linked to: http://stackoverflow.com/q/22718744
answer count: 0
has comment: http://stackoverflow.com/comment/36308452
tagged with: java
duplicate of: http://stackoverflow.com/q/22718744
type: Question
has title: String split() method implementation different from Java 7 to Java 8
has comment: http://stackoverflow.com/comment/36308632
score: 0
tagged with: java-7

http://stackoverflow.com/comment/61333467
type: QuestionComment
comment on: http://stackoverflow.com/q/23704616
has text: do you think this is supported now in dropwizard?
type: Comment
score: 0

http://stackoverflow.com/comment/36373057
comment on: http://stackoverflow.com/a/23672484
type: AnswerComment
has text: Difference is -- dependency. It's so basic an operation I'm continuously surprised there is no sane "plain Java" answer -- especially since Python has this since ever? Today I do exactly that: `kcharselect` to get `\u` escape and write the name in comment. But this all: waste of time, error prone and dangerous duplication.
type: Comment
score: 0

http://stackoverflow.com/comment/36345854
has text: In the first code, removing `super` will get you `30` for `e`. Calling instance method in constructor is dangerous as the object is not yet fully initialized (this applies mainly to methods than can be overriden). Also complex processing in constructor is known to have a negative impact on testability.
comment on: http://stackoverflow.com/q/23661541
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23661274
type: Answer
score: 0
has body: If you dont want to use an external library, you need to write your own ClassLoader. The most simple implementation i found is here. /* * Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ package com.sun.btrace; /** * A simple class loader that loads from byte buffer. * * @author A. Sundararajan */ final class MemoryClassLoader extends ClassLoader { MemoryClassLoader() { this(null); } MemoryClassLoader(ClassLoader parent) { super(parent); } Class loadClass(String className, byte[] buf) throws ClassNotFoundException { return defineClass(className, buf, 0, buf.length); } }
answers question: http://stackoverflow.com/q/23660817

http://stackoverflow.com/comment/36334054
type: Comment
type: QuestionComment
has text: But when I run setup rhc bash : rhc : command not found The version of ruby seems to be the 193 but I can not use the command I know to check rpm -qa because the server does not allow my user if there is a suggestion to check this otherwise the server will allow me to give this tip . If you know another way for me to debug my application , finally , accept tips . good job and good luck ...
score: 0
comment on: http://stackoverflow.com/q/23629947

http://stackoverflow.com/q/23722442
type: Question
type: AnsweredQuestion
has title: -C# / JAVA- Get PID on Applications run in CMD
score: 0
accepted answer: http://stackoverflow.com/a/23727647
answer count: 1
has comment: http://stackoverflow.com/comment/36464692
tagged with: c#
tagged with: java
has body: poor english sorry How to find a java PID? Process Server = new Process(); Server.StartInfo.FileName = "cmd.exe"; Server.StartInfo.RedirectStandardInput = true; Server.StartInfo.RedirectStandardOutput = true; Server.StartInfo.RedirectStandardError = true; Server.StartInfo.UseShellExecute = false; Server.Start(); StreamWriter InputCommands; InputCommands = Server.StandardInput; InputCommands.WriteLine(@"cd ""D:\Other\Server"""); InputCommands.WriteLine(@"java -jar Server155.jar"); can be input InputCommands.WriteLineAsync("status"); i try to use Server.StartInfo.FileName = "java.exe"; Server.StartInfo.Arguments = " -jar Server155.jar" to direct get PID but java path changed to 'C:\windows\system32' or 'C:\Users\name' but also can't input anymore and the jar can't to load other files java -jar "D:\JavaServer\test.jar" Correct Path @ .bat run D:\JavaServer\test.jar D:\JavaServer\file\.... WIN key + R to run java D:\JavaServer\test.jar C:\windows\system32\file\.... cmd without CD path D:\JavaServer\test.jar C:\users\username\file\.... how to get PID and run in Correct Path? thx for help
has answer: http://stackoverflow.com/a/23727647
has comment: http://stackoverflow.com/comment/36462176

http://stackoverflow.com/comment/36273856
has text: retainAll seems not to be performant, see my comment in the first answer. @OlegEstekhin: I'm using integer also in the working code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23616561

http://stackoverflow.com/comment/36431752
type: QuestionComment
comment on: http://stackoverflow.com/q/23706992
type: Comment
has text: Try writing several text files, with with `\n`, one with `\r` and with `\n\r` as line endings, open this in NotePad on Windows to see the difference
score: 0

http://stackoverflow.com/q/23755032
downvote count: 0
accepted answer: http://stackoverflow.com/a/23873167
favorite count: 0
has title: EJB @Startup on Jetty
tagged with: jetty
upvote count: 1
has body: I need to make this code (that works with JBoss) run with Jetty: import javax.annotation.PostConstruct; import javax.ejb.Singleton; import javax.ejb.Startup; import javax.inject.Inject; import org.picketlink.idm.PartitionManager; import org.picketlink.idm.model.basic.Realm; @Startup @Singleton public class PicketLinkStartup { @Inject private PartitionManager partitionManager; @PostConstruct public void workaround() { /* * This forces the partition manager to be loaded on app startup. Without * this, it is possible for a FailedAuthenticationException to leave * picketlink in a bad state where the default partition is no longer * accessible. */ partitionManager.getPartition(Realm.class, Realm.DEFAULT_REALM); } } I need to have this PicketLinkStartup run at Jetty startup. Is there a way to do that?
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23873167
tagged with: ejb
answer count: 1

http://stackoverflow.com/comment/36413521
type: Comment
type: QuestionComment
has text: Thank you all. Were all useful. Thank you @Ray
comment on: http://stackoverflow.com/q/23696775
score: 0

http://stackoverflow.com/q/23777350
has title: Unable to run projects on netbeans-8
favorite count: 0
type: Question
score: 3
tagged with: netbeans
upvote count: 3
has body: I have just installed Netbeans8.0 and JDK 8.0 but i am facing three problems: 1. When I try to run my previous Netbeans-7.4 projects on netbeans 8 it gives this error: GlassFish Server 4.0, deploy, Connection refused: connect, false C:\Users\admin\Documents\NetBeansProjects\Netbeans8project\nbproject\build-impl.xml:1048: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 3 seconds) 2. It is giving this error when i try to see library after right clicking the project: Missing library-hibernate support 3. When I am creating a new project it is not showing Java8 in the Java EE version. I have googled these problems and triedfew solutions but I am unable to resolve this problem.
answer count: 1
has answer: http://stackoverflow.com/a/23778207
tagged with: java
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/23778207

http://stackoverflow.com/comment/36332964
comment on: http://stackoverflow.com/q/23655462
score: 0
type: Comment
type: QuestionComment
has text: Depends on what do you want to archieve. If you want to secure hash passwords you should read this: https://crackstation.net/hashing-security.htm

http://stackoverflow.com/q/23688255
tagged with: java
has title: "Live" byte source interface?
accepted answer: http://stackoverflow.com/a/24440857
type: Question
has body: I'm facing what I would expect to be a common problem, but I haven't been able to find an existing solution. I want to make sure I'm not reinventing the wheel before I roll my own. Some time ago, I wrote a Bluetooth serial library in which a worker thread establishes the socket connection and then reads from it, posting callbacks in the UI thread whenever data is received. My rationale is that you typically want to do I/O (especially blocking I/O) outside the UI thread, so why not let the library take care of it? The app just needs to implement the callback interface to handle incoming data. Something like this: public interface ConnectorListener { void onData(BluetoothConnector connector, byte[] data); } Now I want to generalize my interfaces to handle other serial byte sources and sinks. So once again, I'm casting around to see if there's an existing interface that I could use...
has answer: http://stackoverflow.com/a/24440857
score: 0
answer count: 1
tagged with: android
tagged with: serial-port
type: AnsweredQuestion

http://stackoverflow.com/q/23650193
has comment: http://stackoverflow.com/comment/36322789
tagged with: osx-mavericks
has body: How to launch terminal and execute some commands using java code in MAC? Similar question i have found for LINUX OS from below link. how to run a command at terminal from java program?
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/15356405
has comment: http://stackoverflow.com/comment/36322724
has title: How to open Terminal and execute command using java code in OSX
tagged with: terminal
has comment: http://stackoverflow.com/comment/136350511
has answer: http://stackoverflow.com/a/54527603
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36322938
has answer: http://stackoverflow.com/a/23650641

http://stackoverflow.com/a/23725876
answers question: http://stackoverflow.com/q/23725822
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/36468377
downvote count: 0
has body: try this private char[] w; BufferedReader br = new BufferedReader(new FileReader("pathToFile...")); String s = null; // to iterate for each line in file while ((s = br.readLine()) != null ) { // this will store chars of line w = s.toCharArray(); //TODO - do something based on w array }
type: Answer

http://stackoverflow.com/comment/36309670
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23642607
type: Comment
has text: Give. Us. The. Complete. Stack. Trace.

http://stackoverflow.com/q/23708026
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23708172
answer count: 2
has title: ActivityNotFoundException while using startActivity(Intent)
upvote count: 0
has comment: http://stackoverflow.com/comment/36433645
has comment: http://stackoverflow.com/comment/36433643
has comment: http://stackoverflow.com/comment/36433831
favorite count: 0
has answer: http://stackoverflow.com/a/23708070
has comment: http://stackoverflow.com/comment/36433657
tagged with: android
accepted answer: http://stackoverflow.com/a/23708172
tagged with: android-activity
possible better answer: http://stackoverflow.com/a/23708070
has comment: http://stackoverflow.com/comment/36433742
has comment: http://stackoverflow.com/comment/36433680
has body: Here's the error, referring to where I call startActivity(Intent): `05-17 01:40:37.918: E/AndroidRuntime(12997):android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.rhombi.Menu}; have you declared this activity in your AndroidManifest.xml? Here's how I use startActivity(Intent) in com.rhombi.Intro: startActivity(iMenu); Here's how I declare it earlier, in the same class: public Intent iMenu = new Intent(this, Menu.class); Here's how I declare it all in my manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> I've searched through a TON of other questions about this and I can't seem to figure out what the issue is. The one thing that makes my issue unique is that little forward slash when it tells me that it's unable to find the explicit activity class ("{/com.rhombi.Menu}"). That never showed up in my searches, but I appear to be doing everything right.
score: -3
tagged with: android-intent
type: Question
tagged with: logcat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36433904

http://stackoverflow.com/comment/36362620
has text: Did you try this @user3627802
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23670365

http://stackoverflow.com/q/23659606
duplicate of: http://stackoverflow.com/q/2429494
tagged with: char
answer count: 1
tagged with: string
favorite count: 0
has body: We had an odd thing in our logging happen today. Printed is a list of integers and longs separated by commas, like the following code: public class Main { public static void main(String[] args) throws InterruptedException { long l = 10; System.out.println(l + ';' + "text"); } } The problem was that the ; disappeared from the output.
linked to: http://stackoverflow.com/q/21387948
has answer: http://stackoverflow.com/a/23659607
has comment: http://stackoverflow.com/comment/36341341
duplicate of: http://stackoverflow.com/q/21387948
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36370837
has title: Why does a char disappear when concatinated with an integer
downvote count: 1
type: Question
tagged with: operator-overloading
accepted answer: http://stackoverflow.com/a/23659607
upvote count: 0
linked to: http://stackoverflow.com/q/2429494
tagged with: long-integer
score: -1
has comment: http://stackoverflow.com/comment/36341202

http://stackoverflow.com/comment/36301429
comment on: http://stackoverflow.com/q/23622703
type: QuestionComment
type: Comment
has text: Right now they don't know that they can with Ctrl-click which is the problem. I'd like them to be able to select and deselect with just a click (no Ctrl key).
score: 0

http://stackoverflow.com/q/23618560
tagged with: background
answer count: 1
has answer: http://stackoverflow.com/a/23618709
has body: I am currently working on a little 2D Game based on Super Mario Bros. I'm using a Model-View-Controller-Pattern and i have a flickering issue in my Panel (extending JPanel). My blocks and everything but Mario are constantly flashing and i don't know why. I tried to do a BufferedReader to fix the problem but it did not change anyhting, neither a smaller resolution background did. I noticed that when i remove the background (and so we see traces left behind Mario), nothing flickers anymore but I can't let it like that... Do you have any ideas of where the problems come ? Thank you very much for your attention, I join the code of my GUI here. PS: I'm new in java so please forgive my beginner code and problems :). Also, forgive my english. I can add any other part of my code if needed. Note : level is my main model loop and there is different bonuses with differents effects on Mario as differents status like OnAir, etc. Window package GUI; import java.awt.Color; import java.awt.Component; import javax.swing.JFrame; import model.Level; import observable.Observator; public class Window extends JFrame implements Observator{ public Panel pan; Level level; public Window(Level level){ setVisible(true); setTitle("Mario"); setExtendedState(6); setDefaultCloseOperation(3); setLocationRelativeTo(null); setSize(level.cam.getHitboxx(),level.cam.getHitboxy()); setResizable(false); this.level = level; this.pan = new Panel(level); setContentPane(this.pan); } public void update(Level level){ this.level = level; this.pan.setLevel(this.level); this.pan.render(); this.pan.paintComponent(getGraphics()); } public Level getLevel() { return level; } public void setLevel(Level level) { this.level = level; } } Panel package GUI; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import ja…
type: AnsweredQuestion
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/23618709
type: Question
linked to: http://stackoverflow.com/q/23619540
has title: Flickers due to the background repaint despite BufferedReader
score: 0
tagged with: flicker
tagged with: java

http://stackoverflow.com/comment/36561335
comment on: http://stackoverflow.com/a/23774652
score: 0
type: Comment
has text: no without `tld` I want to get the output this is my task
type: AnswerComment

http://stackoverflow.com/q/23756023
downvote count: 0
favorite count: 0
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/36527035
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23757056
upvote count: 2
tagged with: java
tagged with: vaadin
type: Question
has title: How to define validation constraints on TextFields in vaadin?
accepted answer: http://stackoverflow.com/a/23757056
score: 2
tagged with: validation
has body: I have a TextField and add validation by field.addValidator(validator). I want to use the field both for editing an entity, as well as creating a new one. Problem: when creating a new one, I would like to have more validators applied then when editing. Eg: creating an Account would require a UniqueAccountValidator added to the textfield. But then, when I editing the account (with the same form), I'd like to skip only the UniqueAccountValidator as the object is not be be created new, but merged. Is is possible to somehow tell a vaadin BeanFieldGroup or an AbstractField to skip certain validators in specific cases?
answer count: 1
has comment: http://stackoverflow.com/comment/36528621

http://stackoverflow.com/comment/36428181
type: Comment
type: QuestionComment
has text: I think that in the computer graphics world (0, 0) is typically the top left, not the bottom left as you might have learned in math. Don't know if this is something you can change.
score: 0
comment on: http://stackoverflow.com/q/23705063

http://stackoverflow.com/a/23709489
type: Answer
has body: Play's JPA functionality is not present by default. Add javaJpa to your dependencies in your build.sbt. Refresh your IDEA project or restart IDEA to get it to pick it up. libraryDependencies ++= Seq( // Other dependencies javaJpa, // Other dependencies )
answers question: http://stackoverflow.com/q/23652388
score: 1
has comment: http://stackoverflow.com/comment/48725972
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/23752112
downvote count: 0
type: Answer
has body: If you want to limit only one dimension then just do not limit the other: component.setMaximumSize( new Dimension( Integer.MAX_VALUE, requiredMaxHeight ) );
upvote count: 11
answers question: http://stackoverflow.com/q/23751759
has comment: http://stackoverflow.com/comment/106995147
score: 11

http://stackoverflow.com/comment/36390638
type: Comment
has text: But i mentioned that it worked !! and i didn't know about the accepted answer thing i'm a new member.
comment on: http://stackoverflow.com/q/23684587
score: 0
type: QuestionComment

http://stackoverflow.com/a/23721883
score: 0
has body: Since Stack Overflow is a programming helpdesk and not a game strategy site, here's a way to generate the strategy programmatically: Step 1: model the possible game states as a game tree Step 2: label the leaf nodes of the game tree as wins, losses or ties Step 3: whenever it's the computer's turn, use a minimax search to progress down the game tree towards options that are beneficial to the computer assuming the other player minimaxes as well (winning is better than tying, tying is better than losing). And it's done. That's literally all it takes to create an AI for a game as simple as tic-tac-toe. Just look down the tree to see which branch is certain victory and which branch is certain loss, and go with the best one. For extra practice and efficiency, Alpha-Beta pruning makes the minimax part a bit faster, although with small boards of tic-tac-toe this won't matter in practice.
answers question: http://stackoverflow.com/q/23721722
type: Answer

http://stackoverflow.com/q/23690532
has answer: http://stackoverflow.com/a/23691942
score: -1
has body: I have a main screen that hosts a StackPane. In this StackPane, any particular screen may be loaded and displayed at a time. The first screen, for example, is going to be a splash screen. Should I make the root container of the splash screen an AnchorPane or something? I want for my screen to be resized to fit its parent upon dynamically loading it into the top level StackPane. If the window with the StackPane gets resized, then the child screens resize along with it. If this were Android the answer would be fit_to_parent, but unfortunately this is not it. :P
has title: Dynamically added nodes do not fit to parent
tagged with: javafx-8
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23691942
type: AnsweredQuestion
tagged with: java
tagged with: javafx
downvote count: 2
upvote count: 1
type: Question

http://stackoverflow.com/comment/36475356
score: 0
type: Comment
has text: I tried using AnchorPane as my root, but it doesn't support a controller, and VBox does not support a controller either, but upon compiling with your VBox declaration, i had a successful build of my GUI with button functionality, Thank you. Just not sure if this is orthodox as My IDE is claiming that VBox does not support a controller property.
type: AnswerComment
comment on: http://stackoverflow.com/a/23729459

http://stackoverflow.com/a/23644661
score: 2
has body: Nothing wrong it's just a coding style preference. Some people like to write code that is implicit and some don't. If you don't call super constructor from your child class constructor compiler will place call to super's default constructor in byte code for you. See this SO question as well
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23644520
type: Answer

http://stackoverflow.com/a/23751647
upvote count: 16
has body: it works. String fname="C:\\textfiles\\db\\query\\query.txt"; String split[] = fname.split("\\\\"); System.out.println(" :: value " + split[0] );
downvote count: 1
score: 15
answers question: http://stackoverflow.com/q/23751618
has comment: http://stackoverflow.com/comment/43445944
type: Answer

http://stackoverflow.com/a/23671156
answers question: http://stackoverflow.com/q/23671043
score: 0
type: Answer
has body: This is a general technique not only applicable to Android. Normally you send the information with some header as tip for you how to process it. E.g. everything you send can be seen as a byte array. The first byte can be used as a "message type" e.g. 0x00 represents string, 0x01 represents image, and so on. If you are unsure about the length of the rest of the message and you need to prepare buffer for it, you can also have the 2 - 5 bytes as an int telling how long this message is. Then you decode the result of the message accordingly.

http://stackoverflow.com/comment/36477344
comment on: http://stackoverflow.com/q/23730416
has text: @shan You should really check out Java's [generics](http://docs.oracle.com/javase/tutorial/java/generics/). Using generics is *significantly* better than writing a case for every class you might come across. Generics would allow you to use your `Stack` class for *any* data type (besides primitives)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36382732
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23680734
has text: Where in HTML are placed username and particular name?

http://stackoverflow.com/comment/36541502
type: Comment
has text: In my questoin with title `And here is an activity. From it I want to start SSBirthActivity:` there is an activity where I have used `Intent`. Then my `SSBirthActivity` starts, but shows the wite screen (I've understood that cause of the title changing). And I want to know "Why it shows the wite screen?". Get it?
comment on: http://stackoverflow.com/a/23763985
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36519090
comment on: http://stackoverflow.com/q/23732444
score: 0
type: Comment
type: QuestionComment
has text: @user3605253 when confronted with an apparent non-termination issue, apply [***empirical orders of growth*** analysis](https://en.wikipedia.org/wiki/Analysis_of_algorithms#Empirical_orders_of_growth). Run your program for some smaller `n`'s, where you'd get run times in 1..10..100 seconds range, then make the projection for *your* `n`. -- as for your code, make your `sum` a `long` variable, not `int`, and in the `isPrime()` function change the `for (i = 2; i <= n / 2; i++) {` to `for (i = 2; i <= n / i; i++) {` and it will work for you.

http://stackoverflow.com/a/23636500
has comment: http://stackoverflow.com/comment/36297031
upvote count: 3
has comment: http://stackoverflow.com/comment/36300999
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36296224
answers question: http://stackoverflow.com/q/23616927
has body: "there is no way for me to enforce the rule of the last 2 characters being either letters or numbers." Sorry didn't see you were using a MaskFormatter. If you look at the API docs, you'll see a chart of possible character formats # Any valid number, uses Character.isDigit. ' Escape character, used to escape any of the special formatting characters. U Any character (Character.isLetter). All lowercase letters are mapped to upper case. L Any character (Character.isLetter). All upper case letters are mapped to lower case. A Any character or number (Character.isLetter or Character.isDigit) ? Any character (Character.isLetter). * Anything. H Any hex character (0-9, a-f or A-F). So you could actually just use "##-####UU" EDIT using InputVerifier import javax.swing.InputVerifier; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class TestMaskFormatter { private static final String REGEX = "^\\d{2}\\-\\d{4}([A-Z]{2})??"; private static InputVerifier getInputVerifier() { InputVerifier verifier = new InputVerifier() { @Override public boolean verify(JComponent input) { JTextField field = (JTextField) input; String text = field.getText(); return text.matches(REGEX) || text.isEmpty(); } @Override public boolean shouldYieldFocus(JComponent input) { boolean valid = verify(input); if (!valid) { JOptionPane.showMessageDialog(null, "Must Match format: 00-0000AA"); JTextField field = (JTextField) input; field.setText(""); } return valid; } }; return verifier; } public static void main(String[] args) { JTextField fieldWithVerifier = new JTextField(10); fieldWithVerifier.setInputVerifier(getInputVerifier()); JTextField field1 = new JTextField(10); JPanel panel = new JPanel(); panel.add(fieldWithVerifier); panel.add(field1); JOptionPane.showMessageDialog(null, panel); } }

http://stackoverflow.com/a/23777070
has comment: http://stackoverflow.com/comment/36566496
answers question: http://stackoverflow.com/q/23776982
score: 0
has comment: http://stackoverflow.com/comment/36565566
has comment: http://stackoverflow.com/comment/36566417
has body: you may need to increase java-heap size : java -Xmx2048M ExcelReader
has comment: http://stackoverflow.com/comment/36566366
type: Answer

getpixel
type: Tag
tag name: getpixel
tags question: http://stackoverflow.com/q/23679154

http://stackoverflow.com/comment/36440980
comment on: http://stackoverflow.com/a/23657846
type: Comment
has text: Thank you for all your help. Changing code based on your guidance, processing characters in 2D arrays is completed in 2200ms which is 1/3 faster than before. I have not changed them to array of integers, just left them as arrays of bytes. Is that the results you get? Also I have noticed that if I change the code where the dot product is calculated between the stored Character and the extracted Character (in the nested loops) with "final int dotProduct = (int) Math.random() * 1000;" the procedure finishes in less than 200ms. Thus, that line is the one that takes all the process.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23627414
tagged with: timer
tagged with: android
accepted answer: http://stackoverflow.com/a/23628473
has body: Is it possible to make a countdown timer with Toasts or a ProgressDialog? When I start my app, there pop-up a ProgressDialog with the text loading... Untill the data is loaded, I dismiss the dialog and the listview pop-up with the textviews and stuff. But on the startup I check my network status... When the network is connected, I start my background class.. But if it's not, I restart my activity every 10 seconds with a timer (shown below). But I will show a counter down toast or change the text in my dialog if there is no connection, like: (show ->) "Automatic refresh after 10..." (&lt;- hide) (show ->) ""Automatic refresh after 9..." till "Automatic refresh after 0..." and then the 10 seconds are past.. and the lines with finish(); and startActivity begin.. This is all in my onCreate: global.loading_dialog(this); //start progressdialog boolean network_connected = false; if(check_network.isInternetAvailable(this)) { network_connected = true; new connect_task_main().execute(""); //the background class starts } else { network_connected = false; global.toast.setText("No Internet Connection"); //toast text global.toast.show(); //toast start global.cancel_toast(2500); //toast stop } if (network_connected == false) { final Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { global.spinning_dialog.dismiss(); // when the task activates, then close the dialog timer.cancel(); //stop de timer finish(); //close the activity startActivity(new Intent(main_activity.this, main_activity.class)); //start a new activity } }, 10000); //after 10 seconds, the task will be active. } else { }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23627949
tagged with: java
has answer: http://stackoverflow.com/a/23627949
has answer: http://stackoverflow.com/a/23628473
has answer: http://stackoverflow.com/a/23627885
type: Question
tagged with: dialog
has comment: http://stackoverflow.com/comment/36278680
score: 0
answer count: 3
upvote count: 1
downvote count: 1
tagged with: countdown
favorite count: 0
has title: How To Make A Countdown Timer Android Java?

printers
tag name: printers
tags question: http://stackoverflow.com/q/23657748
type: Tag
tags question: http://stackoverflow.com/q/23766229

http://stackoverflow.com/a/55590779
has body: If nothing happens even if you added all the annotation needed, try to add this dependency to your pom.xml, I just faced the same problem and resolved it by adding this one here: commons-configuration commons-configuration 1.9
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23714530
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/23636111
answers question: http://stackoverflow.com/q/23636058
upvote count: 5
has body: Do you mean - it looks like you are setting the wrong array: String[] ordet = new String[6]; ordet[0] = "akilles"; ordet[1] = "kopper"; ordet[2] = "lipton"; ordet[3] = "mus"; ordet[4] = "orkester"; ordet[5] = "toving";
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36295643
score: 5
accepted answer of: http://stackoverflow.com/q/23636058
type: AcceptedAnswer

http://stackoverflow.com/comment/36519971
type: Comment
type: QuestionComment
has text: What does the build path entry for JUnit look like? Look into `.classpath` and append the line to your question.
comment on: http://stackoverflow.com/q/23753214
score: 0

http://stackoverflow.com/q/23671621
type: UnansweredQuestion
tagged with: compare
has answer: http://stackoverflow.com/a/23671642
duplicate of: http://stackoverflow.com/q/513832
upvote count: 2
has body: Hi I have a strange problem with my code and I cant figure out whats wrong. I have: ArrayList called players Class: Player Class: Name Player class contains Name class which contains 3 Strings FirstName MiddleName LastName The problem is when im trying to do For( int i = 0; i &lt; players.size(); i++) { if( players.get(i).getName().getFirst() == "First1") { // Some Code } System.out.printf(players.get(i).getName().getFirst()); } If statement is never true, weird thing is when im using system.out to check as below System.out.printf(players.get(i).getName().getFirst()); it returns: First1 First2 First3 getName() method returns object name and getFirst() returns String FirstName Any ideas where the problem is?
downvote count: 2
has comment: http://stackoverflow.com/comment/36364556
type: Question
has comment: http://stackoverflow.com/comment/36364628
tagged with: java
has answer: http://stackoverflow.com/a/23671646
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36364587
tagged with: string
has title: String comparison in Java Weird
favorite count: 0

http://stackoverflow.com/a/23709320
type: Answer
has body: Remember, painting is destructive. It might be possible to use AlphaComposite to achieve this result, but a simpler solution might be to simple constructive a compound shape and paint that instead. The following example creates two Rectangles, one been the area we want to fill and one been the area we want to show, the second is then subtracted from the first (to create the window) and then the result is painted on top of the image import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.geom.Area; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class ShowArea { public static void main(String[] args) { new ShowArea(); } public ShowArea() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private BufferedImage img; public TestPane() { try { img = ImageIO.read(new File("sample.png")); Rectangle bounds = new Rectangle(0, 0, img.getWidth(), img.getHeight()); Rectangle clip = new Rectangle(150, 10, 100, 100); Area area = new Area(bounds); area.subtract(new Area(clip)); Graphics2D g2d = img.createGraphics(); g2d.setColor(Color.BLACK); g2d.setComposite(AlphaComposite.SrcOver.derive(0.5f)); g2d.fill(area); g2d.dispose(); } catch (IOException ex) { …
answers question: http://stackoverflow.com/q/23709070
accepted answer of: http://stackoverflow.com/q/23709070
has comment: http://stackoverflow.com/comment/36521485
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/a/23680336
upvote count: 2
has comment: http://stackoverflow.com/comment/36381611
has body: You're adding the ActionListener to a JButton: GameChoiceButton.addActionListener(new ActionListener(){ But then you're trying to cast the source of the ActionEvent (which will always be that JButton) to a JComboBox (which it will never be): JComboBox comboBox = (JComboBox) e.getSource(); Just refer to the JComboBox directly instead of trying to finagle it out of the getSource() function. You'll either have to pass the JComboBox into the ActionListener, or call a method in the outer class that accesses the JComboBox, or make the JComboBox final.
accepted answer of: http://stackoverflow.com/q/23680161
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23680161
type: Answer
has comment: http://stackoverflow.com/comment/36381545

http://stackoverflow.com/comment/36395545
has text: do you mean yu are getting boxes in the log generated by the server side code...or the code itself ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23687640
score: 0

http://stackoverflow.com/q/23685431
downvote count: 0
favorite count: 0
has title: JUnit: Calling @After to set object to Null
answer count: 4
has answer: http://stackoverflow.com/a/23685486
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23685470
has body: Assume I have the following simple JUnit test private Person person; @Before public void createObject() { String firstName = "John"; String lastName = "Doe"; person = new Person(firstName, lastName); } @Test public void test1() { assert(firstName.equals("John")); } @Test public void test2() { assert(lastName.equals("Doe")); } Should I have an @After method that sets person = null? I tried a similar test without the @After method and I can't seem to figure out it putting it in there has any advantages or disadvantages. Ignore that the test names aren't very meaningful. I was just posting a simple example.
tagged with: java
has answer: http://stackoverflow.com/a/23685485
possible better answer: http://stackoverflow.com/a/23685486
type: Question
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/23685528
has answer: http://stackoverflow.com/a/23685470
tagged with: junit

http://stackoverflow.com/q/23705381
has title: Problems with ResultSet
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36429122
has answer: http://stackoverflow.com/a/23705509
has body: Look at the code below. The issue here is that the query returns one column(LOGIN) with no rows(that is what SQL Developer says), rs.next() is being proceed and rs.getString(1) returns the first row from table Users. I do not understand the fact that under the field currentRow in ResultSet is value of -1. It would mean that it gets one row from the query which is a mass incoherence. How should I force next() method not to step forward if there's no row returned? ResultSet rs = null; String name = null; Statement stat = db.conn.createStatement(); String query = "SELECT Users.LOGIN FROM Users, Accessibility WHERE Accessibility.Users_IDGRANTING=4 AND Users.ID=Accessibility.Users_IDRECEIVING"; rs = stat.executeQuery(query); while(rs.next()) { name = rs.getString(1); }
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36428966
type: Question
has comment: http://stackoverflow.com/comment/36429043
answer count: 2
has comment: http://stackoverflow.com/comment/36428930
has comment: http://stackoverflow.com/comment/36429110
has answer: http://stackoverflow.com/a/23705500
tagged with: sql
has comment: http://stackoverflow.com/comment/36428907

http://stackoverflow.com/comment/36485208
has text: Yeah it is a proper url
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23734907
type: AnswerComment

http://stackoverflow.com/a/23700372
has body: Some understanding about Morgan's laws could help here. The law says (sorry for the weird syntax, but I think the message is clear) that : (!P) OR (!Q) == !(P AND Q) (!P) AND (!Q) == !(P OR Q) So when you use || (OR) in your condition while(dice1 !=1 || dice2 !=1) is exactly the same as while(!(dice1 == 1 &amp;&amp; dice2 == 1)) so it will looop until both dice are 1. On the other hand, if you use &amp;&amp; (AND): while(dice1 !=1 &amp;&amp; dice2 !=1) it's the same as while(!(dice1 == 1 || dice2 == 1)) so it means that it will loop until one or two of the dice is/are 1.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23700287
answers question: http://stackoverflow.com/q/23700287
upvote count: 3
score: 3

http://stackoverflow.com/comment/36469210
comment on: http://stackoverflow.com/a/23726427
type: Comment
score: 0
has text: @masonc15: that has nothing to do with height and all to do with your img variable being null. Where do you assign a BufferedImage to this variable? Don't use it till you do!
type: AnswerComment

http://stackoverflow.com/comment/36568594
comment on: http://stackoverflow.com/q/23754871
score: 0
type: Comment
has text: @IsmailSen: Please add the command line or the Jenkins options how you start Sonar
type: QuestionComment

http://stackoverflow.com/comment/36339971
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23658678
has text: @Ralf Final size increases onli if the word is already in it. When The loop starts it has some certain size

http://stackoverflow.com/comment/36353018
comment on: http://stackoverflow.com/a/23664771
type: Comment
score: 0
has text: This looks simple. Any issues with this this approach?
type: AnswerComment

http://stackoverflow.com/a/23753049
has comment: http://stackoverflow.com/comment/36544472
has comment: http://stackoverflow.com/comment/36519680
type: Answer
has comment: http://stackoverflow.com/comment/36545814
answers question: http://stackoverflow.com/q/23752897
score: 0
has comment: http://stackoverflow.com/comment/36521421
has body: Here is java doc for Matcher#group(int) Returns the input subsequence captured by the given group during the previous match operation. For a matcher m, input sequence s, and group index g, the expressions m.group(g) and s.substring(m.start(g), m.end(g)) are equivalent. Capturing groups are indexed from left to right, starting at one. Group zero denotes the entire pattern, so the expression m.group(0) is equivalent to m.group(). If the match was successful but the group specified failed to match any part of the input sequence, then null is returned. Note that some groups, for example (a*), match the empty string. This method will return the empty string when such a group successfully matches the empty string in the input. So in order to use capturing group concept your pattern shall match with the string fully. Hope this helps. EDIT I think you are looking for something like this. Pattern p = Pattern.compile("(&gt;&gt;&gt;&gt;)?(!something!)?([\\d]{3})?([\\w]+)?([\\*]+)?(&lt;&lt;&lt;&lt;)"); String s1 = "&gt;&gt;&gt;&gt;!something!100num***&lt;&lt;&lt;&lt;"; Matcher m = p.matcher(s1); if(m.matches()) { for(int i=1;i&lt;=m.groupCount();i++) { System.out.println("Group " + i + ": " + m.group(i)); } } s1 = "101any&lt;&lt;&lt;&lt;"; m = p.matcher(s1); if(m.matches()) { for(int i=1;i&lt;=m.groupCount();i++) { System.out.println("Group " + i + ": " + m.group(i)); } } Here is the output for above: Group 1: &gt;&gt;&gt;&gt; Group 2: !something! Group 3: 100 Group 4: num Group 5: *** Group 6: &lt;&lt;&lt;&lt; Group 1: null Group 2: null Group 3: 101 Group 4: any Group 5: null Group 6: &lt;&lt;&lt;&lt; Hope this helps you in right direction.

http://stackoverflow.com/comment/36369050
has text: Which type of authentication are you using?
type: Comment
comment on: http://stackoverflow.com/q/23674054
score: 1
type: QuestionComment

http://stackoverflow.com/q/23640667
has comment: http://stackoverflow.com/comment/36314872
answer count: 2
has comment: http://stackoverflow.com/comment/36306104
tagged with: arraylist
tagged with: file-io
has comment: http://stackoverflow.com/comment/36392691
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23707662
has title: Refreshing values from a File to a JTable
has comment: http://stackoverflow.com/comment/36305709
tagged with: swing
type: Question
has body: I'm trying to refresh values in a JTable from a file so that I can display them in the table. I have a model, but I don't know why it's not working. I've tried pretty much everything that i could think of. Here is the code for the GUI and the TableModel: public void itemStateChanged(ItemEvent event) { if(event.getStateChange()== ItemEvent.SELECTED) { outputFile.filename= "C:\\File Database\\"+Dropdown.getSelectedItem(); outputFile.ReadData(); int count=0; System.out.println("Array list size:" +outputFile.filedata.size()); for(int i=0; i&lt; datafield1.getRowCount(); i++) { for(int j=0; j&lt; datafield1.getColumnCount(); j++) { fval= outputFile.filedata.get(count); count++; datafield1.setValueAt(fval,i,j); } } } Table model: import javax.swing.table.AbstractTableModel; public class PreviousDataRefresh extends AbstractTableModel { private static final long serialVersionUID = 1L; float[][] rowData = new float[15][11]; public int getColumnCount() { return 11; } public int getRowCount() { return 15; } public Object getValueAt(int rowIndex, int columnIndex) { return null; } public boolean isCellEditable(int row, int col) { //Note that the data/cell address is constant, //no matter where the cell appears onscreen. if (col &lt; 2) { return false; } else { return true; } } public void setValueAt(Object value, int row, int col) { rowData[row][col] = (Float) value; fireTableCellUpdated(row, col); } } The ArrayList works because every time I select a new file from the ComboBox I see the float values change, but I can't see them being inputted into the table.
tagged with: java
has answer: http://stackoverflow.com/a/23665306
tagged with: jtable
score: 0

http://stackoverflow.com/comment/74656901
has text: It might be easier to do `ObjectExpression fontTracking = Bindings.createObjectBinding(() -> Font.font(getWidth() / 4), widthProperty())` and then `textTracking.fontProperty().bind(fontTracking)`.
type: Comment
comment on: http://stackoverflow.com/a/34591983
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37161104
comment on: http://stackoverflow.com/q/23769143
score: 0
type: Comment
type: QuestionComment
has text: Hmm, are you in the same class as [this guy](http://stackoverflow.com/questions/24093360)?

http://stackoverflow.com/q/23658808
has comment: http://stackoverflow.com/comment/36340119
has title: How to wait for user to hit specific key?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23658998
has body: I'm creating a game using JavaFX8 that presents choices in a TextFlow and waits for the user to input a specific key then changes the text. For example: Create Character? (C)ontinue (E)xit The user presses 'C' on their keyboard and the following is displayed: Choose gender. (M)ale (F)emale (B)ack Pressing 'M' proceeds to next screen and so on. 'B' takes them back to the Create Character "state". There is no other user input available. No buttons, no text areas, nothing. They just press a key and it changes the text in the TextFlow. I have an EventHandler that is registering key presses correctly and placing the result in a static String field so it can be accessible by any method in the class. Is there a way to check that variable inside a method? It waits for user to press a key, checks value against array of valid values (based on the choices displayed in the TextFlow), returns it or keeps checking. infinite while loops cause the program to crash. This is asynchronous as the user could press a valid/invalid key at any time. I've looked into JavaFX concurrency (Task, Service, Worker) but it seems too complicated for me at this point. Maybe there is a simpler way that I have overlooked? Here is some code for my EventHandler which works just fine. static String userInput = ""; static EventHandler&lt;KeyEvent&gt; keyEvent=null; public void start(Stage stage) { /*bunch of code*/ keyEvent = new EventHandler&lt;KeyEvent&gt;(){ public void handle(KeyEvent ke) { userInput = String.valueOf(ke.getCharacter()); System.out.print(userInput); } }; scene.setOnKeyTyped(keyEvent); }
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/36339791
score: 0
tagged with: javafx-8
has answer: http://stackoverflow.com/a/23658998
answer count: 1

http://stackoverflow.com/comment/36543554
comment on: http://stackoverflow.com/q/23764528
score: 0
type: Comment
type: QuestionComment
has text: If you're using Hibernate, why your error message refer to eclipse link?

relative-path
type: Tag
tags question: http://stackoverflow.com/q/23635915
tag name: relative-path

http://stackoverflow.com/q/23632330
tagged with: unit-testing
type: Question
tagged with: testing
tagged with: mockito
has comment: http://stackoverflow.com/comment/36404539
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/23632930
downvote count: 1
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has body: valid construction: @InjectMocks SomeClass sc = mock(SomeClass.class); Invalid construction: @InjectMocks @Mock SomeClass sc; I want to inject mocks to another mock. I want to use only annotation style. Why was in Mockito forbid second construction ? Update example: public class ArrTest { private SomeClass someClass; public List&lt;String&gt; foo(){ anotherMethod(); // I suppose that this method works. I want to test it separately. //logic which I need to test return someClass.doSmth();// I suppose that this method works. I want to test it separately. } public void anotherMethod(){ ///... } } public class SomeClass { public List&lt;String&gt; doSmth(){ return null; } } test: public class ArrTestTest { @InjectMocks ArrTest arrTest = Mockito.mock(ArrTest.class); @Mock SomeClass someClass; @Test public void fooTest(){ Mockito.when(someClass.doSmth()).thenReturn(new ArrayList&lt;String&gt;()); Mockito.doNothing().when(arrTest).anotherMethod(); System.out.println(arrTest.foo()); } }
has title: Why Cannot I use Mock and InjectMocks together?
has answer: http://stackoverflow.com/a/23637037
tagged with: java
has answer: http://stackoverflow.com/a/23632436

http://stackoverflow.com/a/23679095
accepted answer of: http://stackoverflow.com/q/23679007
score: 0
type: AcceptedAnswer
has body: if your List has only one element this snippet: public E removeFirst() { E value=first.val; first=first.next; size--; } return value; } will result in NullPointException public E removeFirst() { E value=first.val; if (size&gt;=2) { first=first.next; } else if (size==1) { last=null; } size--; return value; }
type: Answer
answers question: http://stackoverflow.com/q/23679007

http://stackoverflow.com/q/23728424
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36473977
has comment: http://stackoverflow.com/comment/36473357
has comment: http://stackoverflow.com/comment/36473899
has comment: http://stackoverflow.com/comment/36474010
has comment: http://stackoverflow.com/comment/36473911
tagged with: java
has answer: http://stackoverflow.com/a/23728730
type: Question
has comment: http://stackoverflow.com/comment/36473415
has comment: http://stackoverflow.com/comment/36473661
has comment: http://stackoverflow.com/comment/36473580
has comment: http://stackoverflow.com/comment/36473403
has comment: http://stackoverflow.com/comment/36473838
has comment: http://stackoverflow.com/comment/36473994
has comment: http://stackoverflow.com/comment/36473601
has body: Let's say I have a large text file (few MB to GB) of random text, consisting only of lowercase letters, no spaces. However, someone appends a string somewhere in the middle of it (consisting only of lowercase letters, no spaces) of words from the English language. How would I go about finding where that string is and what it says, given that I do not know what the string is supposed to say (only that it's in English, and not completely random text)? I can use a dictionary of English words.
score: 0
has comment: http://stackoverflow.com/comment/36473394
has comment: http://stackoverflow.com/comment/36473630
answer count: 1
has comment: http://stackoverflow.com/comment/36473811
linked to: http://stackoverflow.com/q/1386275
has title: How might an algorithm search for a phrase within a large file?
has comment: http://stackoverflow.com/comment/36473795

http://stackoverflow.com/comment/110661098
type: AnswerComment
has text: But still we need to provide key to decrypt, where do we store that key?
type: Comment
comment on: http://stackoverflow.com/a/23693897
score: 12

http://stackoverflow.com/q/23701232
downvote count: 0
tagged with: applet
favorite count: 0
has answer: http://stackoverflow.com/a/23701418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36420575
has title: How can I stop image flickering in Java Applet?
upvote count: 1
type: Question
score: 1
tagged with: flicker
tagged with: java
accepted answer: http://stackoverflow.com/a/23701418
has body: My problem is that whenever I use a Java Applet I just coded, my png images flicker repeatdly. I have already changed my thread sleep time to smaller, and that does not remove the problem. Here is the code where I'm calling on the image to be shown: public void init(){ setSize(854, 480); Thread th = new Thread(this); th.start(); offscreen = createImage(854,480); d = offscreen.getGraphics(); addKeyListener(this); } public void paint(Graphics g){ g.clearRect(0, 0, 854, 480); g.drawImage(background, 0, 0, this); d.drawImage(offscreen, 0, 0, this); g.drawOval(x, y, 20, 20); } public void update(Graphics g){ paint(g); } And this line of code is where I'm declaring the image if you like background = ImageIO.read(this.getClass().getResource("background.png"));
tagged with: image
answer count: 1

http://stackoverflow.com/q/23746464
accepted answer: http://stackoverflow.com/a/23746686
favorite count: 0
upvote count: 2
tagged with: java-8
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23746686
tagged with: arrays
has title: How can I add each element of one array to another one's corresponding element using a ParallelStream?
downvote count: 0
answer count: 1
has body: What I am trying to do is probably easier explained using an example. Let's assume I have to following two arrays: int firstArray[] = {1, 2, 3, 4, 5}; int secArray[] = {1, 2, 3, 4, 5}; What I want is to add each element i of the second array to each element i of the first array. Of course, creating a third array is also okay. The result, given this example, would be: 2, 4, 6, 8, 10 Can I do this somehow using a ParallelStream in Java 8? I can only think of solutions using at least one index, and they don't really work because of the parallelism (which also defeats the purpose). This single threaded approach works: AtomicInteger i = new AtomicInteger(0); int resultArray[] = Arrays.stream(firstArray) .map(a -&gt; a + secArray[i.getAndIncrement()]).toArray(); But if I try this using a parallel stream, the results are (of course they are) random and the program is really slow. Any ideas?

http://stackoverflow.com/q/23640079
tagged with: jdeveloper
tagged with: ejb-3.0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36303685
tagged with: weblogic
tagged with: java
has comment: http://stackoverflow.com/comment/36304306
has comment: http://stackoverflow.com/comment/36304706
has comment: http://stackoverflow.com/comment/36348312
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36304204
linked to: http://stackoverflow.com/q/18566225
has title: EJB lookup failed or any context lookup failed Weblogic returns weblogic.socket.UnrecoverableConnectException: [Login failed for an unknown reason:
has comment: http://stackoverflow.com/comment/36304551
has body: javax.naming.CommunicationException [Root exception is weblogic.socket.UnrecoverableConnectException: [Login failed for an unknown reason: Caused by: weblogic.socket.UnrecoverableConnectException: [Login failed for an unknown reason: The code for client is this : package com.mygrp.macropnt; import com.mygrp.macropnt.ejb.ABCUpdtNewSessionEJBBean; import java.util.Hashtable; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class ABCUpdtNewSessionEJBBeanClient { public static void main(String [] args) { try { final Context context = getInitialContext(); /ABCUpdtNewSessionEJBBean ABCUpdtNewSessionEJBBean = (ABCUpdtNewSessionEJBBean)context.lookup("MacroPointIntegration-MacroPointDAO-ABCUpdtNewSessionEJBBean#com.mygrp.macropnt.ejb.ABCUpdtNewSessionEJBBean"); ABCUpdtNewSessionEJBBean ABCUpdtNewSessionEJBBean = (ABCUpdtNewSessionEJBBean)context.lookup("jdbc.cnTPSDS"); for (ABCUpdt ABCupdt : (List&lt;ABCUpdt&gt;)ABCUpdtNewSessionEJBBean.getABCUpdtFindAll()) { printABCUpdt(ABCupdt); } } catch (Exception ex) { ex.printStackTrace(); } } private static void printABCUpdt(ABCUpdt ABCupdt) { System.out.println( "version = " + ABCupdt.getVersion() ); System.out.println( "mpluKey = " + ABCupdt.getMpluKey() ); } private static Context getInitialContext() throws NamingException { Hashtable env = new Hashtable(); // WebLogic Server 10.x connection details env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" ); env.put(Context.PROVIDER_URL, "t3://127.0.0.1:7101"); return new InitialContext( env ); } } Using wlst.cmd I was able to connect to WEblogic using t3 protocol. Also I confirmed in the jndi tree my ejb is present. So can some please point to a place to look for solution to this problem. Thanks, Muqeet

http://stackoverflow.com/comment/36527407
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23735181
has text: So you need just **why**. The **why** is simple. Because `Timestamp#toString` method is defined in such way. The `.0` in your case are nanoseconds.

http://stackoverflow.com/comment/36336056
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23657027
has text: If Eclipse generates this kind of code, why should "typing" be an argument?
score: 0

http://stackoverflow.com/comment/133821123
has text: On the answers below, be careful to give a path in which you have user permission to write, or else it won't work.
score: 1
comment on: http://stackoverflow.com/q/23688702
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36412825
score: 0
comment on: http://stackoverflow.com/q/23690001
type: Comment
type: QuestionComment
has text: With the word app the possibilities are "Apple", "Apple II Lisa" and "apple" (lets say the order is this one), so what I'm expecting to see in the suggestion box is Apple and "Apple II Lisa" because the word apple is the same as one that is already in the result (without capitalized A). I don't know if is this possible to do...

ant
tags question: http://stackoverflow.com/q/23711667
tags question: http://stackoverflow.com/q/23678763
tags question: http://stackoverflow.com/q/23707607
tags question: http://stackoverflow.com/q/23646915
type: Tag
tags question: http://stackoverflow.com/q/23677556
tags question: http://stackoverflow.com/q/23719751
tags question: http://stackoverflow.com/q/23677354
tags question: http://stackoverflow.com/q/23651713
tags question: http://stackoverflow.com/q/23751744
tag name: ant
tags question: http://stackoverflow.com/q/23670481
tags question: http://stackoverflow.com/q/23755657
tags question: http://stackoverflow.com/q/23632119
tags question: http://stackoverflow.com/q/23749531
tags question: http://stackoverflow.com/q/23629076
tags question: http://stackoverflow.com/q/23752048
tags question: http://stackoverflow.com/q/23674006
tags question: http://stackoverflow.com/q/23706962
tags question: http://stackoverflow.com/q/23737268
tags question: http://stackoverflow.com/q/23753456
tags question: http://stackoverflow.com/q/23707188

http://stackoverflow.com/comment/122502485
type: Comment
comment on: http://stackoverflow.com/a/33337838
has text: I am facing similar issue and this solution doesn't to work for me. I already have one ThreadPoolTaskExecutor defined in my app and having ExuctorConfig conflicts with it and application doesn't start up. Any help on this issue in apps which already have a ThreadPoolTaskExecutor defined?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36519260
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23752800
has text: through threads i can isolate & speed up the process

http://stackoverflow.com/comment/36412854
has text: But this is the mean of all values except the inserted value, isn't it? I need two means, depending on the key.
type: Comment
comment on: http://stackoverflow.com/a/23697300
score: 0
type: AnswerComment

http://stackoverflow.com/comment/94963533
has text: I'd close this too broad but somebody answered the core of the question in a way that the rest can be seen from there, thus salvaging the question.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23703709
type: Comment

http://stackoverflow.com/comment/36375977
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23677544
has text: Check the order and select the checkbox for teh same..android libraries should come before other external libraries
score: 0

http://stackoverflow.com/comment/36394480
has text: i am using <aop:config> <aop:pointcut id="transactionPointcut" expression="execution(* ma.csimaroc.core.profil.services.interfaces..*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" /> </aop:config>
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23687159
type: AnswerComment

http://stackoverflow.com/q/23651751
has comment: http://stackoverflow.com/comment/36325624
has answer: http://stackoverflow.com/a/23652145
type: Question
score: 5
has title: java.lang.String cannot be cast to [Ljava.lang.Object;
answer count: 3
accepted answer: http://stackoverflow.com/a/23651815
has comment: http://stackoverflow.com/comment/36326102
has body: I want to call course name in combobox and print course Id which selected coursename How can I solve this problem? public void coursename(){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Query query= session.createQuery("select a.courseName,a.courseId from Semester e inner join e.course as a"); for (Iterator it = query.iterate(); it.hasNext();) { Object row[] = (Object[]) it.next(); combocourse.addItem(row[0]); } session.close(); } private void combocourseActionPerformed(java.awt.event.ActionEvent evt) { JComboBox combocourse = (JComboBox)evt.getSource(); Object row[] = (Object[])combocourse.getSelectedItem(); System.out.println("id"+row[1] ); }
favorite count: 0
has answer: http://stackoverflow.com/a/23651825
downvote count: 2
has comment: http://stackoverflow.com/comment/36325636
upvote count: 7
tagged with: combobox
possible better answer: http://stackoverflow.com/a/23651825
tagged with: object
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23651815

http://stackoverflow.com/a/23635517
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23635307
answers question: http://stackoverflow.com/q/23635307
has body: I should have waited to ask the question. I browsed through Mig Layout Whitepaper again and found the sizegroup component constraint. Here is the solution: //... panel.add(label1, "sg label"); panel.add(label2, "sg label"); //...
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36524374
comment on: http://stackoverflow.com/q/23753456
score: 1
has text: commented out elements are attributes for the tags just below it. These elements are optional or have the default value, which being used gives the same result. I tried to run the build file with "-verbose" and it shows some error, which on searching says classpath is too large and windows restricts upto a certain length classpath. But that is not the issue , because on changing "fork=yes" to "fork=no" the issue goes away.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23615698
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23824517
has body: In my java project, I am using Service API implementation (creating a services folder providing implementation in a file inside META-INF folder of jar) to load the implementation class for one of the abstract class (DocumentBuilderFactory). This mapping has been put in a jar. There is another jar(Xerces.jar) providing different implementation of the same abstract class. As per the documentation of DocumentBuilderfactory.newInstance(), It is mentioned that when Service-API comes into picture, for providing the implementation class, it looks for all the available jars having META-INF/services/javax.xml.parsers.DocumentBuilderFactory file. My question is, if two jars providing different implementation of the same abstract class are present (both having META-INF/services/javax.xml.parsers.DocumentBuilderFactory file), which one will be picked at runtime?
tagged with: java
type: Question
score: 0
answer count: 1
has title: Issue with Service API implementation for finding abstract class implementation

http://stackoverflow.com/comment/36454838
type: Comment
has text: Thanks your method work! But, it is just like remove `"` from the json?
type: AnswerComment
comment on: http://stackoverflow.com/a/23710119
score: 0

http://stackoverflow.com/q/23625903
has answer: http://stackoverflow.com/a/23626465
tagged with: java
type: Question
has body: First, sorry for my bad English. In my App I ask user to determine how many Imageview or Textview Or any Item they need. For example when at first, user opens the app he sees a button named "add album". then he clicks on it and chooses the name and the album button is created above of the "add" button. After that user can go to the album and determine how many pages he need for his album. then in every page he can determine how many imagviews and textviews should be available in that specific page. This is the App Idea and now I stuck in the first level. How can I do this add/remove function in code? for now I just can think of making the imagview nad textviews in the first and setting them "invisible" and when user selects "2 Image" I visible 2 Imagviews. Or doing this in the first page for adding Buttons in a list. Is it the right way to do this?
linked to: http://stackoverflow.com/q/23565349
has title: how to add/remove items in android Programmatically?
accepted answer: http://stackoverflow.com/a/23626465
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36275850
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/23643615
linked to: http://stackoverflow.com/q/7759973
has body: Okay, I don't know If I wrote a code correctly please check. So I created software for a store that sells one type of item. And each instance of my class should be an item of merchandise my store sells. For example if my store sells neckties, I would design a necktie class: class Necktie { … My class must have five instance variables, including at least one of type integer, at least one of type String and one called price which must be double. Also it should have a toString method that accepts no parameters and returns a description of the item. It should have a constructor. The constructor can take however many parameters you choose, but it must set all instance variables. • It should contain an accessor method for each instance variable. • It should contain no unnecessary instance variables. Any information that does not need to be stored in an instance of your class should be stored as local variables. Here is the code below. (incomplete, because I am kinda stuck..Please check if I did it correctly. If not, then please correct me.) public class Pets { public static void main(String[] args) { System.out.print (Pets.toString()); //toString } String color, pattern; int age, size; double price; Pets (String color, String pattern, int age, int size, double price){ this.color = color; this.pattern = pattern; age = age; size = size; price = price; } public String toString(){ //I don't get this part.. String description; description = "red"; return description; } public String getColor(){ return color; } public String getPattern(){ return pattern; } public int age(){ return age; } public int size(){ return size; } public double price(){ return price; } }
favorite count: 0
has answer: http://stackoverflow.com/a/23643696
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36310360
score: -3
has comment: http://stackoverflow.com/comment/36310431
has title: A store that sells one type of item
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23643660
has answer: http://stackoverflow.com/a/23643674
has comment: http://stackoverflow.com/comment/36310312
type: Question
has comment: http://stackoverflow.com/comment/36310342
downvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/36310377

http://stackoverflow.com/q/23710416
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36463404
has comment: http://stackoverflow.com/comment/36456476
has comment: http://stackoverflow.com/comment/36440612
has answer: http://stackoverflow.com/a/23952578
type: AnsweredQuestion
score: 4
tagged with: java
type: Question
upvote count: 4
tagged with: session
accepted answer: http://stackoverflow.com/a/23952578
has title: dropwizard 0.7 @Session annotation
tagged with: dropwizard
has body: i'm trying to get Dropwizard working with sessions. I've read that in 0.7, Dropwizard added session support. from release notes: "Added support for HTTP Sessions. Add the annotated parameter to your resource method: @Session HttpSession session to have the session context injected." i have a sample resource class, that gets a user/password from an http get request, and i want to save the user name in the session: @GET public Response auth(@QueryParam("user") String user, @QueryParam("password") String password, @Session HttpSession session) throws URISyntaxException { URI rootUri = getApplicationRootUri(); if(!user.equals(config.getUser()) || !password.equals(config.getPassword())) { return Response.temporaryRedirect(rootUri).build(); } session.setAttribute("user", user); return Response.temporaryRedirect( new URI("/../index.html")).build(); } when trying to log in from my app I'm getting: ERROR [2014-05-17 10:33:45,244] com.sun.jersey.spi.container.ContainerRequest: A message body reader for Java class javax.servlet.http.HttpSession, and Java type interface javax.servlet.http.HttpSession, and MIME media type application/octet-stream was not found. I've tried looking on some tests from the dropwizard source on github and it seems that the @Session annotation is used the same way as in my code. Any ideas? Thanks!
answer count: 1

parsing
tags question: http://stackoverflow.com/q/23667072
tags question: http://stackoverflow.com/q/23723763
tags question: http://stackoverflow.com/q/23687085
tag name: parsing
tags question: http://stackoverflow.com/q/23726068
tags question: http://stackoverflow.com/q/23743370
tags question: http://stackoverflow.com/q/23669004
tags question: http://stackoverflow.com/q/23704221
tags question: http://stackoverflow.com/q/23678198
type: Tag
tags question: http://stackoverflow.com/q/23615771
tags question: http://stackoverflow.com/q/23693706
tags question: http://stackoverflow.com/q/23728818
tags question: http://stackoverflow.com/q/23617940
tags question: http://stackoverflow.com/q/23675001
tags question: http://stackoverflow.com/q/23720976
tags question: http://stackoverflow.com/q/23763085
tags question: http://stackoverflow.com/q/23747866
tags question: http://stackoverflow.com/q/23639064
tags question: http://stackoverflow.com/q/23726523
tags question: http://stackoverflow.com/q/23740634

http://stackoverflow.com/comment/36427614
has text: @SaraSeppola Yes but you would need to make percent as double then and `(double)votes / total * 100;` would be fine too.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23704662
score: 0

http://stackoverflow.com/q/23701943
has answer: http://stackoverflow.com/a/38035858
tagged with: functional-programming
has body: Could somebody show me a quick example how to sort an ArrayList alphabetically in Java 8 using the new lambda syntax.
has title: Sorting ArrayList with Lambda in Java 8
has answer: http://stackoverflow.com/a/58933132
answer count: 12
has answer: http://stackoverflow.com/a/73659048
score: 54
has comment: http://stackoverflow.com/comment/36421883
possible better answer: http://stackoverflow.com/a/23701973
downvote count: 2
upvote count: 56
has answer: http://stackoverflow.com/a/23701973
has answer: http://stackoverflow.com/a/23701994
accepted answer: http://stackoverflow.com/a/23702076
has answer: http://stackoverflow.com/a/52071719
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/58322662
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/58967168
has answer: http://stackoverflow.com/a/45936615
has answer: http://stackoverflow.com/a/36605265
type: Question
has answer: http://stackoverflow.com/a/65066006
favorite count: 0
has answer: http://stackoverflow.com/a/23702076

http://stackoverflow.com/a/23928707
answers question: http://stackoverflow.com/q/23700397
accepted answer of: http://stackoverflow.com/q/23700397
type: AcceptedAnswer
has body: Implemented method on selection change event of combo box i.e. setControl(templateType.getItem(templateType.getSelectionIndex()),templateTypeGroup); it take layout and display details before disposing old control and create a new control by passing details of old controls. public void setControl(String value, Group templateTypeGroup) { Object grd = null; Point pt = null; Rectangle rct = null; if(TableTemplateConfigConstants.dateItems.contains(value) &amp;&amp; null != defaultValueText){ grd = defaultValueText.getLayoutData(); pt = defaultValueText.getLocation(); rct = defaultValueText.getBounds(); defaultValueText.dispose(); cleanControls(); createDateControl(templateTypeGroup,grd,pt,rct,value);}} public void createDateControl(Composite templateTypeGroup, Object data, Point pt, Rectangle rectangle,String value){ **enumDateChooser = new DateChooserCombo( templateTypeGroup, SWT.BORDER | CDT.DROP_DOWN | CDT.DATE_SHORT); enumDateChooser.setFormatter(new DateFormatter( ITableDataConstants.DATE_FORMAT_TABLE_VIEWER)); enumDateChooser.setLayoutData((GridData)data); if(null != pt &amp;&amp; null != rectangle){ enumDateChooser.setLocation(pt); enumDateChooser.setBounds(rectangle); } enumDateChooser.setLocation(pt)** try { if(!isEdit){ if (TableTemplateConfigConstants.endDateLst.contains(value)) { enumDateChooser .setValue(checkFormat(TableTemplateConfigConstants.endDate)); DateFormat formatter = new SimpleDateFormat(TableTemplateConfigConstants.DATE_FORMAT_TABLE_VIEWER); setDefaultVal(formatter.format(checkFormat(enumDateChooser.getText()))); } else if (TableTemplateConfigConstants.effectiveDate .contains(value)) { enumDateChooser.setValue(new Date()); DateFormat formatter = new SimpleDateFormat(TableTemplateConfigConstants.DATE_FORMAT_TABLE_VIEWER); setDefaultVal(formatter.format(checkFormat(enumDateChooser.getText()))); } else if (null != getDefaultVal() &amp;&amp; !getDefaultVal().isEmpty()) { enumDateChooser.setValue(checkFormat(getDefaultVal())); setDefaultVal(value); } …
score: 0
type: Answer

http://stackoverflow.com/comment/36294667
has text: No, its inside JFrame
comment on: http://stackoverflow.com/q/23635720
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36351540
has text: Collections.min and Collections.max will help, as for the average that shouldn't be too difficult, write your own average method. list_sum/list_size
comment on: http://stackoverflow.com/q/23664571
type: Comment
type: QuestionComment
score: 0

database
tags question: http://stackoverflow.com/q/23743546
tags question: http://stackoverflow.com/q/23633768
tags question: http://stackoverflow.com/q/23771411
tags question: http://stackoverflow.com/q/23630649
tags question: http://stackoverflow.com/q/23652503
type: Tag
tags question: http://stackoverflow.com/q/23682800
tags question: http://stackoverflow.com/q/23756645
tags question: http://stackoverflow.com/q/23704988
tags question: http://stackoverflow.com/q/23700297
tags question: http://stackoverflow.com/q/23761505
tags question: http://stackoverflow.com/q/23768781
tags question: http://stackoverflow.com/q/23671049
tags question: http://stackoverflow.com/q/23771443
tags question: http://stackoverflow.com/q/23759130
tag name: database
tags question: http://stackoverflow.com/q/23720220
tags question: http://stackoverflow.com/q/23672796
tags question: http://stackoverflow.com/q/23711436
tags question: http://stackoverflow.com/q/23748233
tags question: http://stackoverflow.com/q/23675662
tags question: http://stackoverflow.com/q/23617427
tags question: http://stackoverflow.com/q/23660415
tags question: http://stackoverflow.com/q/23622183
tags question: http://stackoverflow.com/q/23679189
tags question: http://stackoverflow.com/q/23624442
tags question: http://stackoverflow.com/q/23648039
tags question: http://stackoverflow.com/q/23772071
tags question: http://stackoverflow.com/q/23704721
tags question: http://stackoverflow.com/q/23765775
tags question: http://stackoverflow.com/q/23770197

http://stackoverflow.com/comment/36297845
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23637530
has text: Thats only practical if condition is *simple*. If you need to navigate relationships and check for nulls/conditions its not applicable. It can also quickly lead to bracket messes with non-trivial conditions.
type: Comment

http://stackoverflow.com/a/23661667
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23658726
answers question: http://stackoverflow.com/q/23658726
downvote count: 0
score: 1
has body: The problem is that you call postData() on UI-tread, meaning that the method also returns theCampagneXml on UI-thread, while your network operation goes on a worker thread. The following code with some changes and additions fixes the problem: public class MainActivity extends Activity { TextView campagne; String user = "toto"; String password = "tata"; String theCampagneXml; // new @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); campagne = (TextView) findViewById(R.id.text); postData(user, password); // new } public void postData(final String login, final String password) { // note: the return type has been changed Thread background = new Thread(new Runnable() { URL url; String buffer; String theCampagneXml = null; // new @Override public void run() { try { // no changes here but declaring `theCampagneXml` as class member } campagne.post(new Runnable() { @Override public void run() { campagne.setText("hello, here is your XML : "+ theCampagneXml); } }); } }); background.start(); } } Once the network operation is done and theCampagneXml is initialized, use post() for the TextView campagne that runs on UI-thread. Additional info can be found in Processes and Threads.
upvote count: 1

http://stackoverflow.com/comment/36261374
has text: It would be better if you edit your question explaining why do you think it is a contradiction.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23618298
type: QuestionComment

http://stackoverflow.com/comment/36295911
has text: You know you're using a static method, right?
comment on: http://stackoverflow.com/q/23636426
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23728276
accepted answer: http://stackoverflow.com/a/23728293
has comment: http://stackoverflow.com/comment/36473902
answer count: 1
downvote count: 0
has body: Im making a small program that shows teams/ players/ then their twitter feeds, tweets, etc. My problem seems to be unrelated to that though, it just my jPanel isn't updating. I got pretty far in the project, and i keep throwing random code segments in my method to make it so once i click something, the "left" jpanel either is replaced with the jbuttons, or the jbuttons are put into it, ive tried both. Heres the code segment ive been trying to get to work, which it does, just not as intended. public void mousePressed(MouseEvent e) { System.out.println("You clicked on " + ap.getTeams() [addPlayers.OPTIC].getTeamName()); for(int i = 0; i&lt;4; i++){ //JPanel temp = ap.makePanel(ap.getTeams()[ap.OPTIC].getPlayers().get(i).getTwitterScreenName()); //temp.setBounds(0,(i*125), 450,125); //left.add(temp); JButton b = new JButton("Test"); b.setBounds(30,30,30,30); left.add(b); left.revalidate(); add(left); add(b); right.add(b); left.setVisible(false); left.setVisible(true); System.out.println(i); } } } the commented out code is my main code, but i am just using jbuttons to test. As you can see, i just keep adding random bits, hoping something will work. Ive also tried invoke later, but sadly, that didn't work either.Not sure why the jpanels not updating, but any feedback would be great, thanks.
favorite count: 0
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/23728293
type: AnsweredQuestion
tagged with: twitter4j
score: 1
tagged with: java
tagged with: jpanel
upvote count: 1
has comment: http://stackoverflow.com/comment/36473782
has title: JPanel not updating, no matter what i try
type: Question
has comment: http://stackoverflow.com/comment/36474073

android
tags question: http://stackoverflow.com/q/23773672
tags question: http://stackoverflow.com/q/23768737
tags question: http://stackoverflow.com/q/23673105
tags question: http://stackoverflow.com/q/23665648
tags question: http://stackoverflow.com/q/23616739
tags question: http://stackoverflow.com/q/23627396
tags question: http://stackoverflow.com/q/23751362
tags question: http://stackoverflow.com/q/23721364
tags question: http://stackoverflow.com/q/23653758
tags question: http://stackoverflow.com/q/23642783
tags question: http://stackoverflow.com/q/23769240
tags question: http://stackoverflow.com/q/23630828
tags question: http://stackoverflow.com/q/23628172
tags question: http://stackoverflow.com/q/23640341
tags question: http://stackoverflow.com/q/23678320
tags question: http://stackoverflow.com/q/23707730
tags question: http://stackoverflow.com/q/23675508
tags question: http://stackoverflow.com/q/23743747
tags question: http://stackoverflow.com/q/23622198
tags question: http://stackoverflow.com/q/23763725
tags question: http://stackoverflow.com/q/23689589
tags question: http://stackoverflow.com/q/23751954
tags question: http://stackoverflow.com/q/23624101
tags question: http://stackoverflow.com/q/23644858
tags question: http://stackoverflow.com/q/23659729
tags question: http://stackoverflow.com/q/23697621
tags question: http://stackoverflow.com/q/23756488
tags question: http://stackoverflow.com/q/23624902
tags question: http://stackoverflow.com/q/23655087
tags question: http://stackoverflow.com/q/23726068
tags question: http://stackoverflow.com/q/23683144
tags question: http://stackoverflow.com/q/23630494
tags question: http://stackoverflow.com/q/23700794
tags question: http://stackoverflow.com/q/23710977
tags question: http://stackoverflow.com/q/23774684
tags question: http://stackoverflow.com/q/23729264
tags question: http://stackoverflow.com/q/23722593
tags question: http://stackoverflow.com/q/23685845
tags question: http://stackoverflow.com/q/23670328
tags question: http://stackoverflow.com/q/23719857
tags question: http://stackoverflow.com/q/23676579
tags question: http://stackoverflow.com/q/23699595
tags question: http://stackoverflow.com/q/23733482
tags question: http://stackoverflow.com/q/23713176
tags question: http://stackoverflow.com/q/23650466
tags question: http://stackoverflow.com/q/23768440
tags question: http://stackoverflow.com/q/23700568
tags question: http://stackoverflow.com/q/23716832
tags question: http://stackoverflow.com/q/23668850
tags question: http://stackoverflow.com/q/23635159
tags question: http://stackoverflow.com/q/23672259
tags question: http://stackoverflow.com/q/23762627
tags question: http://stackoverflow.com/q/23751773
tags question: http://stackoverflow.com/q/23639823
tags question: http://stackoverflow.com/q/23674861
tags question: http://stackoverflow.com/q/23716000
tags question: http://stackoverflow.com/q/23661247
tags question: http://stackoverflow.com/q/23741399
tags question: http://stackoverflow.com/q/23677931
tags question: http://stackoverflow.com/q/23649450
tags question: http://stackoverflow.com/q/23714662
tags question: http://stackoverflow.com/q/23700833
tags question: http://stackoverflow.com/q/23639760
tags question: http://stackoverflow.com/q/23678159
tags question: http://stackoverflow.com/q/23770108
tags question: http://stackoverflow.com/q/23766466
tags question: http://stackoverflow.com/q/23664639
tags question: http://stackoverflow.com/q/23627372
tags question: http://stackoverflow.com/q/23708373
tags question: http://stackoverflow.com/q/23698204
tags question: http://stackoverflow.com/q/23712783
tags question: http://stackoverflow.com/q/23652549
tags question: http://stackoverflow.com/q/23774563
tags question: http://stackoverflow.com/q/23739333
tags question: http://stackoverflow.com/q/23776164
tags question: http://stackoverflow.com/q/23775950
tags question: http://stackoverflow.com/q/23753591
tags question: http://stackoverflow.com/q/23731635
tags question: http://stackoverflow.com/q/23722659
tags question: http://stackoverflow.com/q/23703431

http://stackoverflow.com/q/23773254
tagged with: java
downvote count: 2
has body: The pom.xml file: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.codehaus.sonar-plugins.java java 2.3-SNAPSHOT java-checks SonarQube Java :: Checks org.codehaus.sonar sonar-deprecated provided ${project.groupId} java-squid ${project.version} org.codehaus.sonar.sslr sslr-testing-harness test org.hamcrest hamcrest-all test junit junit test org.mockito mockito-all test org.easytesting fest-assert test ch.qos.logback logback-classic test I've been trying to run this pom.xml on eclipse, and i kept having this error of: [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2:22.878s [INFO] Finished at: Wed May 21 10:53:12 CST 2014 [INFO] Final Memory: 10M/61M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project java-checks: Could not resolve dependencies for project org.codehaus.sonar-plugins.java:java-checks:jar:2.3-SNAPSHOT: The following artifacts could not be resolved: org.codehaus.sonar:sonar-deprecated:jar:4.2-RC1, org.codehaus.sonar:sonar-plugin-api:jar:4.2-RC1, org.codehaus.sonar:sonar-check-api:jar:4.2-RC1, org.codehaus.sonar:sonar-colorizer:jar:4.2-RC1, org.codehaus.sonar:sonar-graph:jar:4.2-RC1, org.codehaus.sonar:sonar-squid:jar:4.2-RC1, org.codehaus.sonar-plugins.java:java-squid:jar:2.3-SNAPSHOT: Could not transfer artifact org.codehaus.sonar:sonar-deprecated:jar:4.2-RC1 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException Is there an…
type: Question
score: -2
tagged with: eclipse
has title: Error when trying to run maven project in eclipse
has comment: http://stackoverflow.com/comment/36558594
has answer: http://stackoverflow.com/a/23773288
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/23751618
has comment: http://stackoverflow.com/comment/36516872
has title: How to split a java string at backslash
tagged with: java
has answer: http://stackoverflow.com/a/39802923
type: Question
score: 37
answer count: 8
has answer: http://stackoverflow.com/a/54662353
has body: String fname="C:\textfiles\db\query\query.txt"; this is the string i need to split it. I tried with this String [] items=fname.split("\"); But not working. String [] items=fname.split("\\"); also not working... how to split this string...
has answer: http://stackoverflow.com/a/23751677
has answer: http://stackoverflow.com/a/23751647
has answer: http://stackoverflow.com/a/43322346
upvote count: 39
has answer: http://stackoverflow.com/a/51542813
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/60017395
downvote count: 2
has answer: http://stackoverflow.com/a/35104071
has comment: http://stackoverflow.com/comment/36516842

http://stackoverflow.com/a/23763084
has body: Yup, you can use a comparator. class MyComparator implements Comparator&lt;Integer&gt; { private final int b; public MyComparator(int b) { this.b = b; } public int compare(Integer o1, Integer o2) { Integer i1 = Math.abs(o1 - b); Integer i2 = Math.abs(o2 - b); return i1.compareTo(i2); } } Then plug it into the Collections call: Collections.sort(a,new MyComparator(50)); This will sort the Integer list according to the criteria in the comparator.
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36538840
has comment: http://stackoverflow.com/comment/36538792
answers question: http://stackoverflow.com/q/23762978
has comment: http://stackoverflow.com/comment/36538885
accepted answer of: http://stackoverflow.com/q/23762978
has comment: http://stackoverflow.com/comment/36538691

http://stackoverflow.com/q/23688839
has body: I am inserting a string into a database and need to eliminate the beginning and ending quotes in the string. I am using: String a = rows[0].replaceAll("^\"", "").replaceAll("\"$", "");` This gives me: "134432534"23" => 134432534"23 but is there a better way to do this?
tagged with: regex
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23689041
has title: Java Regex to select starting and ending quotes in a string
accepted answer: http://stackoverflow.com/a/23689041
type: Question
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/36397888
answer count: 1

http://stackoverflow.com/a/23748884
has comment: http://stackoverflow.com/comment/36511895
type: Answer
has comment: http://stackoverflow.com/comment/36512020
has comment: http://stackoverflow.com/comment/36512057
answers question: http://stackoverflow.com/q/23748857
has comment: http://stackoverflow.com/comment/36511986
has body: You must have a concrete implementation of List, such as ArrayList or LinkedList. List &lt;? extends Number&gt; l3 = new ArrayList&lt;Number&gt;() ; Whenever you have a wildcard as a generic type parameter for a reference variable, it could stand for anything. Here, with ? extends Number, it can be any subclass of Number (or Number) itself. It could be a List&lt;Double&gt;. To maintain type safety, the compiler must disallow a call to add with an Integer, because l3 could be a List&lt;Double&gt;, and you shouldn't be allowed to add an Integer to a List that may be of Doubles. With a List&lt;?&gt;, the wildcard could stand for anything. List&lt;?&gt; l3 = new ArrayList&lt;Number&gt;(); // Later... l3 = new LinkedList&lt;MySpecialTypeYouDidntKnowAbout&gt;(); // And then this doesn't work. l3.add(new Integer(5));
has comment: http://stackoverflow.com/comment/36512089
upvote count: 4
has comment: http://stackoverflow.com/comment/36511883
downvote count: 0
has comment: http://stackoverflow.com/comment/36511949
has comment: http://stackoverflow.com/comment/36512133
score: 4
has comment: http://stackoverflow.com/comment/36511936

http://stackoverflow.com/q/23622425
type: Question
has comment: http://stackoverflow.com/comment/36269451
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36268953
has comment: http://stackoverflow.com/comment/36269421
has comment: http://stackoverflow.com/comment/36269091
has comment: http://stackoverflow.com/comment/36269527
has comment: http://stackoverflow.com/comment/36269033
tagged with: web
tagged with: artificial-intelligence
favorite count: 0
has answer: http://stackoverflow.com/a/23622523
has comment: http://stackoverflow.com/comment/36269976
has title: How to retrieve text from a webpage in Java?
has comment: http://stackoverflow.com/comment/36268999
has body: I'm a complete noob to the Java programming language. I have some (Emphasis on 'some') experience in Python, BASIC, and programming in general. I've made a few programs, nothing of note. I have decided to begin one a fairly daunting project in order to: A) Develop a profound understanding of Java B) Create an extremely useful tool lucrative to my everyday life C) Gain some experience in programming I have decided to create an AI which I have named 'S.E.R.V.A.N.T.'. Currently he is nothing more than an idea, but that is why I am here. MY PROBLEM: I want to make Servant retrieve text from the web, News, Weather, Movie Listings etc. I have searched high and low and have been unable to find an adequate solution to my issue, could anyone help? I have 0 experience with Java applets, though I have a fundamental understanding of the language itself. If you could explain your response, it would be much appreciated.
type: UnansweredQuestion
downvote count: 2
score: -2
tagged with: text
tagged with: java

http://stackoverflow.com/a/24699622
answers question: http://stackoverflow.com/q/23644316
score: 0
type: Answer
has body: One common way to use Zookeeper is by taking advantage of ephemeral nodes as locks so as to create a distributed work queue. Workers browse a list inside ZK and attempt to create an ephemeral "lock" node. If the attempt fails it means another worker has locked the node. If the attempt succeeds the worker can do the operation (in your case do the math), and then write a new node and delete the old node. The power of the ephemeral lock is that if the worker dies for whatever reason the connection is broken and ZK guarantees that the lock goes away automatically.

http://stackoverflow.com/q/23704496
has answer: http://stackoverflow.com/a/23705091
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23705638
tagged with: android-sqlite
tagged with: java
type: Question
answer count: 2
score: -1
has body: I have attempted to create a viewable SQLite database to view but it keeps crashing when I try to open it. I have tried opening it multiple times and changed a few things to try and fix it, but seeing as I have not fixed it I probably made it worse. I can't get anywhere when I open it and it crashes straight away. Sorry for the wall of code but I thought I may aswell give you too much info rather than too little. Any input is appreciated. DBHelper.java package com.example.listviewfromsqlitedb; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; public class DBHelper extends SQLiteOpenHelper{ public SQLiteDatabase DB; public String DBPath; public static String DBName = "sample"; public static final int version = '1'; public static Context currentContext; public static String tableName = "Resource"; public DBHelper(Context context) { super(context, DBName, null, version); currentContext = context; DBPath = "/data/data/" + context.getPackageName() + "/databases"; createDatabase(); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } private void createDatabase() { boolean dbExists = checkDbExists(); if (dbExists) { // do nothing } else { DB = currentContext.openOrCreateDatabase(DBName, 0, null); DB.execSQL("CREATE TABLE IF NOT EXISTS " + tableName + " (LastName VARCHAR, FirstName VARCHAR," + " Country VARCHAR, Age INT(3));"); DB.execSQL("INSERT INTO " + tableName + " Values ('M','shumi','India',25);"); DB.execSQL("INSERT INTO " + tableName + " Values ('C','sarah','India',25);"); DB.execSQL("INSERT INTO " + tableName + " Values ('D','Lavya','USA',20);"); DB.execSQL("INSERT INTO " + tableName + " Values ('V','Avi','EU',25);"); DB.execSQL("INSERT INTO " + tableName + " Values ('T','Shenoi','Ba…
downvote count: 2
has title: Android SQlite application crashes when I try to run it
upvote count: 1
tagged with: android
tagged with: sqlite

http://stackoverflow.com/comment/36475280
has text: Why do you need separate add function? After reversing the number you can directly add those?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23729406

http://stackoverflow.com/comment/36260591
type: QuestionComment
comment on: http://stackoverflow.com/q/23617427
score: 3
has text: Can you edit your post to show the output of `System.out.println(database.getPrintDate());`
type: Comment

http://stackoverflow.com/comment/36362305
type: Comment
has text: if you linking to a SO question, then why not mark this as a duplicate
type: AnswerComment
comment on: http://stackoverflow.com/a/23670296
score: 0

javaplot
type: Tag
tags question: http://stackoverflow.com/q/23620876
tag name: javaplot

http://stackoverflow.com/comment/36339640
comment on: http://stackoverflow.com/a/23657989
has text: You can do anything you want with HTTP. REST is just a group of PRINCIPALS on implementing a HTTP API.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23647058
score: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23654167
tagged with: struts
type: Question
has body: I am using Struts 1. I need to send Vector of Objects from one Action to another throuh jsp. In Action1: Defined Vector Vector&lt;UserObject&gt; allEligibleUserList = new Vector&lt;UserObject&gt;(); and after adding objects request.setAttribute("elligible", allEligibleUserList); In jsp: &lt;html:hidden property="userVector" value="${elligible}" /&gt; In Form: private Vector&lt;UserObject&gt; userVector; public Vector&lt;UserObject&gt; getUserVector() { return userVector; } public void setUserVector(Vector&lt;UserObject&gt; userVector) { this.userVector = userVector; } In Action2: Vector&lt;UserObject&gt; elligibleUserVector = catalogForm.getUserVector(); But I am getting the following error: SEVERE: Servlet.service() for servlet [action] in context with path [/MetalWeb] threw exception [BeanUtils.populate] with root cause java.lang.IllegalArgumentException: argument type mismatch 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.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at j…
has title: Error in sending Vector from one Action to another through jsp
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/36438496
type: QuestionComment
has text: @Jocheved so, currently which screen is coming on back press of main activity ?
comment on: http://stackoverflow.com/q/23710221
score: 0
type: Comment

http://stackoverflow.com/q/23734570
has body: I've work with JSP and Spring MVC. I've strong understanding of what is request/response MVC frameworks. But I read the next phrase and I have the single question about component based MVC. Phrase: There are two main types of web layer implementations: request/response frameworks and component frameworks... Some frameworks, such as Tapestry and JavaServer Faces (JSF), are considered component-based... Those frameworks are essentially EVENT-DRIVEN, as the components respond to events originally coming from the web layer. Question: What does mean event driven? Does it mean that instead of handling URL through controller (like in Spring MVC) I can hang a separate listener to each specific element on the page (i.e. form)?
tagged with: spring
tagged with: spring-mvc
answer count: 0
tagged with: jsf
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1247627
has comment: http://stackoverflow.com/comment/36485386
has comment: http://stackoverflow.com/comment/36484523
has comment: http://stackoverflow.com/comment/36484352
tagged with: jsp
has comment: http://stackoverflow.com/comment/36488834
has title: Component based MVC: what does mean "event-driven"

http://stackoverflow.com/q/23744216
has answer: http://stackoverflow.com/a/70283292
has answer: http://stackoverflow.com/a/42797444
favorite count: 0
tagged with: yaml
has comment: http://stackoverflow.com/comment/36504355
has answer: http://stackoverflow.com/a/48490088
has comment: http://stackoverflow.com/comment/77279837
accepted answer: http://stackoverflow.com/a/38274671
has comment: http://stackoverflow.com/comment/36502985
has answer: http://stackoverflow.com/a/23774617
downvote count: 2
has comment: http://stackoverflow.com/comment/36502678
has comment: http://stackoverflow.com/comment/36555699
has comment: http://stackoverflow.com/comment/36503079
has body: I just want to convert a string that contains a yaml into another string that contains the corrseponding converted json using Java. For example supose that I have the content of this yaml --- paper: uuid: 8a8cbf60-e067-11e3-8b68-0800200c9a66 name: On formally undecidable propositions of Principia Mathematica and related systems I. author: Kurt Gödel. tags: - tag: uuid: 98fb0d90-e067-11e3-8b68-0800200c9a66 name: Mathematics - tag: uuid: 3f25f680-e068-11e3-8b68-0800200c9a66 name: Logic in a String called yamlDoc: String yamlDoc = "---\npaper:\n uuid: 8a... etc..."; I want some method that can convert the yaml String into another String with the corresponding json, i.e. the following code String yamlDoc = "---\npaper:\n uuid: 8a... etc..."; String json = convertToJson(yamlDoc); // I want this method System.out.println(json); should print: { "paper": { "uuid": "8a8cbf60-e067-11e3-8b68-0800200c9a66", "name": "On formally undecidable propositions of Principia Mathematica and related systems I.", "author": "Kurt Gödel." }, "tags": [ { "tag": { "uuid": "98fb0d90-e067-11e3-8b68-0800200c9a66", "name": "Mathematics" } }, { "tag": { "uuid": "3f25f680-e068-11e3-8b68-0800200c9a66", "name": "Logic" } } ] } I want to know if exists something similar to the convertToJson() method in this example. I tried to achieve this using SnakeYAML, so this code Yaml yaml = new Yaml(); Map&lt;String,Object&gt; map = (Map&lt;String, Object&gt;) yaml.load(yamlDoc); constructs a map that contain the parsed YAML structure (using nested Maps). Then if there is a parser that can convert a map into a json String it will solve my problem, but I didn't find something like that neither. Any response will be greatly appreciated.
has answer: http://stackoverflow.com/a/38274671
type: AnsweredQuestion
upvote count: 46
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 44
has answer: http://stackoverflow.com/a/69836464
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/36503592
has title: How do I convert from YAML to JSON in Java?
possible better answer: http://stackoverflow.com/a/23774617
has answer: http://stackoverflow.com/a/32607306
has answer: http://stackoverflow.com/a/39222102

http://stackoverflow.com/comment/36407863
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23693839
type: AnswerComment
has text: Credentials are in datasource on application server. Every j2ee application server has own way to configure it named as datasource.

http://stackoverflow.com/comment/36333842
has text: *"I choose to write an answer just in case anyone got similar problem"* I was hoping you'd choose that option. ;)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23651792
type: Comment

http://stackoverflow.com/q/23699595
accepted answer: http://stackoverflow.com/a/23699692
favorite count: 0
possible better answer: http://stackoverflow.com/a/23699681
answer count: 5
has answer: http://stackoverflow.com/a/23699681
upvote count: 1
has comment: http://stackoverflow.com/comment/36417198
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23699770
tagged with: java
has answer: http://stackoverflow.com/a/23699783
has answer: http://stackoverflow.com/a/23699692
type: Question
has title: Android Java math logic issue
downvote count: 0
has answer: http://stackoverflow.com/a/23699837
has body: I want to message the player if he score a specific score. What I am currently using .. if(score &lt;= 4){ messagePlayer("You scored 1."); } else if(score &lt;= 19){ messagePlayer("You scored 1."); messagePlayer("You scored 5."); } else if(score &lt;= 49){ messagePlayer("You scored 1."); messagePlayer("You scored 5."); messagePlayer("You scored 20."); } else if(score &lt;= 99){ messagePlayer("You scored 1."); messagePlayer("You scored 5."); messagePlayer("You scored 20."); messagePlayer("You scored 50."); } else if(score &gt;= 100){ messagePlayer("You scored 1."); messagePlayer("You scored 5."); messagePlayer("You scored 20."); messagePlayer("You scored 50."); messagePlayer("You scored 100."); } The scores I want are: 1 Point 5 20 50 100 Is my logic 100% right and accurate? I think my first one score &lt;= 4 is wrong, so if he gets 0 he can also get the message You scored 1. And I am not using score == x, because I need to message the player at the end, when he finish, so his highscore like 15.
has comment: http://stackoverflow.com/comment/36417263
tagged with: android

http://stackoverflow.com/a/23673318
score: 8
answers question: http://stackoverflow.com/q/23673274
upvote count: 8
type: Answer
has body: You have to use List&lt;? extends A&gt;.
has comment: http://stackoverflow.com/comment/36367623
has comment: http://stackoverflow.com/comment/36367769
downvote count: 0

jax-rs
tags question: http://stackoverflow.com/q/23632068
tags question: http://stackoverflow.com/q/23656562
tags question: http://stackoverflow.com/q/23770188
tags question: http://stackoverflow.com/q/23626293
tags question: http://stackoverflow.com/q/23636565
tags question: http://stackoverflow.com/q/23624303
tags question: http://stackoverflow.com/q/23739315
tags question: http://stackoverflow.com/q/23654067
tags question: http://stackoverflow.com/q/23709883
type: Tag
tags question: http://stackoverflow.com/q/23650166
tags question: http://stackoverflow.com/q/23730062
tags question: http://stackoverflow.com/q/23618356
tags question: http://stackoverflow.com/q/23701106
tag name: jax-rs

http://stackoverflow.com/comment/36488210
has text: @Haresh it says otherwise here: http://stackoverflow.com/questions/15165454/should-i-use-a-popupwindow-or-dialogfragment-for-accepting-input
comment on: http://stackoverflow.com/q/23651308
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23726695
type: UnansweredQuestion
has body: simple question. I'm trying to re-create the game Pong. I've got the graphics that I want on the screen with the two paddles moving with KeyEvents. My only problem is that when I release one key the other paddle stops as well (if both are moving at the same time) I know exactly why this is happening but can't figure out the fix. It's happening because when the keyReleased method is called, both paddles are being set to velocity 0. How can I code it differently where I can move/stop both paddles separately with the keyReleased method? Code: package pong.main; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PongGame extends JPanel implements ActionListener,KeyListener { private final int WIDTH = 750; private final int HEIGHT = 750; private int DELAY = 20; private int IMAGE_SIZE = 35; private ImageIcon paddle_one; private ImageIcon paddle_two; private ImageIcon pong_logo; private ImageIcon pong_ball; private Timer timer = new Timer(DELAY, this); private int p1_x = 10; private int p1_y = 325; private int p2_x = 710; private int p2_y = 325; private int p1_moveX; private int p1_moveY; private int p2_moveX; private int p2_moveY; public PongGame(){ timer.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); paddle_one = new ImageIcon("C:\\Users\\Bryan\\Pictures\\paddle.gif"); paddle_two = new ImageIcon("C:\\Users\\Bryan\\Pictures\\paddle.gif"); pong_logo = new ImageIcon("C:\\Users\\Bryan\\Pictures\\pong_logo.gif"); pong_ball = new ImageIcon("C:\\Users\\Bryan\\Pictures\\pong_ball.gif"); setPreferredSize(new Dimension(WIDTH, HEIGHT)); setBackground(Color.black); } public void paintComponent(Graphics g){ super.paintComponent(g); paddle_one.paintIcon(this, g, p1_x, p1_y); paddle_two.paintIcon(this, g, p2_x, p2_y); pong_ball.paintIcon(this, g, 350, 350); pong_logo.paintIcon(this, g, 220, -100); } public void actionPerformed(ActionEvent e){ repaint(); p1_x += p1_moveX; p1_y += p1_moveY; p2_x += p2_moveX; p2_y += p2_…
tagged with: swing
has answer: http://stackoverflow.com/a/23726782
tagged with: keyevent
tagged with: keyrelease
tagged with: java
type: Question
tagged with: keypress
answer count: 2
has title: Need help on KeyEvents
score: 0
has comment: http://stackoverflow.com/comment/36484116
has answer: http://stackoverflow.com/a/23726716

http://stackoverflow.com/q/23751949
possible better answer: http://stackoverflow.com/a/23752149
upvote count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
score: -1
has answer: http://stackoverflow.com/a/23752623
accepted answer: http://stackoverflow.com/a/23752623
has answer: http://stackoverflow.com/a/23752149
answer count: 2
downvote count: 1
has body: I am getting the below error "Description Resource Path Location Type The project was not built since its build path is incomplete. Cannot find the class file for java.lang.reflect.AnnotatedElement. Fix the build path then try building this project cucumber Unknown Java Problem I have pasted the error below in the comments. Below is my pom.xml 4.0.0 com.bdd cucumber 0.0.1-SNAPSHOT jar cucumber http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 4.11 test info.cukes cucumber-java 1.1.6 test info.cukes cucumber-junit 1.1.6 test info.cukes cucumber-picocontainer 1.1.6 test org.apache.maven.plugins maven-compiler-plugin 3.0 1.7 1.7
has title: Java with some build error
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23684587
tagged with: integer
has title: Get integer value from JTable
has comment: http://stackoverflow.com/comment/36390638
accepted answer: http://stackoverflow.com/a/23690209
tagged with: java
downvote count: 2
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/36390014
has body: In my JTable i have 4 columns where last 3 columns are set as integer. I used netbeans Table Contents to change the column type from Object to Integer I also initialized jTable1.getModel().getColumnClass(1); jTable1.getModel().getColumnClass(2); and to retrieve the value i used getValueAt int qty=(int)jTable1.getValueAt(row, 1); int amt=(int)jTable1.getValueAt(row, 2); But it's showing this error java.lang.String cannot be cast to java.lang.Integer What I'm missing here? Can anyone suggest?
has comment: http://stackoverflow.com/comment/36389851
has comment: http://stackoverflow.com/comment/36390400
tagged with: jtable
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36392011
has answer: http://stackoverflow.com/a/23690209
has comment: http://stackoverflow.com/comment/36397484
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36401441
score: -2

http://stackoverflow.com/comment/36541822
comment on: http://stackoverflow.com/q/23764742
type: Comment
type: QuestionComment
score: 0
has text: Have you done the basic research of Google searching the error message (I get a lot of hits)?

http://stackoverflow.com/q/23659502
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23660173
has answer: http://stackoverflow.com/a/23675361
has title: Java: Should I construct lightweight objects each time or cache instance?
favorite count: 0
has body: During code review, a colleague of mine looked at this piece of code: public List&lt;Item&gt; extractItems(List&lt;Object[]&gt; results) { return Lists.transform(results, new Function&lt;Object[], Item&gt;() { @Override public Item apply(Object[] values) { ... } }); } He suggests changing it to this: public List&lt;Item&gt; extractItems(List&lt;Object[]&gt; results) { return Lists.transform(results, getTransformer()); } private Function&lt;Object[], Item&gt; transformer; private Function&lt;Object[], Item&gt; getTransformer() { if(transformer == null) { transformer = new Function&lt;Object[], Item&gt;() { @Override public Item apply(Object[] values) { ... } }; } return transformer; } So we are looking at taking the new Function() construction, and moving it over to be a member variable and re-used next time. While I understand his logic and reasoning, I guess I'm not sold that I should do this for every possible object that I create that follows this pattern. It seems like there would be some good reasons not to do this, but I'm not sure. What are your thoughts? Should we always cache duplicately created objects like this? UPDATE The Function is a google guava thing, and holds no state. A couple people have pointed out the non-thread-safe aspect of this change, which is perfectly valid, but isn't actually a concern here. I'm more asking about the practice of constructing vs caching small objects, which is better?
has comment: http://stackoverflow.com/comment/36341567
upvote count: 2
type: UnansweredQuestion
tagged with: object
score: 2
tagged with: performance
tagged with: java
tagged with: memory
tagged with: caching

http://stackoverflow.com/q/23763573
has answer: http://stackoverflow.com/a/23765156
has comment: http://stackoverflow.com/comment/36542396
has body: When I exported a Java project to a .jar with Eclipse and tried to run it, to my surprise, everything created by the JPanel paint method was gone! When I ran configurations and debugs, there was no such problem. How do I fix this? P.S. I'm using a Mac. I have also tried running the .jar manually with Terminal.
tagged with: paint
type: UnansweredQuestion
tagged with: java
type: Question
has title: Java .jar export paint method puzzle
tagged with: export
score: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/36275238
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23625868
has text: Would Checker need all possible checks done in the system added to it?

http://stackoverflow.com/a/77116756
answers question: http://stackoverflow.com/q/23636368
type: Answer
score: 8
downvote count: 1
upvote count: 9
has body: I'm using Spring-Boot v3 and as Spring official blog said: In Spring Security 5.7.0-M2, WebSecurityConfigurerAdapter depricated. and SecurityFilterChain is recommended So I created a configuration class as: @Configuration @EnableWebSecurity public class SecurityConfiguration { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { return http.authorizeHttpRequests((auth) -&gt; auth.anyRequest().permitAll()).build(); } }

http://stackoverflow.com/a/34436737
type: Answer
answers question: http://stackoverflow.com/q/23753439
score: 0
has body: I know it is a very old question. But here is a sample working template for Android functional testing framework using Appium, which is in Java and starts Appium server from within the code.

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/23701142
type: Tag
tags question: http://stackoverflow.com/q/23700112
tags question: http://stackoverflow.com/q/23701207
tags question: http://stackoverflow.com/q/23645496
tags question: http://stackoverflow.com/q/23673719
tags question: http://stackoverflow.com/q/23670029

http://stackoverflow.com/comment/36314102
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23645589
type: Comment
has text: Thank you - I updated the code and that error is gone. Now I get "java.lang.reflect.InvocationTargetException" in any web browser.

http://stackoverflow.com/comment/36345932
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23659940
score: 1
has text: If you are passing the string to a stored procedure parameter then take a look at this post: http://stackoverflow.com/questions/19334380/how-to-split-explode-comma-delimited-string-field-into-sql-query/19335966#19335966

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/23619915
tags question: http://stackoverflow.com/q/23771129
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/23650193

http://stackoverflow.com/a/23720166
upvote count: 0
answers question: http://stackoverflow.com/q/23720050
score: -1
has body: Pass true as a second argument to FileWriter to turn on "append" mode. fout = new FileWriter("filename.txt", true); FileWriter usage reference
downvote count: 1
has comment: http://stackoverflow.com/comment/36647585
type: Answer

http://stackoverflow.com/comment/36405630
comment on: http://stackoverflow.com/q/23692101
score: 0
type: Comment
type: QuestionComment
has text: I have added the javac -version output.

http://stackoverflow.com/a/23616954
upvote count: 2
has comment: http://stackoverflow.com/comment/46050772
downvote count: 0
has body: Immutable classes may waste memory and garbage collector time as changing of data will generate wasted instances. Functional programming methods, however, are pretty effective with immutable classes. Functional methods can be used to modify data and then provide immutable class to the developer. This way mutable classes are abstracted away from developers. Functionality comes with other good things such as lazy loading and behind the scenes optimization of these abstract calls. Java 8 streams API can be used to provide functional way of handling data. You may also want to try Scala which is kind of a functional variant of Java. That said, it may be best to leave the most complicated and performance critical tasks to more conventional programming practices. With carefully planned architecture and proper synchronization mutable objects will work very well. High amount of traffic gets garbage collector pretty busy when using only immutable objects. There's always a limit to amount of functionality that functional programming methods can reasonably abstract away. Functional programming seems to work great in front-end development where architectural complexity isn't usually very high.
answers question: http://stackoverflow.com/q/23616211
type: Answer
score: 2

http://stackoverflow.com/a/23646598
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36316161
type: Answer
has body: Sample code as per the conversation above. Please check if this solves your purpose. public class ThingDoer extends JPanel { public ThingDoer() { JTextArea text = new JTextArea(1, 10); text.setLineWrap(true); text.setWrapStyleWord(true); JScrollPane scrollPane = new JScrollPane(text,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); add(scrollPane); } public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new ThingDoer()); frame.pack(); frame.setSize(200, 300); frame.setVisible(true); } }
answers question: http://stackoverflow.com/q/23646008
score: 0

http://stackoverflow.com/comment/36287652
has text: The returning of read-only lists is important for concurrency. I should have mentioned that in my own answer. +1 to you!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23632459
score: 1

http://stackoverflow.com/comment/36523463
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23754616
type: AnswerComment
has text: Yes. I just added a randomly chosen value as an example. I raised it to 300 to avoid any missunderstandings.

http://stackoverflow.com/comment/36533212
type: Comment
comment on: http://stackoverflow.com/a/23744165
has text: @eskalera Yes, that's the information I was looking for.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23715710
has comment: http://stackoverflow.com/comment/36448170
has body: I have the following Set, I would like to replace any instance that is multiple of 10 by the string "10". Can anyone guide me in the right direction please. Set&lt;Integer&gt; set3 = new HashSet&lt;Integer&gt;(); for(int i = 0; i&lt;10; i++){ Random ran = new Random(); number = 1+ran.nextInt(1000); set3.add(number); }
tagged with: java
has answer: http://stackoverflow.com/a/23716056
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36448361
has comment: http://stackoverflow.com/comment/36448510
has answer: http://stackoverflow.com/a/23716271
score: 0
has comment: http://stackoverflow.com/comment/36448190
answer count: 3
has answer: http://stackoverflow.com/a/23716029
favorite count: 0
has comment: http://stackoverflow.com/comment/36448141
type: UnansweredQuestion
has title: How to change a instance in a set
has comment: http://stackoverflow.com/comment/36448443

http://stackoverflow.com/a/23739717
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23739578
score: 3
has body: If using JFrame or extending it you can use setDefaultCloseOperation() method like: frame.setDefaultCloseOperation(HIDE_ON_CLOSE); // or frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

http://stackoverflow.com/comment/36475773
comment on: http://stackoverflow.com/q/23729713
score: 0
type: Comment
type: QuestionComment
has text: @deathlee That means that there's another thread doing the work somewhere.... Wonder what thread that is.

http://stackoverflow.com/q/23768845
answer count: 1
has title: How to by default return 405 method not allowed when wrong HTTP method is used for given URL?
type: AnsweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/23777519
type: Question
has body: It looks like Play returns 404 when you want to access URL with wrong HTTP method. In Django there is a possibility to use require_http_methods decorator where you can place HTTP methods which can be used with given view and when wrong method is used then 405 is returned. Is there some easy way to specify in Play routes file or somewhere else to return 405 method not allowed response when wrong method was used (for example POST instead of GET) - without doing explicit controller handler for each URL?
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23777519

http://stackoverflow.com/comment/36460497
type: QuestionComment
type: Comment
score: 1
has text: I would suggest to you to read each line using the method readline of the BufferedReader class and then make a split using the space character in order to obtain an array of characters that you can convert in an array of integer.
comment on: http://stackoverflow.com/q/23722067

http://stackoverflow.com/comment/36452253
type: Comment
has text: Oops...meant thanks, not tanks. `;P`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23717742

http://stackoverflow.com/a/24734730
has body: This question is from May but in case anyone still has this problem ... The Freetype dll is automatically extracted from the jar file into your temp folder and loaded from there. But the message you get means that the JNA bridge cannot be initialized. That's a problem with your classpath. You need jna.jar and the other jpod dependencies in your classpath.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23732386
answers question: http://stackoverflow.com/q/23732386

http://stackoverflow.com/q/23620360
downvote count: 0
has body: I have a class like this: class MultiDataPoint { private DateTime timestamp; private Map&lt;String, Number&gt; keyToData; } and i want to produce , for each MultiDataPoint class DataSet { public String key; List&lt;DataPoint&gt; dataPoints; } class DataPoint{ DateTime timeStamp; Number data; } of course a 'key' can be the same across multiple MultiDataPoints. So given a List&lt;MultiDataPoint&gt;, how do I use Java 8 streams to convert to List&lt;DataSet&gt;? This is how I am currently doing the conversion without streams: Collection&lt;DataSet&gt; convertMultiDataPointToDataSet(List&lt;MultiDataPoint&gt; multiDataPoints) { Map&lt;String, DataSet&gt; setMap = new HashMap&lt;&gt;(); multiDataPoints.forEach(pt -&gt; { Map&lt;String, Number&gt; data = pt.getData(); data.entrySet().forEach(e -&gt; { String seriesKey = e.getKey(); DataSet dataSet = setMap.get(seriesKey); if (dataSet == null) { dataSet = new DataSet(seriesKey); setMap.put(seriesKey, dataSet); } dataSet.dataPoints.add(new DataPoint(pt.getTimestamp(), e.getValue())); }); }); return setMap.values(); }
has answer: http://stackoverflow.com/a/23624574
has answer: http://stackoverflow.com/a/23638454
favorite count: 0
has title: How to map to multiple elements with Java 8 streams?
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
accepted answer: http://stackoverflow.com/a/23638454
type: Question
score: 60
tagged with: closures
upvote count: 60
answer count: 2
possible better answer: http://stackoverflow.com/a/23624574

http://stackoverflow.com/a/23739159
answers question: http://stackoverflow.com/q/23658494
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36495710
has body: ANOTHER WARNING! It only reads JAR files! I had the same issue with endless frustration. Even if you use the &lt;library&gt;&lt;folder dir="..."/&gt;&lt;/library&gt; method above, it will only read jar files from the classpath. I had a bunch of properties files that I read from the classpath in JBOSS, WebSphere (full), and Glassfish, but the same method doesn't work for Websphere Liberty. What I ended up doing is the above, and putting my properties files all in a .jar file. Very annoying but a work-around, in case you need to read non-jar files.

http://stackoverflow.com/q/23721942
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36461171
has answer: http://stackoverflow.com/a/23739781
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36485379
has title: Spring MVC - Could not get RequestDispatcher
type: Question
linked to: http://stackoverflow.com/q/14015642
has comment: http://stackoverflow.com/comment/36460196
answer count: 1
downvote count: 0
tagged with: jsp
duplicate of: http://stackoverflow.com/q/14015642
favorite count: 0
accepted answer: http://stackoverflow.com/a/23739781
has comment: http://stackoverflow.com/comment/36482665
has comment: http://stackoverflow.com/comment/36460209
linked to: http://stackoverflow.com/q/3232225
has body: I got a problem on my Spring MVC application. The problem only happens on the linux server, on local (windows 7 + eclipse), everything works fine. When I access my page, the controller is called but when the server has to serve the jsp page, i've got : HTTP Status 500 - Could not get RequestDispatcher for [/WEB-INF/pages/index.jsp]: Check that the corresponding file exists within your web application archive! The file exist, the path is fine. Here an extract from my web.xml cms-admin-dispatcher org.springframework.web.servlet.DispatcherServlet 1 cms-admin-dispatcher /do/* contextConfigLocation /WEB-INF/cms-admin-dispatcher-servlet.xml and my servlet dispatcher : <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/pages/" /> <property name="suffix" value=".jsp" /> I tried to replace my /do/* pattern by *.html but there is no change. I also tried to put my jsp outside WEB-INF. I tried : jsp /WEB-INF/pages/index.jsp org.apache.jasper.servlet.JspServlet jsp /toto That works, the jsp page is loaded but not resources. Other thing, I am unable to access any js file directly (resources/js/logs.js, outside the WEB-INF). I get a 404, on local I get my file. I have pretty no idea where this is coming from, again, it works perfectly on my local. The tomcat config is pretty common. so thanks for advance for any ideas.
upvote count: 1
tagged with: spring

http://stackoverflow.com/comment/36313965
has text: And? it covers a specific programing problem, should he extend the class or instantiate it. Now when your through being a kid then speak to me. I also don't see where it's ok to be a d-bag either so... yeah still waiting for relevance of why your still talking... I'll wait no I'd rather help others in need and not be a d-bag to them for asking a valid question.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23625942

http://stackoverflow.com/a/43422763
score: 0
has body: Writing my own obj loader and reading the spec very carefully, the details on the 'f' parameter are very vague, especially seeing some files contain 'f' lines with > 4 arguments on them. Turns out that these are actually a triangle strip in an odd order. Correct conversion to triangles is as follows (psuedo code): n = 0; triangles[n++] = [values[0], values[1], values[2]]; for(i = 3; i &lt; count(values); ++i) triangles[n++] = [ values[i - 3], values[i - 1], values[i] ]; Example: f: A B C D E F G Would be the following 5 triangles: A B C A C D B D E C E F D F G
upvote count: 2
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/108864893
answers question: http://stackoverflow.com/q/23723993
has comment: http://stackoverflow.com/comment/108704440
has comment: http://stackoverflow.com/comment/108672862
has comment: http://stackoverflow.com/comment/110574650

http://stackoverflow.com/comment/36479577
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23731605
has text: synchronized is about object's implicit monitor and ReentrantLock is about mutual exclusive access to resource.
score: 0

jsr356
tag name: jsr356
type: Tag
tags question: http://stackoverflow.com/q/23714686

http://stackoverflow.com/q/23691995
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23692761
has comment: http://stackoverflow.com/comment/36404320
has comment: http://stackoverflow.com/comment/36404469
has comment: http://stackoverflow.com/comment/36404732
has comment: http://stackoverflow.com/comment/36405446
answer count: 1
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/36404239
has comment: http://stackoverflow.com/comment/36404843
score: 0
tagged with: public-key-encryption
has comment: http://stackoverflow.com/comment/36405022
has body: I'm encountering this particular error after running my jar in an amazon linux. It was working fine in my OsX. I'm using the same public and private key in both machines. The only difference is the java version which is Machine where I made, test and compiled my script: Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Amazon server: OpenJDK Runtime Environment (amzn-2.4.7.1.40.amzn1-x86_64 u55-b13) This is the section of the script that's causing the error: public PublicKey getPublicKey(String _file) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, IOException { X509EncodedKeySpec _spec = new X509EncodedKeySpec(_getFileContents(_file)); KeyFactory _keyFactory = KeyFactory.getInstance(this._keyFactoryAlgo, this._provider); this._publicKey = _keyFactory.generatePublic(_spec); return this._publicKey; } GetFileContents: private byte[] _getFileContents(String _fileName) throws IOException { File _file = new File(_fileName); FileInputStream _fileStream = new FileInputStream(_file); byte[] _contents = new byte[(int) _file.length()]; _fileStream.read(_contents); if(_fileStream != null) { _fileStream.close(); _fileStream = null; } return _contents; } Here is the full error message: java.security.spec.InvalidKeySpecException: encoded key spec not recognised at org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi.engineGeneratePublic(Unknown Source) at org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi.engineGeneratePublic(Unknown Source) at java.security.KeyFactory.generatePublic(KeyFactory.java:328) at xxx.CryptKey.getPublicKey(CryptKey.java:167) at xxx.CryptSession.encryptWithPublicKey(CryptSession.java:316) at xxx.Crypt.encrypt(Crypt.java:57) at snippet.Snippet.main(Snippet.java:201) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor…
tagged with: bouncycastle
has answer: http://stackoverflow.com/a/23692761
tagged with: encryption
has title: Bouncy Castle "encoded key spec not recognised"

http://stackoverflow.com/comment/54165021
type: Comment
type: QuestionComment
has text: I think you want the RxJava library.
comment on: http://stackoverflow.com/q/23744024
score: 0

http://stackoverflow.com/comment/89699253
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23637392
has text: I had to bind `build-helper-maven-plugin` to ` validate `. The above ` process-resources ` did not work for me. Otherwise, this plugin solved this problem for me. Eclipse now displays `src/it/java` in its own source folder.

http://stackoverflow.com/q/23651404
tagged with: replaceall
has comment: http://stackoverflow.com/comment/36325239
tagged with: string
accepted answer: http://stackoverflow.com/a/23656502
tagged with: str-replace
favorite count: 0
tagged with: regex
has answer: http://stackoverflow.com/a/23656502
has answer: http://stackoverflow.com/a/23651579
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: "TEST STARTaTEST END"; I am having anchor tag in String variable. i want to retrieve only value of attr testognlexpression. Abouve string should be replaced with this TEST START ${LTRIM(a)} TEST END how can i retrieve or replace? my code looks like String text = "STARTaEND"; System.out.println(text.replaceAll( "</?a[^>testognlexpression]*>", "" )); }
possible better answer: http://stackoverflow.com/a/23651579
linked to: http://stackoverflow.com/q/1732348
answer count: 2
upvote count: 1
has title: Replace anchor tag using regular expression in java?

http://stackoverflow.com/a/23722638
type: Answer
score: 4
has body: To use a Toolkit, you first have to get one by calling the Toolkit static method getDefaultToolkit() and then use the object returned. Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension size = toolkit.getScreenSize();
upvote count: 4
answers question: http://stackoverflow.com/q/23722627
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23722627

http://stackoverflow.com/a/23775352
downvote count: 0
answers question: http://stackoverflow.com/q/23774721
upvote count: 3
has body: You can do it via intent chooser. Try this code i think this solution solve your purpose. Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_OPENABLE); // Set your required file type intent.setType("*/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "DEMO"),1001); then onActivityResult method. public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); // super.onActivityResult(requestCode, resultCode, data); if (requestCode == 1001) { Uri currFileURI = data.getData(); String path=currFileURI.getPath(); }}
type: Answer
score: 3

http://stackoverflow.com/comment/36346697
has text: They don't necessarily need specific ids, though there is nothing wrong with identifying them that way. What is important is that each fork is uniquely on one philosopher's left and another's right. How you choose to do that isn't relevant.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23661366
type: Comment

http://stackoverflow.com/comment/36308346
score: 0
has text: Why would you want that? How do you want to call it? What is it meant to do?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23642623

http://stackoverflow.com/a/23651579
type: Answer
has comment: http://stackoverflow.com/comment/36326361
has comment: http://stackoverflow.com/comment/36325420
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23651404
has body: public static void main(String []args){ String text = "a"; String val=text.replaceAll( ".*testognlexpression=", "" ); System.out.println(val.split("\\s+")[0].replaceAll("\"","")); } OP : ${LTRIM(a)}
downvote count: 0

http://stackoverflow.com/q/23651660
has comment: http://stackoverflow.com/comment/36359523
has answer: http://stackoverflow.com/a/24057263
has comment: http://stackoverflow.com/comment/36331477
tagged with: java
has comment: http://stackoverflow.com/comment/36329556
accepted answer: http://stackoverflow.com/a/24057263
has comment: http://stackoverflow.com/comment/36332340
type: Question
type: AnsweredQuestion
has body: I am trying to add some files dynamically to my project. I want to load those files as soon as they are added to my project. I am trying with the following code but it is not working : public void actionPerformed(AnActionEvent e) { e.getProject().getProjectFile().refresh(true, true); }
score: 0
has title: To refresh a project in intellij idea through java code
tagged with: intellij-idea
answer count: 1
has comment: http://stackoverflow.com/comment/36334651
has comment: http://stackoverflow.com/comment/36332905

http://stackoverflow.com/a/23644549
has body: As @Kon correctly points out, there is an implicit call to the default super constructor anyway (this can be easily verified by checking the bytecode with javap -c). If you don't want Eclipse to make it explicit, simply check the "Omit call to default constructor super()" checkbox at the bottom of the constructor creation GUI. Am I wrong for not adding this by default in the constructors I write? No, as long as long as you're referring to the default super constructor call super(). If the super constructor takes parameters, for example, then you need to make the call explicit. Any thing wrong with leaving the super() call in the constructor if I decide to use eclipse code generator? No, not at all.
answers question: http://stackoverflow.com/q/23644520
upvote count: 12
type: Answer
has comment: http://stackoverflow.com/comment/36312112
has comment: http://stackoverflow.com/comment/36312144
downvote count: 0
score: 12

http://stackoverflow.com/comment/36536893
type: AnswerComment
comment on: http://stackoverflow.com/a/23680042
has text: Thank you for reply. I'll try it.. I found a lot of articles where it is possible to get the font directly from resources.. once again locally works fine, but at production the text is invisible.. Without any exceptions.. Strange!
type: Comment
score: 0

dropwizard
tags question: http://stackoverflow.com/q/23642171
tags question: http://stackoverflow.com/q/23678360
tags question: http://stackoverflow.com/q/23663402
tags question: http://stackoverflow.com/q/23704616
tag name: dropwizard
tags question: http://stackoverflow.com/q/23642311
type: Tag
tags question: http://stackoverflow.com/q/23730814
tags question: http://stackoverflow.com/q/23628897
tags question: http://stackoverflow.com/q/23710416

http://stackoverflow.com/comment/36451543
type: AnswerComment
comment on: http://stackoverflow.com/a/23716834
type: Comment
has text: Thanks, that's useful.That website is really helpful too.I wish I could upvote your answer but I have no reputation, sorry.
score: 0

http://stackoverflow.com/q/23644111
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: Strategy for JSP Filters chained through grouped wild characters
type: Question
has comment: http://stackoverflow.com/comment/36323732
tagged with: jsp
tagged with: servlets
has comment: http://stackoverflow.com/comment/36329868
tagged with: filter
downvote count: 0
has body: Say for example I have a filter that responds to a mapping named "/admin". It forwards to other mappings called through "/admin/foo" towards "/admin/bar" etc. Is this a concrete strategy for building up a JSP page through the final mapping? Or is there a better way? And btw, is it possible to reject a call to /admin/[some_other_mapping] if it did not come from the previous filter/servlet? For example. Here is a chain of filters. Since filters, assumingly from what I have learned, do not know what the servlets are doing or are independent from them, I will not include them in the chain. /admin -> /admin/foo -> /admin/bar -> /admin/finish -> render JSP Case one : If I am in /admin/foo, and did not come from /admin, I will return to /admin. Case two : If I am in /admin/bar, and did not come from /admin/foo, I will return to /admin. This is in order to complete the chain without any erratic effect on the rendered JSP.
favorite count: 0

http://stackoverflow.com/a/23701885
accepted answer of: http://stackoverflow.com/q/23701750
score: 0
type: AcceptedAnswer
has body: Depending on your situation, you could create a separate custom button class that extends JButton or simply create a new JButton. Your code will look very similar to something like this: ImageIcon yourImage = new ImageIcon(imageLocation); JButton buttonDeposit = new JButton(yourImage); frame.add(button);
type: Answer
answers question: http://stackoverflow.com/q/23701750

http://stackoverflow.com/q/23773938
has comment: http://stackoverflow.com/comment/36561117
downvote count: 2
answer count: 3
tagged with: solid-principles
has comment: http://stackoverflow.com/comment/36559804
has comment: http://stackoverflow.com/comment/36559806
has comment: http://stackoverflow.com/comment/36560189
has title: I want to follow the interface segregation principle but the class is closed. Is a wrapper the right way?
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/36559717
has comment: http://stackoverflow.com/comment/36583606
linked to: http://stackoverflow.com/q/58988
has comment: http://stackoverflow.com/comment/36647165
has body: More than a few times I've found my self working with a class that is closed (I can't modify it) that I wish implemented a nice narrow interface particular to my needs. My client code is supposed to own the interface but I know of no mechanism to announce that this closed class is a implementation of my narrowed interface. I'm trying to allow this class to be passed in (dependency injected) to my code (composition) but also anything else that can support the narrowed interface. In other languages duck typing makes this trivial. I'm in java though, so I'm expecting to have to write a whole other class just to wrap the closed class to make this happen. Is there a way I'm missing? Thanks EDIT to address dupe: The Interface Segregation Principle offers no mention of the closed class issue which is the point of this question. Please reconsider marking as dupe of this particular question. This question: Interface Segregation Principle- Program to an interface, has a good example of the interface segregation principle: class A { method1() method2() // more methods method10() } class B { A a = new A() } will become interface C { method1() method2() } class A implements C{ method1() method2() // more methods method10() } class B { C c = new A() } But note how it requires a change to class A. If A is closed to modification how do I accomplish the same thing cleanly?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23786848
upvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/36559829
linked to: http://stackoverflow.com/q/9249832
has comment: http://stackoverflow.com/comment/36560062
has comment: http://stackoverflow.com/comment/36560131
has answer: http://stackoverflow.com/a/23820568
has answer: http://stackoverflow.com/a/23781594
favorite count: 0
has comment: http://stackoverflow.com/comment/36560249
has comment: http://stackoverflow.com/comment/36559952
has comment: http://stackoverflow.com/comment/36560644
type: Question
tagged with: interface-segregation-principle
tagged with: java

http://stackoverflow.com/comment/36567038
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23777840
has text: Essentially you know 1 side of a right angled triangle (either 1/4 or 1/2 or 3/4 of the radius) and the hypotenuse (=radius), so you can easily do a tan inverse to find the angle.

http://stackoverflow.com/a/23699837
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23699595
has body: i will modify little bit your structure if( score &gt;0){ messagePlayer("You scored 1."); } if(score &gt;4){ messagePlayer("You scored 5."); } if(score &gt; 19){ messagePlayer("You scored 20."); } if(score &gt; 49){ messagePlayer("You scored 50."); } if(score &gt; 99){ messagePlayer("You scored 100."); } note that, i removed else statements
type: Answer
has comment: http://stackoverflow.com/comment/36417526
has comment: http://stackoverflow.com/comment/36417685

generics
tags question: http://stackoverflow.com/q/23767056
tags question: http://stackoverflow.com/q/23759068
tags question: http://stackoverflow.com/q/23770886
tags question: http://stackoverflow.com/q/23673180
tags question: http://stackoverflow.com/q/23736316
tags question: http://stackoverflow.com/q/23617190
tags question: http://stackoverflow.com/q/23700031
tags question: http://stackoverflow.com/q/23667920
tags question: http://stackoverflow.com/q/23642248
tags question: http://stackoverflow.com/q/23731270
tags question: http://stackoverflow.com/q/23667243
type: Tag
tags question: http://stackoverflow.com/q/23722124
tags question: http://stackoverflow.com/q/23735104
tags question: http://stackoverflow.com/q/23744582
tags question: http://stackoverflow.com/q/23695375
tags question: http://stackoverflow.com/q/23628697
tags question: http://stackoverflow.com/q/23645753
tags question: http://stackoverflow.com/q/23679455
tags question: http://stackoverflow.com/q/23772102
tags question: http://stackoverflow.com/q/23697161
tags question: http://stackoverflow.com/q/23722251
tags question: http://stackoverflow.com/q/23748857
tags question: http://stackoverflow.com/q/23772308
tags question: http://stackoverflow.com/q/23744298
tags question: http://stackoverflow.com/q/23645891
tags question: http://stackoverflow.com/q/23767116
tags question: http://stackoverflow.com/q/23770591
tags question: http://stackoverflow.com/q/23617235
tags question: http://stackoverflow.com/q/23707938
tags question: http://stackoverflow.com/q/23632351
tags question: http://stackoverflow.com/q/23645291
tags question: http://stackoverflow.com/q/23630462
tags question: http://stackoverflow.com/q/23713350
tags question: http://stackoverflow.com/q/23626614
tags question: http://stackoverflow.com/q/23672720
tags question: http://stackoverflow.com/q/23616448
tags question: http://stackoverflow.com/q/23761766
tags question: http://stackoverflow.com/q/23663295
tags question: http://stackoverflow.com/q/23622054
tags question: http://stackoverflow.com/q/23716272
tags question: http://stackoverflow.com/q/23760662
tag name: generics
tags question: http://stackoverflow.com/q/23752943
tags question: http://stackoverflow.com/q/23686740

http://stackoverflow.com/comment/36517563
type: QuestionComment
has text: @ Eldad : Yes I have my eclipse referring to the same settings.xml and I am able to view the jar through the Nexus UI..@oberlies: I am trying to access the localhost to invoke the jar... Please help me resolve this issue. –
comment on: http://stackoverflow.com/q/23739834
score: 0
type: Comment

http://stackoverflow.com/q/23647340
tagged with: maven-tomcat-plugin
type: Question
has answer: http://stackoverflow.com/a/23647401
tagged with: java
tagged with: manifest
possible better answer: http://stackoverflow.com/a/23647401
has title: How to run a main after embedded tomcat is run
answer count: 2
accepted answer: http://stackoverflow.com/a/23648042
has body: There is a java webapp with an embedded tomcat 7 that is built with this instructions (Using tomcat7-maven-plugin). this webapp is launching with a jar file like this: java -jar webapp.jar Question: How to run a main class after launching this embedded tomcat?
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23648042
tagged with: embedded-tomcat-7

http://stackoverflow.com/comment/36328484
has text: I'm not familiar with the `timeout()` call and whether it exists for all platforms that Java wishes to support, or if it was left out for other reasons. But if you have a problem, you should state what you want to happen and why, then a proper solution can be sought out. It's useless to say that in C++ or another platform this could be solved in way X, because you're on Java and you'll play with Java's rules. If you want `timeout()`, don't use Java and whine about the lack of it. Jeez.
comment on: http://stackoverflow.com/q/23650349
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36410303
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23688674
type: Comment
has text: @Reimeus I have `java.text.DecimalFormat` imported

http://stackoverflow.com/comment/36377170
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23653915
has text: What error says more after adding `mysql-connector` jar to application class path?
score: 0

http://stackoverflow.com/comment/36439614
type: AnswerComment
score: 0
type: Comment
has text: Can you share your code so that I will have the multiple solution of this problem.
comment on: http://stackoverflow.com/a/23711226

http://stackoverflow.com/comment/36452596
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23717708
has text: Thanks again @dasblinkenlight However, it seems now I get an error in the return statement you suggested: `Cannot specify an array dimension after an empty dimension`. I'm assuming this because I need to do this: `return subjectsArray.toArray(new String[subjectsArray.size()][]);` istead of what you have suggested. Is that right? This Method is this only thing holding me up from completing this assignment and it's really frustrating.

http://stackoverflow.com/q/23728688
has body: When I run my application it works but throws exceptions in console as following: Every time it shows a different timer number. All technologies that I used are tagged for the question. Please let me know if you need me to share any other part of my code apart from following. SEVERE: Exception in thread "Timer-0" SEVERE: java.lang.IllegalStateException: This web container has not yet been started at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1652) at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611) at com.mchange.v2.resourcepool.BasicResourcePool.checkIdleResources(BasicResourcePool.java:1481) at com.mchange.v2.resourcepool.BasicResourcePool.access$2000(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:1964) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) hibernate.cfg.xml com.mysql.jdbc.Driver jdbc:mysql://localhost/test root org.hibernate.dialect.MySQLDialect true 5 100 300 50 3000 thread org.hibernate.cache.NoCacheProvider HibernateUtil public class HibernateUtil { private static SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { System.err.println("in session Facotry"); Configuration configuration = new Configuration(); return configuration.configure().buildSessionFactory( new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()) .build()); } catch (HibernateException ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
tagged with: spring-security
tagged with: glassfish
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/36473890
has answer: http://stackoverflow.com/a/23907149
answer count: 3
has comment: http://stackoverflow.com/comment/36474887
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36802653
has comment: http://stackoverflow.com/comment/36473900
upvote count: 1
has comment: http://stackoverflow.com/comment/36745255
downvote count: 1
has comment: http://stackoverflow.com/comment/36473983
has comment: http://stackoverflow.com/comment/36652322
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36745457
has comment: http://stackoverflow.com/comment/36758652
type: Question
has answer: http://stackoverflow.com/a/23755193
has answer: http://stackoverflow.com/a/23842290
has title: Exception in thread "Timer-0" thrown when run the application
has comment: http://stackoverflow.com/comment/36473873
has comment: http://stackoverflow.com/comment/36783715

http://stackoverflow.com/comment/36324582
type: QuestionComment
has text: are these tables in 2 different JSP pages?
comment on: http://stackoverflow.com/q/23650824
score: 0
type: Comment

http://stackoverflow.com/q/23654788
type: Question
linked to: http://stackoverflow.com/q/116394
has answer: http://stackoverflow.com/a/23782745
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/23655060
accepted answer: http://stackoverflow.com/a/23655060
tagged with: java-me
has title: Which topics of Java SE are prerequisites for Java ME?
favorite count: 0
downvote count: 2
has body: I'm really new to Java and I'd like to ask you ,which aspects of Java SE are considered to be necessary for someone wanting to learn Java ME? Something like prerequisites. To start with Java SE, I chose this book, but since I don't have much time, it would be great to hear from experienced developers which parts I should definitely focus on and which parts I could skip to save time. If is there any topic from Java SE that could also be considered a prerequisite for Java ME, feel free to mention it.
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23782745

http://stackoverflow.com/comment/36514830
has text: I want, if I click on widget he start update, and widget update every 30 minutes, but now (in this code) widget update every seconds. Where i made mistake?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23741110
type: Comment

http://stackoverflow.com/q/23635528
tagged with: fonts
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I'm trying to realize a simple software that should use both standard european characters and japanese characters (hiragana / katakana / kanji), but I'm experiencing the following problem. I would like to make the japanese text bigger, but if I set a higher number as font dimension I start seeing squares instead of characters, while if I keep standard dimension everything is fine. How can I see bigger japanese fonts?
has answer: http://stackoverflow.com/a/23636553
type: Question
has comment: http://stackoverflow.com/comment/36294052
has comment: http://stackoverflow.com/comment/36293998
answer count: 1
accepted answer: http://stackoverflow.com/a/23636553
has comment: http://stackoverflow.com/comment/36295728
score: 0
favorite count: 0
has title: Issue with the size of japanese characters (hiragana / katakana / kanji)
has comment: http://stackoverflow.com/comment/36294479
linked to: http://stackoverflow.com/q/7434845

http://stackoverflow.com/q/23679769
has body: can't seem to trace why i get an HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. Here is my snippet which of the actual writing DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement; Element childElement; /* iterate through list */ Iterator<Map<String,String>> mapItrList = mapList.iterator(); Map<String, String> tempMap; String[] tempKeySet; while(mapItrList.hasNext()) { tempMap = mapItrList.next(); /* process each data */ rootElement = doc.createElement(key); rootElement.setAttribute("id", tempMap.get(key)); doc.appendChild(rootElement); tempKeySet = tempMap.keySet().toString().replace("[", "").replace("]", "").split(","); for(int temp = 0; temp < tempKeySet.length; temp++) { if(!tempKeySet[temp].equals(key)) { childElement = doc.createElement("col"); childElement.setAttribute("id", tempKeySet[temp].toString()); childElement.appendChild(doc.createTextNode(tempMap.get(tempKeySet[temp]))); rootElement.appendChild(childElement); } else { /* do nothing */ } } } // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); //StreamResult result = new StreamResult(new File("file.xml")); StreamResult result = new StreamResult(System.out); transformer.transform(source, result); System.out.println("File saved!"); expected XML result asdf asdf ... asdf asdf ... asdf asdf ... ... Key notes: tempMap has this kind of strucutre { Status1=status1, Status2=status2, Type=myType, Status3=status3, Status4=status4 } key refer to the on XML col refer to the inner loop Just so you know why there is a while, that because im iterating through a list of Map so its expected to have many and inside Map there is also a number of inputs so in first iteration of while l…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36380544
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36385597
has comment: http://stackoverflow.com/comment/36380749
answer count: 0
has comment: http://stackoverflow.com/comment/36380973
type: Question
has comment: http://stackoverflow.com/comment/36380607
tagged with: java
has title: Writing XML using java results in HIERARCHY_REQUEST_ERR
score: 0

http://stackoverflow.com/comment/36510062
type: QuestionComment
type: Comment
has text: As I don't have a complete answer, I'd just like to mention that for `Comparable` keys `HashMaps` now have `O(lg n)` worst-case performance
comment on: http://stackoverflow.com/q/23747954
score: 0

http://stackoverflow.com/q/23757219
score: 0
duplicate of: http://stackoverflow.com/q/469913
has answer: http://stackoverflow.com/a/23757334
answer count: 1
type: UnansweredQuestion
tagged with: regex
linked to: http://stackoverflow.com/q/469913
tagged with: java
has body: I'm pretty new to java regexp and trying to compile a Pattern that simplifies this: String str1; String str2; String str3; String str4; String str; if ((str.contains(str1) || str.contains(str3)) &amp;&amp; str.contains(str3) || str.contains(str)) { return true; } else { return false; } I figured out I can do the OR with "|" but how do I compile the AND? I want to be able to compile the pattern and check many strings with good performance. EDIT: I got this now : private static boolean checkPatternOR() { String patternString = "foo" ; Pattern pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE); Matcher matcher1 = pattern.matcher("foo bar"); Matcher matcher2 = pattern.matcher("something else"); System.out.println("does it match? " + (matcher1.lookingAt() &amp;&amp; matcher2.lookingAt())); return true; } How would I merge matcher1 and matcher2 into one?
has title: AND for java compiled pattern
type: Question
has comment: http://stackoverflow.com/comment/36527468

http://stackoverflow.com/q/23767286
downvote count: 0
has comment: http://stackoverflow.com/comment/36547241
favorite count: 0
has comment: http://stackoverflow.com/comment/36580626
has answer: http://stackoverflow.com/a/23767421
tagged with: jframe
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36556757
upvote count: 2
tagged with: java
has body: Okay so I have spent a lot of time searching for some answers to my problem and I have had very little luck. I am trying to add a graphic that I have painted to a JPanel and then adding the JPanel to the JFrame. here is my code: import java.awt.*; import javax.swing.*; public class Testing { public static void main(String[] args) { JFrame f = new JFrame("JFrame with a JPanel"); f.setSize(500,500); JLabel l1 = new JLabel("Hello !"); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); DrawBox dB = new DrawBox(400,200,20,20); p1.add(l1); p2.add(dB); f.add(p1,BorderLayout.PAGE_END); f.add(p2,BorderLayout.CENTER); //f.add(dB); //Adding directly to the JFrame works fine f.setVisible(true); } } Next is the class that creates the graphic public class DrawBox extends JPanel { int xVal = 0; int yVal = 0; int width = 0; int height = 0; public DrawBox(int x, int y, int w, int h) { xVal = x; yVal = y; width = w; height = h; } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(xVal, yVal, width, height); } } If I add DrawBox directly to the the JFrame it seems to work fine. However if I try to add more than one graphic directly to JFrame only one of them will show.
tagged with: swing
type: Question
has title: Java adding Graphic to JPanel and then to JFrame
has comment: http://stackoverflow.com/comment/36547115
tagged with: jpanel
linked to: http://stackoverflow.com/q/7229226
answer count: 1

http://stackoverflow.com/comment/36308883
comment on: http://stackoverflow.com/a/23624362
type: AnswerComment
score: 0
type: Comment
has text: If server is stopped then all the object are destroyed automatically because objects resides inside server JVM.

http://stackoverflow.com/a/23668458
score: 0
answers question: http://stackoverflow.com/q/23668415
type: Answer
has body: Look at the implementation note for Collections.sort(). It specifies that Collections.sort implementation should use iterative merge sort : Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays. This should give you an estimate of the runtime conplexity of Collections.sort(). It will vary depending on how much partially sorted your list is. The upper bound being O(n logn)

http://stackoverflow.com/a/23701926
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23701872
downvote count: 0
has comment: http://stackoverflow.com/comment/36422180
has comment: http://stackoverflow.com/comment/36422087
has comment: http://stackoverflow.com/comment/36421963
answers question: http://stackoverflow.com/q/23701872
has comment: http://stackoverflow.com/comment/36421919
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36422129
has body: It sets the data that you want the Intent to operate on. It's the same as calling the default constructor new Intent() and then calling setData(uri). Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(i); This starts the ACTION_VIEW Intent to view the google webpage.
score: 2
has comment: http://stackoverflow.com/comment/36422212

http://stackoverflow.com/q/23624177
has body: I'm trying to read huge pdf file using byte Array, Here is my code for it. String RESULT "D/new/certficateVisualFinal.pdf"; try { FileInputStream fileInputStream=null; File file = new File(RESULT); byte[] bFile = new byte[(int) file.length()]; //convert file into array of bytes fileInputStream = new FileInputStream(file); fileInputStream.read(bFile); fileInputStream.close(); reader = new PdfReader(bFile); pdfStamper = new PdfStamper(reader, new FileOutputStream(outPut)); pdfStamper.setOutlines(outlineVisual); pdfStamper.setFormFlattening(true); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } But I got a OutOfMemoryErro when trying to fileInputStream.read(bFile); This is the Error Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:220) please help me.Thank you.
score: -1
has title: java.lang.OutOfMemoryError when trying to read huge PDF file to byte array
downvote count: 2
upvote count: 1
tagged with: http://stackoverflow.com/tag/pdf
accepted answer: http://stackoverflow.com/a/23624473
favorite count: 0
tagged with: out-of-memory
has answer: http://stackoverflow.com/a/23624473
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: fileinputstream
tagged with: arrays
answer count: 1

http://stackoverflow.com/comment/36494226
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23737579
has text: Have you added the library/dependency to your class path?

http://stackoverflow.com/a/23756863
upvote count: 4
has body: You're doing this all wrong. You have to consume all the output of a process, on both stdout and stderr, before it makes any sense to call waitFor(). Otherwise the process can block trying to write its own output. NullPointerExceptions on the other hand are just due to trivial coding bugs that you're expected to be able to iron out on your own. At least I expect it.
has comment: http://stackoverflow.com/comment/36528185
downvote count: 0
has comment: http://stackoverflow.com/comment/37157271
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/36527393
answers question: http://stackoverflow.com/q/23756326

http://stackoverflow.com/comment/36452601
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23717957
has text: Does `toString()` print the typical unhelpful `className + "@" + hexDigits"?
score: 0

http://stackoverflow.com/q/23719655
has answer: http://stackoverflow.com/a/23719679
has body: I want user to key in some input, the setter method is on the other class, but I don't know how to write the code. Did I miss something or make some mistake? Here is my code. Project.java public class Project { private String projectName; //constructor public Project() { projectName = "No Project"; } //projectName setter public void setProjectName(String projectName) { this.projectName = projectName; } //projectName getter public String getProjectName() { return projectName; } //display info public void displayInfo () { System.out.println("**PROJECT DETAILS**"); System.out.println("Project Name : " + projectName); } } //close class DisplayProject.java public class DisplayProject { public static void main(String[] args) { //create object Project createProject = new Project(); Scanner input = new Scanner (System.in); //enter project name System.out.print("Enter project name: "); createProject.setProjectName(projectName) = input.nextLine(); &lt;Here is my problem&gt; } // close main class } //close class
downvote count: 1
possible better answer: http://stackoverflow.com/a/23719682
type: Question
has answer: http://stackoverflow.com/a/23719682
answer count: 2
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/23719679
has title: How to use scanner input in java
favorite count: 0
tagged with: java.util.scanner
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36311098
type: Comment
comment on: http://stackoverflow.com/a/23643738
has text: Ok, now that that's cleared up, I posted the actual answer you were looking for :-P
score: 0
type: AnswerComment

http://stackoverflow.com/q/23722156
accepted answer: http://stackoverflow.com/a/23722269
tagged with: android
answer count: 4
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/427902
has comment: http://stackoverflow.com/comment/36461106
type: Question
has answer: http://stackoverflow.com/a/23722245
linked to: http://stackoverflow.com/q/10638088
has answer: http://stackoverflow.com/a/23722269
has answer: http://stackoverflow.com/a/23722246
score: 0
tagged with: singleton
linked to: http://stackoverflow.com/q/70689
has title: "one word" singleton access in Android / Java?
possible better answer: http://stackoverflow.com/a/23722214
has answer: http://stackoverflow.com/a/23722214
has body: Java friends, in objectiveC with a singleton, normally you have a macro, #define STATE [State sharedState] Then throughout the project, anywhere at all, you just type STATE.explode() STATE.attackTanks() and so on. Similarly in Swift you can access a macro in "one word" with no further effort. In an Android project, public class Handy { // singleton private static Handy ourInstance = new Handy(); private Handy() {} public synchronized static Handy getInstance(){return ourInstance;} public void Example(String ss) { Log.v("Java rocks ", ss); } } you can access it everywhere like this Handy.getInstance() No problem. But my goal is to use that anywhere with "one word" only. Of course, you can Handy HANDY = Handy.getInstance(); at the top of each file you need to use it in. But, is there a way to make a one-word symbol which is available project-wide, with no further effort? Sorry if the question is trivial to Java experts! Cheers Inicdentally I believe there are other approaches (example) to singletons in Java; above I pasted in the standard code supplied by Android Studio.

http://stackoverflow.com/comment/36382141
type: AnswerComment
has text: @user please post your code, then. Also have you checked the database state during your method execution? Maybe your sample project caused a flush before the final commit.
comment on: http://stackoverflow.com/a/23679887
type: Comment
score: 0

http://stackoverflow.com/a/23697392
type: Answer
answers question: http://stackoverflow.com/q/23695844
score: 0
has body: If you really need to reinvent security annotations (if you don't want to use already available options with declarative security like EJB or Spring) you may at least want to see how they implement it. Here for example for one of EJB implementations. But maybe you would reconsider?

http://stackoverflow.com/a/23660339
downvote count: 0
has comment: http://stackoverflow.com/comment/36343192
has body: Checkstyle inspects code that you have. It doesn't control formatting. You need to control the formatting through Eclipse. Window -&gt; Preferences -&gt; Java -&gt; Code Style -&gt; Formatter is where you want to start poking around. EDIT after update of question: The Indentation module belongs under the TreeWalker module, not the Checker module.
has comment: http://stackoverflow.com/comment/36343020
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36344153
accepted answer of: http://stackoverflow.com/q/23660251
has comment: http://stackoverflow.com/comment/36344109
has comment: http://stackoverflow.com/comment/36344080
answers question: http://stackoverflow.com/q/23660251
type: AcceptedAnswer

http://stackoverflow.com/a/23728596
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23728581
has body: Because with the first two layouts, the JLabel will fill the container, here the JPanel. With the other layouts, it will size to its preferredSize which is 0. Consider overriding getPreferredSize if you wish to use other layouts. Also note: You should not read in image files without a paintComponent method. You shouldn't be re-reading image files if possible (which will happen if you read in the images in a method that gets repeatedly called). Read them in once, such as in a constructor, and store them in a field. You should not dispose of a Graphics object that the JVM gives you, only one that you create yourself (such as from a BufferedImage). Edit For example, something like this: private class TransparentBG extends JLabel { BufferedImage image; public TransparentBG() throws IOException { image = ImageIO.read(TransparentBG.class.getClassLoader() .getResourceAsStream("footballQuestioner/rightAnswerSign.png")); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; if (image != null) { g2d.drawImage(image, 0, 0, null); } // g2d.dispose(); } @Override public Dimension getPreferredSize() { if (image != null) { int w = image.getWidth(); int h = image.getHeight(); return new Dimension(w, h); } return super.getPreferredSize(); } }
answers question: http://stackoverflow.com/q/23728581
type: AcceptedAnswer
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/36515502
type: QuestionComment
type: Comment
has text: ok the code i given just now is a draft , if u want a complete statement, i just added.
score: 0
comment on: http://stackoverflow.com/q/23750834

http://stackoverflow.com/comment/36406669
type: Comment
has text: Environment? if you are mentioning about jdk, I am using 8.05 in my linux machine. I ran the code. It returned retValue = 1 and Logged User: .I am new to running strace so I don't know about it. How can I do that?
comment on: http://stackoverflow.com/a/23676693
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36422023
comment on: http://stackoverflow.com/q/23701986
has text: There's no such thing as "`if` loop". Replace `if` -> `while`. Then [delete] :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23770580
tagged with: ide
tagged with: module
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has title: IntelliJ reports "sources not found" even though source opened in other module
tagged with: intellij-idea
has body: I have ScanResults results; // me.unroll.scanner.ScanResults logFilterStateReceived(filterState, results.googleImage); I just added the field googleImage. It's giving me the error "Cannot resolve symbol 'googleImage". When I jump to the declaration of ScanResults it fails to retrieve the source and recompiles something - something, I don't know what - into an obsolete version of my Scanner module. So the Scanner module is open in Project Structure > Email-Lib, where the above code sample lives, Scanner is listed as a compile dependency with the little folder icon, which I think means it's working / on disc I redeployed the code to Maven in any case. Why is it not pulling the local code?
has answer: http://stackoverflow.com/a/23770581
answer count: 1

http://stackoverflow.com/a/23686897
answers question: http://stackoverflow.com/q/23686267
has body: Since you are just forwarding bytes, you could save a little time by not using DataInputStream, and instead just using BufferedInputStream.read() and BufferedOutputStream.write().
score: 0
has comment: http://stackoverflow.com/comment/36394266
type: Answer

libgdx
tags question: http://stackoverflow.com/q/23742328
tags question: http://stackoverflow.com/q/23712137
tags question: http://stackoverflow.com/q/23644412
tags question: http://stackoverflow.com/q/23771847
tags question: http://stackoverflow.com/q/23750284
tag name: libgdx
tags question: http://stackoverflow.com/q/23725813
tags question: http://stackoverflow.com/q/23717378
tags question: http://stackoverflow.com/q/23644858
tags question: http://stackoverflow.com/q/23665871
tags question: http://stackoverflow.com/q/23725531
tags question: http://stackoverflow.com/q/23706648
tags question: http://stackoverflow.com/q/23634147
tags question: http://stackoverflow.com/q/23663509
type: Tag
tags question: http://stackoverflow.com/q/23691868
tags question: http://stackoverflow.com/q/23761204
tags question: http://stackoverflow.com/q/23625933
tags question: http://stackoverflow.com/q/23766467
tags question: http://stackoverflow.com/q/23635701
tags question: http://stackoverflow.com/q/23672797
tags question: http://stackoverflow.com/q/23759731
tags question: http://stackoverflow.com/q/23744373
tags question: http://stackoverflow.com/q/23771592
tags question: http://stackoverflow.com/q/23656959
tags question: http://stackoverflow.com/q/23632389
tags question: http://stackoverflow.com/q/23681499
tags question: http://stackoverflow.com/q/23671120
tags question: http://stackoverflow.com/q/23713701
tags question: http://stackoverflow.com/q/23685845

http://stackoverflow.com/a/23620973
answers question: http://stackoverflow.com/q/23620892
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36269006
has body: do you have right the name of the layout? adapter = new GroceryItemAdapter(getActivity(), R.layout.list_textview, items); vs. list_product_item (I am assuming this is the file name for R.layout.list_product_item)
has comment: http://stackoverflow.com/comment/36266290
has comment: http://stackoverflow.com/comment/36266316

http://stackoverflow.com/a/23685291
has body: you need to pass database connection url, instead of just localhost, like jdbc:mysql://localhost:3306/ here's a good example
has comment: http://stackoverflow.com/comment/36391937
answers question: http://stackoverflow.com/q/23684790
type: Answer
has comment: http://stackoverflow.com/comment/36392750
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36404181
has comment: http://stackoverflow.com/comment/36405288
has comment: http://stackoverflow.com/comment/36394543
upvote count: 1

http://stackoverflow.com/a/23786117
has body: to send XML over SOAP you generally have two options... Either Base64 the String and un-Base64 it on the other side... http://commons.apache.org/proper/commons-codec/ byte[] encodedBytes = Base64.encodeBase64("Test".getBytes()); System.out.println("encodedBytes " + new String(encodedBytes)); byte[] decodedBytes = Base64.decodeBase64(encodedBytes); System.out.println("decodedBytes " + new String(decodedBytes)); Or escape the XML you want to send. This turns &lt; into &amp;lt; and > into &amp;gt; StringEscapeUtils (http://commons.apache.org/proper/commons-lang/) has a method to escape XML Generally go with the second option if you want to keep it human readable.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36615981
has comment: http://stackoverflow.com/comment/36582585
accepted answer of: http://stackoverflow.com/q/23769407
type: Answer
answers question: http://stackoverflow.com/q/23769407

http://stackoverflow.com/comment/36405284
comment on: http://stackoverflow.com/a/23685863
type: Comment
has text: You said yourself -> "but there is no way to prevent a letter from appearing more than once". I am confused as to what your end-goal is. Do you, or do you not want to display the unique letters?
score: 1
type: AnswerComment

http://stackoverflow.com/a/77852400
type: Answer
has body: The embedded database is not meant to work on different computers, it's a local database and not shared, the only way to achieve sharing this database is by using a remote version database like MySQL (which works on a server) instead of an embedded one, fortunately, H2 database has a remote version, it can be embedded, remote, or in-memory database. So change this jdbc:h2:~/test to this jdbc:h2:tcp://localhost:9092/test
score: 0
answers question: http://stackoverflow.com/q/23730719

http://stackoverflow.com/comment/36543864
type: Comment
has text: @user3557312, Holger's point about mixing up `Lock` and `synchronized` is important. You probably don't want to use `synchronized` in your top-level strategy. Synchronized blocks are safer, but less powerful than `Lock` because of they way that they are tied to a lexical scope: You can't unlock `synchronized` without leaving the scope, and you can't leave the scope without unlocking it. That's a very poor fit for the circular relationship between the philosophers and their chopsticks.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23765651

http://stackoverflow.com/comment/36354711
score: 0
has text: @cyon - yes - there appears to be multiple java installations. How would i specify which to use?
comment on: http://stackoverflow.com/q/23666168
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36554172
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23768737
score: 0
has text: @CommonsWare It may have seen confusing to describe an App as an element accessing my package, so I simplify my explanation by changing the App to a Class0, which represents any class external from Package1. Also I've added the visibility that I don't want to be available, marked with a red cross. I hope this satisfy you and clears any future doubt.

http://stackoverflow.com/comment/36536354
has text: Do you have an example for me? Didn't know what you mean. Everybody said: "When you acces templateGroups". How?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23759130

http://stackoverflow.com/comment/36455876
comment on: http://stackoverflow.com/q/23719637
has text: It's actually pretty clear what he's asking, I don't agree with the closing vote.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36346210
comment on: http://stackoverflow.com/q/23654987
has text: @haraldK I just found my issue, I think. Oddly this seems to be related to the image I used above only. I'm using ImageMagick to downsize the images as I get them from the web. When resizing the image above, it becomes TYPE_CUSTOM. Before resizing it is TYPE_4BYTE_ABGR. So Java seems like to not be able to handle it from then on.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23630729
answers question: http://stackoverflow.com/q/23630649
score: 1
has comment: http://stackoverflow.com/comment/36284238
type: AcceptedAnswer
downvote count: 0
has body: You might want to look into JavaDB or SQLite. Both can be embedded into your application, and can be run fully in memory (no persistence at all) or backed up by files.
type: Answer
accepted answer of: http://stackoverflow.com/q/23630649
upvote count: 1

http://stackoverflow.com/q/23718383
has answer: http://stackoverflow.com/a/46672107
has comment: http://stackoverflow.com/comment/80292616
tagged with: java
has answer: http://stackoverflow.com/a/33001846
has answer: http://stackoverflow.com/a/46039236
type: Question
answer count: 8
tagged with: java-time
has answer: http://stackoverflow.com/a/24563895
linked to: http://stackoverflow.com/q/37651837
has answer: http://stackoverflow.com/a/23718471
has comment: http://stackoverflow.com/comment/68668893
tagged with: jpa-2.1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/45903882
has title: JPA support for Java 8 new date and time API
favorite count: 0
score: 58
accepted answer: http://stackoverflow.com/a/23718471
upvote count: 58
tagged with: java-8
has answer: http://stackoverflow.com/a/27473145
has body: I'm using Java 8 for my new project. I'm trying to use new date and time api in java 8 however I don't know if JPA 2.1 fully supports this new Date and Time API or not. Please share your experience/opinion in JPA`s supports for new date and time API in Java 8. Can I use new date and time api in Java 8 safely with JPA 2.1? UPDATE: I'm using Hibernate (4.3.5.Final) as JPA implementation.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/33001846
has answer: http://stackoverflow.com/a/26291819

http://stackoverflow.com/comment/36333261
type: QuestionComment
comment on: http://stackoverflow.com/q/23655606
type: Comment
has text: If you are showing the console as an admin it might be because you need to enter the username and password
score: 0

http://stackoverflow.com/a/23772472
score: 1
answers question: http://stackoverflow.com/q/23772436
downvote count: 0
has body: Another method that you can use is format. It takes any number of arguments and formats them in various ways. The patterns should be familiar to you from other languages, they are pretty standard. System.out.format("Give grade: %s%n", args[0]);
type: Answer
upvote count: 1

http://stackoverflow.com/a/23623114
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36270736
answers question: http://stackoverflow.com/q/23622839
has comment: http://stackoverflow.com/comment/114332434
type: Answer
has comment: http://stackoverflow.com/comment/36270584
has body: The proper way to close a socket that is blocked reading in another thread is to shut it down for input. That will deliver an EOS to the reading thread, which should cause it to close the socket and exit.
has comment: http://stackoverflow.com/comment/48775923
accepted answer of: http://stackoverflow.com/q/23622839
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/36286442

http://stackoverflow.com/a/23629895
answers question: http://stackoverflow.com/q/23629075
has comment: http://stackoverflow.com/comment/36285134
downvote count: 0
has body: Change this part of your code Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.live.com"); to Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.rediffmailpro.com"); props.put("mail.smtp.port", "587"); And for this to work, you need to upgrade your guru_190693@rediffmail.com to rediff mail pro account.
score: 1
has comment: http://stackoverflow.com/comment/36284211
has comment: http://stackoverflow.com/comment/36282927
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36283118

http://stackoverflow.com/a/38035858
score: 8
upvote count: 9
type: Answer
has body: Suppose you have List of names(String) which you want to sort alphabetically. List&lt;String&gt; result = names.stream().sorted( Comparator.comparing(n-&gt;n.toString())).collect(Collectors.toList()); its working perfectly.
has comment: http://stackoverflow.com/comment/77453946
answers question: http://stackoverflow.com/q/23701943
downvote count: 1

http://stackoverflow.com/comment/36515651
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23750838
has text: @Halt, Use a `while` loop inside the `for` loop which will keep picking until you have found a location that is not already mined. I'll update the answer.

http://stackoverflow.com/q/23755657
tagged with: java
has title: Jmeter with Eclipse
type: Question
has body: I'm learning how to build Jmeter with Eclipse. I followed some online steps and downloaded Jmeter binary and source files, unzipped them into the same directory, created a java project in eclipse and used ant build but when i build i got the following error \workspace\apache-jmeter-2.11\build.xml:801: Class not found: javac1.8 I'm using JRE8, JDK1.8 and ant 1.9.4. Saw some similar post with answers saying that this is an issue with ant version &lt; 1.9 but i'm already using ant 1.9.4. Help please.
tagged with: ant
tagged with: eclipse
has answer: http://stackoverflow.com/a/23755873
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23755873
type: AnsweredQuestion
tagged with: jmeter

http://stackoverflow.com/comment/66397719
comment on: http://stackoverflow.com/a/27872852
type: Comment
score: 2
type: AnswerComment
has text: @IcedDante, it works with current implementation of Stream API, but violating contract in general is a bad thing. Another Stream API implementation might use your predicate in another way and may break if you violate the contract.

http://stackoverflow.com/comment/36499340
has text: @MikeStrobel I'm curious why, as `javac` already has the capability to determine whether a field is "effectively final" to deal with anonymous classes/lambdas and such...
comment on: http://stackoverflow.com/a/23741728
type: AnswerComment
type: Comment
score: 0

windows-server-2003
type: Tag
tag name: windows-server-2003
tags question: http://stackoverflow.com/q/23745304

http://stackoverflow.com/q/23693034
has comment: http://stackoverflow.com/comment/36406223
has comment: http://stackoverflow.com/comment/36406079
has body: I am downloading a file in this code, is it possible to have a progress bar that shows the donwload progress? I tried using async to download the file and have a progress bar but I failed every time. The progressbar is in a dialog that shows up when downloading. package com.maartendekkers.cmapps; public class CustomAdapter extends BaseAdapter{ String [] result; String[] desc; String [] app; Context context; int [] imageId; private static LayoutInflater inflater=null; public CustomAdapter(MainActivity mainActivity, String[] prgmNameList, String[] prgmAppName, String[] prgmDescList, int[] prgmImages) { // TODO Auto-generated constructor stub result=prgmNameList; desc=prgmDescList; app=prgmAppName; context=mainActivity; imageId=prgmImages; inflater = ( LayoutInflater )context. getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { // TODO Auto-generated method stub return result.length; } public class Holder { TextView tv; TextView tv2; ImageView img; } @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub Holder holder=new Holder(); View rowView; rowView = inflater.inflate(R.layout.single_row, null); holder.tv=(TextView) rowView.findViewById(R.id.textView1); holder.tv2=(TextView) rowView.findViewById(R.id.textView2); holder.img=(ImageView) rowView.findViewById(R.id.imageView1); holder.tv.setText(result[position]); holder.tv2.setText(desc[position]); holder.img.setImageResource(imageId[position]); rowView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext()); alert.setTitle("Install?"); alert.setMessage("Do you want to install "+result[position]+"?"); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @SuppressWarnings("unused") public void onClick(DialogInterface dialog, int whichButton) { //some code /** * The directory to store the files in */ final Str…
type: Question
has answer: http://stackoverflow.com/a/23698039
answer count: 1
has comment: http://stackoverflow.com/comment/36406470
tagged with: dialog
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23698039
linked to: http://stackoverflow.com/q/21249286
has title: ProgressBar with this code?
tagged with: progress-bar
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36406098
tagged with: android

http://stackoverflow.com/comment/36340270
type: QuestionComment
score: 1
has text: @Ralf is almost correct. Your inner for loop states: For every word that is not equal to my word in Final, add my word to the end of Final. This is exponential growth (which devours your memory). The logic is completely wrong, try running it with an empty Final to start with, you won't get a dictionary at the end, only empty lists.
comment on: http://stackoverflow.com/q/23658678
type: Comment

http://stackoverflow.com/comment/36318078
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23647732
has text: I agree. But Treemap has three extra pointers Entry<K,V> left; Entry<K,V> right; Entry<K,V> parent; Isn't this expensive?
type: AnswerComment

http://stackoverflow.com/q/23758005
possible better answer: http://stackoverflow.com/a/23758069
has title: Why is my return type wrong?
has answer: http://stackoverflow.com/a/23758069
score: 0
has comment: http://stackoverflow.com/comment/36529168
has comment: http://stackoverflow.com/comment/36528954
has answer: http://stackoverflow.com/a/23758054
has body: So I am trying to work out how inheritance works. I made a basicclass called 'Mens' and a subclass called 'Leerkracht'. Mens has one method called 'toon' which ofc is inherited by its subclass. The problem is that Netbeans doesn' allow me to use 'void' for return type with the inherited method in the subclass and I have absolutly no clue why. Mens class : public class Mens { private String naam; public Mens(String naam){ this.naam=naam; } public void toon(){ System.out.println(this.naam); } public static void main(String[] args) { } Leerkracht class: public class Leerkracht extends Mens{ public Leerkracht(String naam) { super(naam); } @Override public void toon(){ System.out.println("dit is een leerkracht"+ super.toon()); // the error is on the line above which states ''void' type not allowed here' } } Thank you for your time :)
has comment: http://stackoverflow.com/comment/36528942
has comment: http://stackoverflow.com/comment/36528891
favorite count: 0
tagged with: return-type
accepted answer: http://stackoverflow.com/a/23758054
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
upvote count: 1
downvote count: 1
type: Question
answer count: 2

jpa
tags question: http://stackoverflow.com/q/23749306
tags question: http://stackoverflow.com/q/23722767
tags question: http://stackoverflow.com/q/23721875
tags question: http://stackoverflow.com/q/23686281
tags question: http://stackoverflow.com/q/23677842
tags question: http://stackoverflow.com/q/23657826
tags question: http://stackoverflow.com/q/23663488
tags question: http://stackoverflow.com/q/23742474
tags question: http://stackoverflow.com/q/23714671
tags question: http://stackoverflow.com/q/23756553
tags question: http://stackoverflow.com/q/23672092
tags question: http://stackoverflow.com/q/23633949
tags question: http://stackoverflow.com/q/23764528
tags question: http://stackoverflow.com/q/23741643
tags question: http://stackoverflow.com/q/23743866
tags question: http://stackoverflow.com/q/23731262
tags question: http://stackoverflow.com/q/23654889
tags question: http://stackoverflow.com/q/23674788
tags question: http://stackoverflow.com/q/23730620
tags question: http://stackoverflow.com/q/23629760
tags question: http://stackoverflow.com/q/23662863
tags question: http://stackoverflow.com/q/23770586
tags question: http://stackoverflow.com/q/23633412
tags question: http://stackoverflow.com/q/23708905
tags question: http://stackoverflow.com/q/23623666
tags question: http://stackoverflow.com/q/23669755
tags question: http://stackoverflow.com/q/23745957
tags question: http://stackoverflow.com/q/23645757
tags question: http://stackoverflow.com/q/23625885
tags question: http://stackoverflow.com/q/23720295
tags question: http://stackoverflow.com/q/23722583
tags question: http://stackoverflow.com/q/23663652
tags question: http://stackoverflow.com/q/23679608
tags question: http://stackoverflow.com/q/23652289
tags question: http://stackoverflow.com/q/23736422
tags question: http://stackoverflow.com/q/23632717
tags question: http://stackoverflow.com/q/23667389
type: Tag
tags question: http://stackoverflow.com/q/23775175
tags question: http://stackoverflow.com/q/23719237
tags question: http://stackoverflow.com/q/23645661
tags question: http://stackoverflow.com/q/23719937
tags question: http://stackoverflow.com/q/23707847
tags question: http://stackoverflow.com/q/23715731
tags question: http://stackoverflow.com/q/23732759
tags question: http://stackoverflow.com/q/23681532
tags question: http://stackoverflow.com/q/23651999
tags question: http://stackoverflow.com/q/23651047
tags question: http://stackoverflow.com/q/23667626
tags question: http://stackoverflow.com/q/23656332
tags question: http://stackoverflow.com/q/23753510
tags question: http://stackoverflow.com/q/23633482
tags question: http://stackoverflow.com/q/23653007
tags question: http://stackoverflow.com/q/23659283
tags question: http://stackoverflow.com/q/23771719
tags question: http://stackoverflow.com/q/23696044
tags question: http://stackoverflow.com/q/23618506
tags question: http://stackoverflow.com/q/23682188
tags question: http://stackoverflow.com/q/23676644
tags question: http://stackoverflow.com/q/23640470
tags question: http://stackoverflow.com/q/23738243
tags question: http://stackoverflow.com/q/23750518
tags question: http://stackoverflow.com/q/23671227
tag name: jpa
tags question: http://stackoverflow.com/q/23686000
tags question: http://stackoverflow.com/q/23657484
tags question: http://stackoverflow.com/q/23699203
tags question: http://stackoverflow.com/q/23710312
tags question: http://stackoverflow.com/q/23733758
tags question: http://stackoverflow.com/q/23775497
tags question: http://stackoverflow.com/q/23679513
tags question: http://stackoverflow.com/q/23774916
tags question: http://stackoverflow.com/q/23728772
tags question: http://stackoverflow.com/q/23735217
tags question: http://stackoverflow.com/q/23669960
tags question: http://stackoverflow.com/q/23732675
tags question: http://stackoverflow.com/q/23718383
tags question: http://stackoverflow.com/q/23643066
tags question: http://stackoverflow.com/q/23645091
tags question: http://stackoverflow.com/q/23736109

http://stackoverflow.com/q/23642335
has comment: http://stackoverflow.com/comment/36308215
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23650403
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Parsing weired JSON format
type: Question
has comment: http://stackoverflow.com/comment/36307840
downvote count: 0
tagged with: jackson
has body: I have to parse JSON. I am using Jackson library to parse it. My code: JSONObject root = (JSONObject)parser.parse(response); JSONArray users = (JSONArray) root.get("response"); Everything would be fine if not a that number in from of elements (1192220) which actually represents a length of a structure. When I am reading it using root.get("response") this number appears to be a first element in users array. I really don't want that. Of course, I can manually truncate an array, but probably it should a better way of doing it. Any suggestions? { "response":[ 1192220, { "uid":39377403, "first_name":"John", "last_name":"Smith", "screen_name":"Super cool guy", "interests":"N/A" }, { "uid":19439900, "first_name":"Natalie", "last_name":"Brook", "screen_name":"nutaloveis", "interests":"bike" }, { "uid":5857176, "first_name":"James", "last_name":"Mercer", "screen_name":"alenkashishkova" }, .....] }
has answer: http://stackoverflow.com/a/23650403
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23634030
upvote count: 8
has comment: http://stackoverflow.com/comment/36598548
has comment: http://stackoverflow.com/comment/36291089
accepted answer of: http://stackoverflow.com/q/23633894
answers question: http://stackoverflow.com/q/23633894
has body: You need a dedicated Key Field to guarantee uniqueness .hashCode() isn't designed for what you are using it for .hashCode() is designed to give good general results in bucketing algorithms, which can tolerate minor collisions. It is not designed to provide a unique key. The default algorithm is a trade off of time and space and minor collisions, it isn't supposed to guarantee uniqueness. Perfect Hash What you need to implement is a perfect hash or some other unique key based on the contents of the object. This is possible within the boundries of an int but I wouldn't use .hashCode() for this representation. I would use an explicit key field on the object. Unique Hashing One way to use use SHA1 hashing that is built into the standard library which has an extremely low chance of collisions for small data sets. You don't have a huge combinational explosion in the values you posts to SHA1 will work. You should be able to calculate a way to generate a minimal perfect hash with the limited values that you are showing in your question. A minimal perfect hash function is a perfect hash function that maps n keys to n consecutive integers—usually [0..n−1] or [1..n]. A more formal way of expressing this is: Let j and k be elements of some finite set K. F is a minimal perfect hash function iff F(j) =F(k) implies j=k (injectivity) and there exists an integer a such that the range of F is a..a+|K|−1. It has been proved that a general purpose minimal perfect hash scheme requires at least 1.44 bits/key.2 The best currently known minimal perfect hashing schemes use around 2.6 bits/key.[3] A minimal perfect hash function F is order preserving if keys are given in some order a1, a2, ..., an and for any keys aj and ak, j A minimal perfect hash function F is monotone if it preserves the lexicographical order of the keys. In this case, the function value is just the position of each key in the sorted ordering of all of the keys. If the keys to be hashed are themselves stored in a sorted …
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36291510
has comment: http://stackoverflow.com/comment/36291398
has comment: http://stackoverflow.com/comment/36291007
has comment: http://stackoverflow.com/comment/36291182
type: Answer
has comment: http://stackoverflow.com/comment/36291097
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/36290958

http://stackoverflow.com/a/23654259
has comment: http://stackoverflow.com/comment/36373846
has comment: http://stackoverflow.com/comment/36331435
answers question: http://stackoverflow.com/q/23653583
type: Answer
has body: The origin a the term unit test is from "unit of work". A distinct unit of work is often, but not always a single method. In practice unit test often refers to testing a single class (compare SRP) and contrasts integration and acceptance tests. The JUnit framework comes from unit testing, but nowadays is used for all kinds and layers of tests. As a basic rule of thumb you should test all public methods. If you want, include negative tests, which feed your methods with invalid input. Usually they reveal the code's weaknesses. If two public methods overlap - as in your case - I am not aware of a hard use-all-the-time principle. You could A) Use Mockito or similar to mock m2() during access from m1(). B) Test m1() and m2() the ususal way. A) gives you a test more sensitive to m1 code but is more costly. Choose this if m1 code is important as a single unit of work. B) is the faster result and in my opinion is the better option as in case of an m1 error you will see immediately if there is an error in m2 as well. Maybe leave a small nice comment for other programmers that explains the dependence.
has comment: http://stackoverflow.com/comment/36365728
has comment: http://stackoverflow.com/comment/36366947
score: 0

http://stackoverflow.com/comment/36356992
type: Comment
type: QuestionComment
has text: [Swing GUI with background image](http://stackoverflow.com/a/23459402/300257).
comment on: http://stackoverflow.com/q/23665784
score: 0

http://stackoverflow.com/comment/36447688
comment on: http://stackoverflow.com/a/23715525
score: 0
type: AnswerComment
type: Comment
has text: The OP wants more buttons than just "Ok" and "Cancel", which you can't do with an input dialog. Also, I meant to use `showInputDialog(...)`.

http://stackoverflow.com/a/23627778
has comment: http://stackoverflow.com/comment/36283358
has comment: http://stackoverflow.com/comment/36281376
downvote count: 0
has comment: http://stackoverflow.com/comment/36283770
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36293498
score: 1
has comment: http://stackoverflow.com/comment/36290978
has comment: http://stackoverflow.com/comment/36283260
answers question: http://stackoverflow.com/q/23627372
has body: U can set textView Background as txt.setBackgroundResources(); or else try this This Not the Exact what You are looking for but I can say it will help you to find the Solution. private int xCord, yCord ; private final Paint dotPaint = new Paint(); private void init() { dotPaint.setAntiAlias(true); dotPaint.setStyle(Paint.Style.FILL); dotPaint.setColor(Color.parseColor("#FFAC4A70"));// Change color as per Ur... } private static final int DOT_RADIUS = 16;//change it as per requirement protected void onDraw(Canvas canvas) { super.onDraw(canvas); if(isEventCell) { xCord = getWidth() / 2; yCord = getHeight() - DOT_RADIUS - 8; canvas.drawCircle(xCord , yCord,DOT_RADIUS , dotPaint); } } and then try to call init(); in method constructor where your textVies is there.... public class CalendarCellView extends TextView { private final Paint dotPaint = new Paint(); private boolean isEventCell ; private int xCord, yCord ; private static final int DOT_RADIUS = 16; private static final int[] STATE_SELECTABLE = { R.attr.state_selectable }; private static final int[] STATE_CURRENT_MONTH = { R.attr.state_current_month }; private static final int[] STATE_TODAY = { R.attr.state_today }; private static final int[] STATE_RANGE_FIRST = { R.attr.state_range_first }; private static final int[] STATE_RANGE_MIDDLE = { R.attr.state_range_middle }; private static final int[] STATE_RANGE_LAST = { R.attr.state_range_last }; private boolean isSelectable = false; private boolean isCurrentMonth = false; private boolean isToday = false; private RangeState rangeState = RangeState.NONE; public CalendarCellView(Context context) { super(context); init(); } public CalendarCellView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public CalendarCellView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public void setSelectable(boolean isSelectable) { this.isSelectable = isSelectable; refreshDrawableState(); } private void init() { dotPai…

http://stackoverflow.com/q/23631228
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/36285232
type: Question
has comment: http://stackoverflow.com/comment/36285405
has comment: http://stackoverflow.com/comment/36285462
tagged with: image
has title: Using method from one class in another class?
has comment: http://stackoverflow.com/comment/36285470
has answer: http://stackoverflow.com/a/23631432
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36285442
has body: I am trying to make an Image Editor in Java and I need the image to display from a GUI. I am trying to pick the file from a JFileChooser and display that in a JPanel inside a JFrame. I am having trouble getting the file from the JFileChooser and also getting the image to display. I really need help with these two things. Here is my main class(ImagePanel): import java.awt.Dimension; import javax.swing.ImageIcon; import java.awt.Graphics; import javax.swing.JFrame; import java.awt.Color; import javax.swing.JPanel; import java.awt.BorderLayout; public class ImagePanel extends JFrame { public ImagePanel( String name) { String nme= name; FileChooserDemo a = new FileChooserDemo(); ImagePanel2 img = new ImagePanel2("hockey.jpg"); add(img); add(a); System.out.println(getFile()); } public static void main (String[]args) { ImagePanel x = new ImagePanel ("Image Deluxe"); x.setBounds(100, 100, 300, 200); x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); x.setVisible(true); } } Here is my second class(ImagePanel2): import java.awt.Dimension; import javax.swing.ImageIcon; import java.awt.Graphics; import javax.swing.JFrame; import java.awt.Color; import javax.swing.JPanel; import java.util.Scanner; public class ImagePanel2 extends JPanel { private ImageIcon image; public ImagePanel2(String imageFileName) { image = new ImageIcon(imageFileName); } public void paintComponent(Graphics g) { int x = 5, y = 10; if (image != null) image.paintIcon(this, g, x, y); else System.out.println("Image File not found"); } public static void main(String[] argv) { // Scanner keyboard = new Scanner(System.in); // System.out.print("Enter the name of the File: "); // String fileName=keyboard.next(); JPanel canvas2 = new ImagePanel2("hockey.jpg"); JFrame window= new JFrame("Images"); window.setBounds(100, 100, 300, 200); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvas2.setBackground(Color.WHITE); window.getContentPane().add(canvas2); window.setVisible(true); } } And here is the class for t…
favorite count: 0
has comment: http://stackoverflow.com/comment/36285429
has comment: http://stackoverflow.com/comment/36285365
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36285373
has comment: http://stackoverflow.com/comment/36285297
score: 0

http://stackoverflow.com/comment/36274706
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23625594
has text: It's not a solution. In the comments he stated that the remote system where he wants to send the serialized data to only accepts a String. Encoding the data in base64 would require the remote system (which he has no access to) to decode the base64 data. Since he can't do that he has to write the raw data.
score: 1

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/23684189
tags question: http://stackoverflow.com/q/23641113

http://stackoverflow.com/q/23762702
has title: How to know if a page is protected in tomcat
has comment: http://stackoverflow.com/comment/36552003
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/36551789
favorite count: 0
has comment: http://stackoverflow.com/comment/36544513
score: 2
accepted answer: http://stackoverflow.com/a/23769676
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36538388
tagged with: tomcat7
type: Question
has answer: http://stackoverflow.com/a/23769676
has body: Ok. I tried searching on the web but I couldn't get what I want. Suppose there is a jsp that based on the authorization method (BASIC, Form, none etc..) it needs to do something: switch (....) { case BASIC: .... case Form: .... case none: .... } So how can I get that information? thanks
tagged with: java
has comment: http://stackoverflow.com/comment/36545356

http://stackoverflow.com/comment/36294079
has text: @ZlatinZlatev Yes, you can do that, too, by changing the cost function. For example, you can penalize a mismatch with a "noise" character with a smaller cost than a mismatch with a "real" character by assigning a larger (say, 5) value to `cost` when the input has a regular character, and `1` for a mismatch with a "noise character".
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23635351

http://stackoverflow.com/comment/36347739
type: QuestionComment
comment on: http://stackoverflow.com/q/23662533
has text: What you are asking is fundamentally not possible. You can choose to right a query and execute. using hibernate session. :)
score: 0
type: Comment

http://stackoverflow.com/a/23620684
downvote count: 0
has body: It will be 40x40. http://developer.android.com/reference/android/graphics/Rect.html#Rect(int, int, int, int) public Rect (int left, int top, int right, int bottom) Added in API level 1 Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller must ensure that left &lt;= right and top &lt;= bottom. Parameters left The X coordinate of the left side of the rectangle top The Y coordinate of the top of the rectangle right The X coordinate of the right side of the rectangle bottom The Y coordinate of the bottom of the rectangle The last 2 parameters indicate right and bottom, so therefore if you start at 0 and go to 39 that's 40 pixels.
has comment: http://stackoverflow.com/comment/36266497
type: Answer
has comment: http://stackoverflow.com/comment/36267152
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23620653
accepted answer of: http://stackoverflow.com/q/23620653
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36296088

http://stackoverflow.com/q/23677931
answer count: 1
tagged with: http://stackoverflow.com/tag/c
score: 0
has title: Call java code in NDK not working
tagged with: android
type: UnansweredQuestion
tagged with: c++
has answer: http://stackoverflow.com/a/23680264
tagged with: java
has body: I need call java method. Projekt.cpp: jclass cls = env-&gt;GetObjectClass(obj); jmethodID mid = env-&gt;GetMethodID(cls, "Vypocet", "(III)I"); int vysledek = env-&gt;CallIntMethod(cls, mid, nahodne_cislo, d, n); Main.java public Integer Vypocet(int a, int b, int c) { ...........other code...... ........................... return vysl; } I don't know what now? :( LogCat write error: Fatal signal 11 (SIGSEGV) at 0xdeadd00d.
tagged with: android-ndk
type: Question

http://stackoverflow.com/q/23720738
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/36457790
linked to: http://stackoverflow.com/q/10989578
type: Question
tagged with: tostring
has title: implicit toString() call in sysout - unexpected behavior
tagged with: java
duplicate of: http://stackoverflow.com/q/10989578
tagged with: arrays
has comment: http://stackoverflow.com/comment/36457853
has body: My Program: import java.util.Arrays; public class HelloWorld{ public static void main(String []args){ char[] inputArr = "This will print as a sentence".toCharArray(); System.out.println(inputArr); System.out.println("call --" + inputArr); } } Ran here online Output: This will print as a sentence call [C@138532dc Issue : Why different behavior...I was thinking that toString() gets called in both instances
answer count: 0

http://stackoverflow.com/q/23743449
score: 0
tagged with: rotation
answer count: 1
tagged with: graphics2d
has title: Rotate text in landscape mode
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23762925
type: Question
has comment: http://stackoverflow.com/comment/36507684
has comment: http://stackoverflow.com/comment/36503164
tagged with: java
has body: I'm trying to print a rotated number "999" in the upper left corner of a report that is set to landscape. The characters should be placed about 1/2" in and 1" down from the top but nothing is printing so far. Here's my code: haX = 30; haY = 100; AffineTransform at = g2d.getTransform(); g2d.translate(haX + haY, 0); g2d.rotate(-Math.PI/2); Font rotatedFont = new Font(font.getFontName(), font.getStyle(), fs ); rotatedFont = rotatedFont.deriveFont(at); g2d.setFont(rotatedFont); g2d.drawString("999", haX, haY); g2d.setTransform(at); Any ideas would really be appreciated. Thanks Elliot

http://stackoverflow.com/a/23758657
has comment: http://stackoverflow.com/comment/36558901
has comment: http://stackoverflow.com/comment/36531195
has comment: http://stackoverflow.com/comment/36530726
answers question: http://stackoverflow.com/q/23758486
has comment: http://stackoverflow.com/comment/36529993
has comment: http://stackoverflow.com/comment/36530800
score: 0
has body: You can do it easily by using Java collection (Set). Set&lt;Character&gt; result = new HashSet&lt;Character&gt;(); String letters = ("aabbcdefff"); for (int i = 0; i &lt; letters.length(); i++){ result.add(letters.charAt(i)); } Your final result is in result set and it is always unique. Reference: http://docs.oracle.com/javase/7/docs/api/java/util/Set.html Thanks.
type: Answer
has comment: http://stackoverflow.com/comment/36529933
has comment: http://stackoverflow.com/comment/36530885
has comment: http://stackoverflow.com/comment/36530174

http://stackoverflow.com/comment/36562173
type: QuestionComment
has text: Why five threads? Why not have one thread do the insertions and the other five "push" values to it?
score: 2
comment on: http://stackoverflow.com/q/23775370
type: Comment

http://stackoverflow.com/q/23769803
score: 13
has answer: http://stackoverflow.com/a/23926383
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Android Fatal Signal 7 (SIGBUS)
has comment: http://stackoverflow.com/comment/36820183
type: Question
has comment: http://stackoverflow.com/comment/36849110
has answer: http://stackoverflow.com/a/23917171
accepted answer: http://stackoverflow.com/a/23917171
tagged with: sigbus
upvote count: 13
tagged with: segmentation-fault
linked to: http://stackoverflow.com/q/13077791
has body: I'm getting a few SIGBUS (7) and SIGSEGV (11) crashes that I am having difficult tracking down. The thread that appears to be causing the crash is primarily used for loading images to be displayed which makes sense since the logs indicate something failing with the SkJPEGImageDecoder. I re-use memory for Bitmaps in accordance with this guide Could it have something to do with that? LogCat output: 05-20 13:46:09.775: A/libc(419): Fatal signal 7 (SIGBUS) at 0x0000001e (code=1), thread 520 (ImageLoaderExec) 05-20 13:46:09.875: I/DEBUG(172): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-20 13:46:09.875: I/DEBUG(172): Build fingerprint: 'google/occam/mako:4.4.2/KOT49H/937116:user/release-keys' 05-20 13:46:09.875: I/DEBUG(172): Revision: '11' 05-20 13:46:09.875: I/DEBUG(172): pid: 419, tid: 520, name: ImageLoaderExec &gt;&gt;&gt; com.package.name &lt;&lt;&lt; 05-20 13:46:09.875: I/DEBUG(172): signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0000001e 05-20 13:46:09.975: I/DEBUG(172): r0 0000001e r1 00000001 r2 00000000 r3 0000001e 05-20 13:46:09.975: I/DEBUG(172): r4 78d38758 r5 00000000 r6 78be9b28 r7 00000000 05-20 13:46:09.975: I/DEBUG(172): r8 78d38758 r9 00000001 sl 790818d4 fp 00000001 05-20 13:46:09.975: I/DEBUG(172): ip 401ab8b0 sp 79080fe8 lr 40179e49 pc 4002e558 cpsr 000b0010 05-20 13:46:09.975: I/DEBUG(172): d0 0000001100000016 d1 000000060000000c 05-20 13:46:09.975: I/DEBUG(172): d2 0000000a0000000a d3 0000000a0000000a 05-20 13:46:09.975: I/DEBUG(172): d4 000d000e000f000b d5 000300060009000b 05-20 13:46:09.975: I/DEBUG(172): d6 000a000a000a000a d7 000a000a000a000a 05-20 13:46:09.975: I/DEBUG(172): d8 3f8000003f800000 d9 bf50624dd2f1a9fc 05-20 13:46:09.975: I/DEBUG(172): d10 3ff8151824c07946 d11 3fd34413509f79fe 05-20 13:46:09.975: I/DEBUG(172): d12 3ddb7cdfd9d7bdbb d13 0000000000000000 05-20 13:46:09.975: I/DEBUG(172): d14 0000000000000000 d15 0000000000000000 05-20 13:46:09.975: I/DEBUG(172): d16 0000000000000000 d17 000004df0000098e 05-…
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/23926383
favorite count: 0
has comment: http://stackoverflow.com/comment/36830991

http://stackoverflow.com/a/23700646
accepted answer of: http://stackoverflow.com/q/23700060
has body: The likely cause (guessing) views belong to Fragment Layout. So should initialize views in fragment onCreateView as below. The other thing i notice is you do counter++ on both button click. It should probably be count-- on sub button click @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); counter=0; add=(Button) rootView.findViewById(R.id.Add); sub=(Button) rootView.findViewById(R.id.Sub); disp=(TextView) rootView.findViewById(R.id.Display); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; disp.setText("counter is "+counter); } }); sub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; disp.setText("counter is "+counter); } }); return rootView; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36454931
downvote count: 0
answers question: http://stackoverflow.com/q/23700060
has comment: http://stackoverflow.com/comment/36421628
has comment: http://stackoverflow.com/comment/36455389
type: Answer
has comment: http://stackoverflow.com/comment/36421597
score: 2
has comment: http://stackoverflow.com/comment/36421190
upvote count: 2
has comment: http://stackoverflow.com/comment/36421619
has comment: http://stackoverflow.com/comment/36421702
has comment: http://stackoverflow.com/comment/36421160

http://stackoverflow.com/a/24867156
downvote count: 0
type: Answer
score: 1
has body: I got the same error message. With eclipse and maven tests are all successful. With gradle the same error. As Pablo said, the error came from some corrupt file names within the jar. In my case there were filenames with umlauts (ä, ö, ü) which lead to wrong filenames. I replaced the umlauts (ä => ae, ö => oe, ü => ue) in the filenames and the mentioned error disappeared.
answers question: http://stackoverflow.com/q/23678908
upvote count: 1

http://stackoverflow.com/comment/36442627
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23712870
has text: What's `n`? Of course your program doesn't compile if you use a variable without defining it anywhere

http://stackoverflow.com/a/23741461
type: Answer
has comment: http://stackoverflow.com/comment/36499118
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23740521
accepted answer of: http://stackoverflow.com/q/23740521
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36500050
has body: If it's data the user does not need direct access to, such as stored application/game state data, then it's appropriate to store it in the user's application data directory. Try this: 1) Determine the OS. 2) Get the user home directory. System.getProperty("user.home"); 3) Append OS-specific application directory: Mac: /Library/Application Support/MyApp Windows: \\Application Data\\MyApp Linux: MyApp (there's no convention here that I know of) If the data needs to be exported, such as saving a document from your application, then ask the user where to store the file via a file dialog, defaulting to their Documents directory.

http://stackoverflow.com/comment/36379877
score: 0
has text: Yeah, but LogCat is asynchronous. The timestamp may not be corresponding to the actual event date. So my suggestion to use `System.currentTimeMillis()` in the log message (as the call to Log, on its side, is synchronous of course).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23678518

http://stackoverflow.com/q/23628217
tagged with: jdbc
has answer: http://stackoverflow.com/a/23628321
has title: NullPointerException at while(rs.next())
has comment: http://stackoverflow.com/comment/36279914
tagged with: java
has answer: http://stackoverflow.com/a/23628445
type: Question
has comment: http://stackoverflow.com/comment/36279676
has answer: http://stackoverflow.com/a/23628363
has comment: http://stackoverflow.com/comment/36279677
score: 0
answer count: 3
has body: I have a simple program that executes a query agains a Sybase ASE DB using jconnect6 . the program throws a NullPointerException after iterating for 603 records of the ResultSet public ResultSet exec() { ResultSet rs = null; try { stmt= connection.createStatement(); rs = stmt.executeQuery(query); } catch (SQLException ex) { ex.printStackTrace(); } try { connection.close(); } catch (SQLException ex) { ex.printStackTrace(); } return rs; } public void Test() { ResultSet rs= exec(); if(rs!=null) { int i=0; try { while(rs!=null &amp;&amp; rs.next()) { // NullPointerException here System.out.println(i++); } } catch (Exception ex) { ex.printStackTrace(); } } } The output prints the value for 'i' till it reaches 603 while the collected records are more than 1000 and below is the error May 13, 2014 11:43:43 AM appcomponents.OutageTest Test SEVERE: null java.lang.NullPointerException at com.sybase.jdbc3.timedio.RawDbio.reallyRead(Unknown Source) at com.sybase.jdbc3.timedio.Dbio.doRead(Unknown Source) at com.sybase.jdbc3.timedio.InStreamMgr.a(Unknown Source) at com.sybase.jdbc3.timedio.InStreamMgr.doRead(Unknown Source) at com.sybase.jdbc3.tds.TdsProtocolContext.getChunk(Unknown Source) at com.sybase.jdbc3.tds.PduInputFormatter.a(Unknown Source) at com.sybase.jdbc3.tds.PduInputFormatter.read(Unknown Source) at com.sybase.jdbc3.tds.TdsInputStream.read(Unknown Source) at com.sybase.jdbc3.tds.TdsInputStream.readInt(Unknown Source) at com.sybase.jdbc3.tds.TdsDataObject.readINTN(Unknown Source) at com.sybase.jdbc3.tds.TdsInt.beginRead(Unknown Source) at com.sybase.jdbc3.tds.TdsDataObject.doRead(Unknown Source) at com.sybase.jdbc3.tds.TdsInt.getLong(Unknown Source) at com.sybase.jdbc3.tds.CachedTdsInt.&lt;init&gt;(Unknown Source) at com.sybase.jdbc3.tds.TdsInt.createCachedCopy(Unknown Source) at com.sybase.jdbc3.tds.TdsResultSet.cacheCurrentRow(Unknown Source) at com.sybase.jdbc3.tds.TdsResultSet.next(Unknown Source) at com.sybase.jdbc3.jdbc.SybResultSet.next(Unknown Source) at appc…
tagged with: jconnect
tagged with: nullpointerexception
tagged with: resultset
type: UnansweredQuestion

http://stackoverflow.com/a/23786631
has body: I found it by my myself, it is pretty simple. Just create an ArrayList, add all the Events you want to add and make an Array out of the list. It can be done like this: ArrayList&lt;WatchEvent.Kind&gt; eventList = new ArrayList&lt;&gt;(); eventList.add(StandardWatchEventKinds.ENTRY_CREATE); WatchEvent.Kind[] eventArray = eventList.toArray(new WatchEvent.Kind[eventList.size()]); key = dir.register(watcher, eventArray); It is important, that no element is null in the Array.
score: 0
accepted answer of: http://stackoverflow.com/q/23770530
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23770530
type: Answer

http://stackoverflow.com/q/23755139
type: Question
has comment: http://stackoverflow.com/comment/36567275
score: 0
answer count: 1
has body: I need to use my already running web application using JNLP, Can someone suggest if this is possible? If yes need some direction to implement this. I have searched quite a lot on google but could not convince myself. Please help. Thanks in advance.
has title: WebApplication using jnlp
tagged with: jnlp
type: UnansweredQuestion
tagged with: war
tagged with: java
tagged with: web-applications
has answer: http://stackoverflow.com/a/23778279

http://stackoverflow.com/comment/36532496
type: QuestionComment
comment on: http://stackoverflow.com/q/23760002
score: 0
has text: What kind of pattern are you hoping to match with your servlet?
type: Comment

http://stackoverflow.com/comment/36570716
type: Comment
has text: Ok. I retried doing this. And I found out that the reason it wasn't working was because the `url-pattern` I gave doesn't work. I tried setting it to `/*` and it works. Thanks! I just need to fix the `url-pattern`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23773600

http://stackoverflow.com/q/23688967
type: Question
score: 5
has answer: http://stackoverflow.com/a/27944566
has comment: http://stackoverflow.com/comment/36414601
has answer: http://stackoverflow.com/a/23690536
tagged with: functional-programming
has answer: http://stackoverflow.com/a/23696487
favorite count: 0
has body: I was playing around with Java 8. I had some trouble converting this for loop into Java 8 Stream. for (int y = 0; y &lt; 5; y ++) { for (int x = y; x &lt; 10; x += 2) { System.out.println(x+y); } } Please help!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36398662
tagged with: java-8
upvote count: 6
answer count: 4
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/23702072
has title: converting for loop to java 8 stream
downvote count: 1

http://stackoverflow.com/comment/36308723
has text: all exactly once @LajosArpad
comment on: http://stackoverflow.com/q/23642562
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36508520
comment on: http://stackoverflow.com/q/23745914
type: Comment
type: QuestionComment
score: 1
has text: See also the `SplashScreen` class as discussed [here](http://stackoverflow.com/a/5360889/418556). It is possible to gain control of the window that shows the splash and draw components on top.

mysql
tags question: http://stackoverflow.com/q/23689511
tags question: http://stackoverflow.com/q/23617942
tags question: http://stackoverflow.com/q/23750663
tags question: http://stackoverflow.com/q/23699930
tags question: http://stackoverflow.com/q/23636059
tags question: http://stackoverflow.com/q/23628840
tags question: http://stackoverflow.com/q/23650114
tags question: http://stackoverflow.com/q/23709796
tags question: http://stackoverflow.com/q/23716637
tags question: http://stackoverflow.com/q/23677741
tags question: http://stackoverflow.com/q/23679324
tags question: http://stackoverflow.com/q/23763297
tags question: http://stackoverflow.com/q/23653680
tags question: http://stackoverflow.com/q/23751954
tags question: http://stackoverflow.com/q/23653301
tags question: http://stackoverflow.com/q/23756343
tags question: http://stackoverflow.com/q/23742389
tag name: mysql
tags question: http://stackoverflow.com/q/23710983
tags question: http://stackoverflow.com/q/23771411
tags question: http://stackoverflow.com/q/23742014
tags question: http://stackoverflow.com/q/23735181
tags question: http://stackoverflow.com/q/23771129
tags question: http://stackoverflow.com/q/23658045
tags question: http://stackoverflow.com/q/23622239
tags question: http://stackoverflow.com/q/23645088
tags question: http://stackoverflow.com/q/23622183
tags question: http://stackoverflow.com/q/23743827
tags question: http://stackoverflow.com/q/23728359
tags question: http://stackoverflow.com/q/23676623
tags question: http://stackoverflow.com/q/23672827
tags question: http://stackoverflow.com/q/23708563
tags question: http://stackoverflow.com/q/23626304
tags question: http://stackoverflow.com/q/23745798
tags question: http://stackoverflow.com/q/23632939
tags question: http://stackoverflow.com/q/23691544
tags question: http://stackoverflow.com/q/23732409
tags question: http://stackoverflow.com/q/23716084
tags question: http://stackoverflow.com/q/23732216
tags question: http://stackoverflow.com/q/23698151
tags question: http://stackoverflow.com/q/23766959
tags question: http://stackoverflow.com/q/23651074
tags question: http://stackoverflow.com/q/23673675
tags question: http://stackoverflow.com/q/23756693
tags question: http://stackoverflow.com/q/23731171
tags question: http://stackoverflow.com/q/23700000
tags question: http://stackoverflow.com/q/23623734
tags question: http://stackoverflow.com/q/23625439
tags question: http://stackoverflow.com/q/23619016
tags question: http://stackoverflow.com/q/23725929
tags question: http://stackoverflow.com/q/23622274
tags question: http://stackoverflow.com/q/23758826
tags question: http://stackoverflow.com/q/23615996
tags question: http://stackoverflow.com/q/23720103
tags question: http://stackoverflow.com/q/23762015
tags question: http://stackoverflow.com/q/23750292
tags question: http://stackoverflow.com/q/23651659
tags question: http://stackoverflow.com/q/23623151
tags question: http://stackoverflow.com/q/23763952
tags question: http://stackoverflow.com/q/23671049
tags question: http://stackoverflow.com/q/23646837
tags question: http://stackoverflow.com/q/23701420
tags question: http://stackoverflow.com/q/23655338
tags question: http://stackoverflow.com/q/23651649
tags question: http://stackoverflow.com/q/23664111
type: Tag
tags question: http://stackoverflow.com/q/23688213
tags question: http://stackoverflow.com/q/23618147
tags question: http://stackoverflow.com/q/23716183
tags question: http://stackoverflow.com/q/23732759
tags question: http://stackoverflow.com/q/23704988
tags question: http://stackoverflow.com/q/23724960
tags question: http://stackoverflow.com/q/23709832
tags question: http://stackoverflow.com/q/23770324
tags question: http://stackoverflow.com/q/23629947
tags question: http://stackoverflow.com/q/23748233
tags question: http://stackoverflow.com/q/23700297
tags question: http://stackoverflow.com/q/23620485
tags question: http://stackoverflow.com/q/23754456
tags question: http://stackoverflow.com/q/23635272

http://stackoverflow.com/a/23682216
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36404845
has body: The parameter is used by the TokenHelper. There no extension points are given for this bean. You can provide your own implementation by extending token interceptors and overriding their methods only and replace references of token helper inside them. You should check this links: Interceptors Introducing Interceptors Writing Interceptors
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23680430
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23680430

http://stackoverflow.com/comment/36386905
score: 0
has text: IMHO Order is based on completion of the Job. In previous code you are checking in order thats why you are seeing the results in order, but in new one you are getting call back as soon as your job done.
type: Comment
comment on: http://stackoverflow.com/q/23681822
type: QuestionComment

http://stackoverflow.com/comment/36353636
has text: Sorry, just checked and it was littered with errors... Just updated and it works perfectly.
comment on: http://stackoverflow.com/a/23655368
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36487517
type: Comment
comment on: http://stackoverflow.com/a/23735766
has text: I'm sorry, I don't have enough reputation points to up vote but I'm gonna come back to the question once I'm eligible.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36542103
type: QuestionComment
comment on: http://stackoverflow.com/q/23698562
has text: I dunno. But this is a Spring exception complaining about a Spring configuration that is evidently not correct. Why didn't you add the "Spring" tag to this question?
score: 0
type: Comment

http://stackoverflow.com/comment/36404459
comment on: http://stackoverflow.com/q/23692216
has text: Can you post your code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36467688
type: Comment
has text: Btw, you do not need to create an img object. Just append the canvas for output.
comment on: http://stackoverflow.com/q/23724856
score: 0
type: QuestionComment

http://stackoverflow.com/q/23743860
tagged with: java
score: 0
has body: I try to run a Java program which utilize jni to call GPU program in Hadoop 2.3.0, but I got the following error: java.lang.Exception: java.lang.UnsatisfiedLinkError: affy.qualityControl.PLM.wlsAcc([D[D[DII)V at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:529) Caused by: java.lang.UnsatisfiedLinkError: affy.qualityControl.PLM.wlsAcc([D[D[DII)V at affy.qualityControl.PLM.wlsAcc(Native Method) at affy.qualityControl.PLM.rlm_fit_anova(PLM.java:141) at affy.qualityControl.PLM.PLMsummarize(PLM.java:31) at affy.qualityControl.SummarizePLMReducer.reduce(SummarizePLMReducer.java:59) at affy.qualityControl.SummarizePLMReducer.reduce(SummarizePLMReducer.java:12) at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:171) at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:627) at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389) at org.apache.hadoop.mapred.LocalJobRunner$Job$ReduceTaskRunnable.run(LocalJobRunner.java:319) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) I guess the error is caused on JNI. I write a small test Java code to call my GPU code (wlsAcc) via JNI, it works fine. I also ldd my GPU shared library, every libraries are linked. I also add the following code in my MapReduce code (my GPU code is called in Reducer): setInputParameters(conf, args); DistributedCache.createSymlink(conf); DistributedCache.addCacheFile(new URI("/user/sniu/libjniWrapper.so#libjniWrapper.so"), conf); conf.set("mapred.reduce.child.java.opts", "-Djava.library.path=."); also I copy libjniWrapper.so to the HDFS at /user/sniu/ dir. I still not figure why hadoop cannot…
type: Question
tagged with: hadoop
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/23817249
tagged with: gpu
answer count: 1
has title: Error for Hadoop running java with JNI
accepted answer: http://stackoverflow.com/a/23817249
type: AnsweredQuestion

http://stackoverflow.com/comment/36543026
score: 0
comment on: http://stackoverflow.com/a/23690047
type: Comment
has text: config? that only thing I ever did was add the dependency to my pom.xml. Can you update with what you mean by config and also what version of Maven 2 or 3?
type: AnswerComment

http://stackoverflow.com/comment/36557934
comment on: http://stackoverflow.com/q/23772676
type: QuestionComment
has text: Maybe [this](http://www.jetbrains.com/idea/webhelp/inline.html)?
type: Comment
score: 2

http://stackoverflow.com/comment/36315792
score: 0
comment on: http://stackoverflow.com/q/23645088
has text: After see comments, I tried add synchronized to my method, but I don't see anything changes. I think in this case, when make 100 requests to this method, just only one do update, 99 another ones don't do it. But when I try to do it with Jmeter, some of them do update (more than 1) and another ones do not.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23739436
has body: I'm assuming you are using a TCP/IP connection: TCP is a connection oriented protocol: any time a message packet is sent the receiver must respond with an acknowledgement (this protocol is under the application layer, so if no error is thrown you can assume the message was received). There is no way to know if a message will be received before sending it, but you can assume that if the connection is alive it will work.
upvote count: 1
has comment: http://stackoverflow.com/comment/36495984
type: Answer
answers question: http://stackoverflow.com/q/23739088
has comment: http://stackoverflow.com/comment/36493746
has comment: http://stackoverflow.com/comment/36493823
has comment: http://stackoverflow.com/comment/36494513
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36494723

http://stackoverflow.com/comment/36639481
type: QuestionComment
has text: I do not think I can help you. I would suggest creating a reproducible scenario, and opening a new question (and close this one).
comment on: http://stackoverflow.com/q/23708916
score: 0
type: Comment

http://stackoverflow.com/q/23761115
has body: I want to change the row color of the tableviewer depends on certain conditions. I have used the following code snippet. tableViewer.setLabelProvider(new ColumnLabelProvider(){ @Override public Color getForeground(Object element){ super.clearListeners(); if((((MyClass)element).getMyMethodValue()).equals("ABC")) return Display.getDefault().getSystemColor(SWT.COLOR_GRAY); else return null; } }); The color of the row is changing but the text each cell is changed to the object name of model class "MYClass" like com.sample.JfaceProject.model.MyClass@394083 . I am cofused why the text is changed in every cell of the table. Am I doing it correctly? Can anyone suggest me some ideas. Thanks in Advance
has answer: http://stackoverflow.com/a/23761257
answer count: 1
downvote count: 0
favorite count: 0
tagged with: e4
upvote count: 1
tagged with: jface
accepted answer: http://stackoverflow.com/a/23761257
has title: Error in changing background color of row in JFace tableviewer
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: tableviewer

http://stackoverflow.com/a/23625515
type: Answer
has body: Please change your class name and run it will work fine,as your class-name and List name are same you are getting that error.
score: 0
answers question: http://stackoverflow.com/q/23621997

http://stackoverflow.com/comment/36421628
type: Comment
comment on: http://stackoverflow.com/a/23700646
has text: I am extremely sorry being New to android just learning from random sites i am not able to grasp things quickly.. sorry
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36542692
score: 0
has text: please see http://stackoverflow.com/help/how-to-ask. the first thing folks may want to know is the different sizes tested and how the speed differed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23764826

http://stackoverflow.com/comment/36339816
comment on: http://stackoverflow.com/a/23658603
score: 0
type: AnswerComment
type: Comment
has text: Again, that's just an opinion. The page you posted also contains an argument **for** the way it currently works. I believe that the entire point of the OP's homework was to work all of this out on his own, which is why I didn't provide code.

http://stackoverflow.com/a/23688661
has comment: http://stackoverflow.com/comment/36397542
score: 4
answers question: http://stackoverflow.com/q/23683187
accepted answer of: http://stackoverflow.com/q/23683187
upvote count: 4
has comment: http://stackoverflow.com/comment/36402094
has body: You have to flip() the buffer to get data out of it. NB you should be using limit(), not capacity(), in that line.
has comment: http://stackoverflow.com/comment/36398705
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36432636
type: QuestionComment
comment on: http://stackoverflow.com/q/23707468
has text: I am actually developing liferay portlets and i am also using delegate servlet which is HttpServlet. There is function to limit scope of session variable in PortletSession but i don't find such methods to limit session variable in HttpSession.I am curious.
score: 0
type: Comment

http://stackoverflow.com/comment/36478483
type: QuestionComment
has text: Tx to commenters, may I ask them what params they'd generally advise on glassfish and the jvm for my 64-bit, 24RAM system?
comment on: http://stackoverflow.com/q/23728518
score: 0
type: Comment

http://stackoverflow.com/q/23628914
has answer: http://stackoverflow.com/a/23629229
type: UnansweredQuestion
tagged with: embedded-resource
has comment: http://stackoverflow.com/comment/36281614
has answer: http://stackoverflow.com/a/23629120
downvote count: 0
has comment: http://stackoverflow.com/comment/36281033
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36281065
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36281162
tagged with: image
has body: first i'd like to say that yes, i searched, i searched real hard and unfortunatelly, i did not find any answer good enough for me, i think i know what to do, but i don't know how to do it ! Well, i put a lot of images in my program, and it worked out great, when i run on my computer the images appear and there's no problem, but i can't make the images to appear in other pc's ! Everytime i put the .jar in another machine, the images disappear... Well, i think i have to create a package with the images folder right ? But i don't know how to do it, or what to do after that ! If someone could give me a fully example, that would be awesome... Here's my code, please let me know if can improve the question, i'm just new here ! import java.awt.*; import java.awt.event.*; import javax.swing.*; public class IMC extends JFrame { private static final long serialVersionUID = 1L; private JButton ok; private JButton sair; private JTextField txt1; private JTextField txt2; private Dimension dim,dim2,dim3; private JLabel l1,l2,l3,l4; private Font letra; private float tamanho; private float peso; private float imc; public IMC (){ dim = new Dimension(650,500); dim2 = new Dimension (340,25); dim3 = new Dimension (75,35); setTitle("Calcule seu IMC!"); setSize(dim); setLocation(190,100); setResizable(false); setBackground(new Color(250,250,200)); Color lightGray = Color.gray.brighter(); getContentPane().setBackground(lightGray); setLayout(null); setDefaultCloseOperation(EXIT_ON_CLOSE); JMenuBar mBar = new JMenuBar(); JMenu opcoes = new JMenu("Opções"); JMenuItem sobreIMC = new JMenuItem("Sobre"); JMenuItem sobreMim = new JMenuItem("Sobre mim"); opcoes.add(sobreIMC); opcoes.add(sobreMim); JMenu fechar = new JMenu("Fechar"); JMenuItem fecharIMC = new JMenuItem("Fechar"); fechar.add(fecharIMC); mBar.add(opcoes); mBar.add(fechar); setJMenuBar(mBar); tamanho = 0; peso = 0; letra = new Font("Arial",Font.PLAIN,14); setFont(letra); l1 = new JLabel(); l1.setText("Complete os campos abaixo:"); l1.s…
has answer: http://stackoverflow.com/a/23629015
answer count: 3
upvote count: 1
has title: How to put images in .jar file?
tagged with: jar
favorite count: 0

http://stackoverflow.com/q/23684400
possible better answer: http://stackoverflow.com/a/23684502
tagged with: java
has comment: http://stackoverflow.com/comment/36389610
has comment: http://stackoverflow.com/comment/36389359
has comment: http://stackoverflow.com/comment/36389037
upvote count: 3
answer count: 3
has title: Why use this->ObjectName instead of this.ObjectName in c++
has answer: http://stackoverflow.com/a/23684461
favorite count: 0
has answer: http://stackoverflow.com/a/23684502
accepted answer: http://stackoverflow.com/a/23684472
duplicate of: http://stackoverflow.com/q/645994
tagged with: c++
has comment: http://stackoverflow.com/comment/36389194
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36389073
has comment: http://stackoverflow.com/comment/36390465
has body: Hello World, I have been wondering why in c++ we use the this->ObjectName instead of this.ObjectName when referring to an object in c++. This is a simple syntax using the this->ObjectName : int x = 34; void take(int x) { this-&gt;x = x; } But in other programming languages like java, we use : int x = 34; void take(int x) { this.x = x; } So what am asking is why does the this statement in c++ differ from the this statement in java
score: 1
downvote count: 2
linked to: http://stackoverflow.com/q/645994
has answer: http://stackoverflow.com/a/23684472
has comment: http://stackoverflow.com/comment/36389503
type: Question
has comment: http://stackoverflow.com/comment/36389448

http://stackoverflow.com/q/23650726
has comment: http://stackoverflow.com/comment/36323775
tagged with: stack-trace
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36324960
accepted answer: http://stackoverflow.com/a/23651098
tagged with: java
has answer: http://stackoverflow.com/a/23651098
has body: Is there a general way of figuring out which exception to catch when there are multiple exceptions with the same name? This has happened to me with HttpException, where there are four different ones on my build path. As far as I see it, the stack trace doesn't give away the package name. [...] Caused by: HttpException: 404 File not found at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:446) at com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:289) at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:240) at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:302) [...]
upvote count: 1
has title: Java exceptions with same name - which one is it?
answer count: 1
favorite count: 0
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/36323959
downvote count: 1

http://stackoverflow.com/q/23712286
type: Question
tagged with: java
tagged with: servlets
answer count: 1
tagged with: tomcat
score: 0
has body: I am currently learning website programming, java servlets with javascript to be precise, and I just learned how to use an AsyncContext in a single servlet. I was wondering if it would be possible for AsyncContexts to be shared between servlets, so that one user could send another user (viewing a different webpage) a message, for example. Or is it impossible and I just do not understand the concept?
tagged with: asynchronous
has title: How do I share java AsyncContext between servlets?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23734389
has comment: http://stackoverflow.com/comment/36484049

http://stackoverflow.com/comment/36392668
score: 3
comment on: http://stackoverflow.com/q/23686133
has text: Go back a few steps: what do you want to achieve? I am sure there are better ways to do it.
type: Comment
type: QuestionComment

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/23644090
tags question: http://stackoverflow.com/q/23711409

http://stackoverflow.com/q/23677447
type: Question
has comment: http://stackoverflow.com/comment/36375935
has answer: http://stackoverflow.com/a/24497509
has body: This is my jsp code.In the form tag the action attribute same .jsp page is needed. & how can i call FileUploadExample servlet from this jsp. This is the javascript i used to call servlet function unloadEvt() { document.location.href='/FileUploadExample'; } This is the servlet to call.But I am unable to call this servlet from beneficiary_sales_details.jsp.Please suggest me any other option to call servlet from jsp public class FileUploadExample extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean isMultipart = ServletFileUpload.isMultipartContent(request); response.setContentType("text/html"); PrintWriter out = response.getWriter(); System.out.println("In fileupload servlet"); if (isMultipart) { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); try { // Parse the request List /* FileItem */ items = upload.parseRequest(request); Iterator iterator = items.iterator(); while (iterator.hasNext()) { FileItem item = (FileItem) iterator.next(); if (!item.isFormField()) { String fileName = item.getName(); String root = getServletContext().getRealPath("/"); File path = new File(root + "/uploads"); if (!path.exists()) { boolean status = path.mkdirs(); } File uploadedFile = new File(path + "/" + fileName); System.out.println(uploadedFile.getAbsolutePath()); System.out.println(uploadedFile.getTotalSpace()); // bytesray = uploadedFile.length(); byte[] b = new byte[(int)uploadedFile.length()]; for (int i = 0; i < b.length; i++) { // System.out.print(b[i]); } String str = b.toString(); System.out.println(" byte array in string---"+str); out.println(" "+str+" "); if(fileName!="") item.write(uploadedFile); else out.println("file not found"); out.println(" File Uploaded Successfully....:-) "); } else { String abc = item.getString(); out.pri…
linked to: http://stackoverflow.com/q/5463818
answer count: 3
downvote count: 0
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/23677770
type: UnansweredQuestion
has title: I want to call servlet from jsp page
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23677649
upvote count: 1

amazon-ec2
tags question: http://stackoverflow.com/q/23714119
type: Tag
tags question: http://stackoverflow.com/q/23757228
tags question: http://stackoverflow.com/q/23703398
tag name: amazon-ec2
tags question: http://stackoverflow.com/q/23751954
tags question: http://stackoverflow.com/q/23637667
tags question: http://stackoverflow.com/q/23700000

http://stackoverflow.com/comment/36467183
comment on: http://stackoverflow.com/q/23725479
score: 0
type: Comment
type: QuestionComment
has text: `TreeMap` is key-value pair.

http://stackoverflow.com/q/23722659
tagged with: android
upvote count: 15
has body: I'm trying to make a Request to a WebService from an android application, using HttpUrlConnection. But sometimes it works, and sometimes it does not. When I try sending this value: JSON value {"Calle":"Calle Pérez 105","DetalleDireccion":"","HoraPartida":"May 18, 2014 9:17:10 AM","Numero":0,"PuntoPartidaLat":18.477295994621315,"PuntoPartidaLon":-69.93638522922993,"Sector":"Main Sector"} I got an "unexpected end of stream" Exception in the DataOutputStream close function. Here is my code: DataOutputStream printout; // String json; byte[] bytes; DataInputStream input; URL serverUrl = null; try { serverUrl = new URL(Config.APP_SERVER_URL + URL); } catch (MalformedURLException e) { ... } bytes = json.getBytes(); try { httpCon = (HttpURLConnection) serverUrl.openConnection(); httpCon.setDoOutput(true); httpCon.setUseCaches(false); httpCon.setFixedLengthStreamingMode(bytes.length); httpCon.setRequestProperty("Authorization", tokenType + " "+ accessToken); httpCon.setRequestMethod("POST"); httpCon.setRequestProperty("Content-Type", "application/json"); printout = new DataOutputStream(httpCon.getOutputStream()); printout.writeBytes(json); printout.flush(); printout.close(); ... }
tagged with: httpurlconnection
favorite count: 0
downvote count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23722962
tagged with: java
score: 15
tagged with: dataoutputstream
type: Question
has answer: http://stackoverflow.com/a/23722962
answer count: 2
has comment: http://stackoverflow.com/comment/36463058
has comment: http://stackoverflow.com/comment/36462984
has answer: http://stackoverflow.com/a/23723403
accepted answer: http://stackoverflow.com/a/23723403
has title: DataOutputSteam is throwing me a 'java.io.IOException: unexpected end of stream'?

http://stackoverflow.com/comment/36365112
comment on: http://stackoverflow.com/q/23671817
type: Comment
type: QuestionComment
has text: @Raghunandan nice job. The manifest and the intent don't have the same spelling for ScanResult(s). You should post it as an answer I think.
score: 0

prepared-statement
tags question: http://stackoverflow.com/q/23633776
type: Tag
tags question: http://stackoverflow.com/q/23623187
tags question: http://stackoverflow.com/q/23691715
tag name: prepared-statement

http://stackoverflow.com/comment/36397905
has text: I added it as an answer so you can accept it for others to see. Cheers!
type: Comment
comment on: http://stackoverflow.com/q/23688394
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36429168
score: 0
type: Comment
type: QuestionComment
has text: This question is a teaching book example of a duplicate... it is so common, it has a dedicated section in the Oracle tutorial. Please refer duplicates.
comment on: http://stackoverflow.com/q/23697161

http://stackoverflow.com/comment/36353507
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23665692
has text: If you don't want to open taskmanager you can call `taskkill /f /im javaw.exe` from your console. It's not a solution, but it's faster than openning task manager.

http://stackoverflow.com/comment/36476577
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23626909
has text: @pratik, no luck so far. Could you please mail me at paraseth@gmail.com. Thanks!

http://stackoverflow.com/comment/36310369
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23618522
has text: no I understand. I understand my professors example, just didn't feel like implementing all the methods; mainly because I am on a time crunch and have other assignments to do (that's what I get for putting everything off to the last minute). The coding I did was poor and I understand that, but it was a mixture of different elements that I grabbed from different powerpoints and examples and modified them.

websphere
tags question: http://stackoverflow.com/q/23680750
tags question: http://stackoverflow.com/q/23633878
tags question: http://stackoverflow.com/q/23679977
tags question: http://stackoverflow.com/q/23656786
tags question: http://stackoverflow.com/q/23656538
tag name: websphere
tags question: http://stackoverflow.com/q/23737892
type: Tag
tags question: http://stackoverflow.com/q/23699859
tags question: http://stackoverflow.com/q/23644216
tags question: http://stackoverflow.com/q/23619850

http://stackoverflow.com/q/23658956
tagged with: java-stream
tagged with: java
has body: I am trying to understand the new Java 8 Stream APIs. http://docs.oracle.com/javase/tutorial/collections/streams/reduction.html I found the example of finding average of numbers using collect API. But I felt that, the same can be done using reduce() also. public class Test { public static void main(String[] args) { // Using collect System.out.println(Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .collect(Averager::new, Averager::accept, Averager::combine) .average()); // Using reduce System.out.println(Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .reduce(new Averager(), (t, u) -&gt; { t.accept(u); return t; }, (t, u) -&gt; { t.combine(u); return t; }).average()); } private static class Averager { private int total = 0; private int count = 0; public Averager() { // System.out.println("Creating averager"); } public double average() { // System.out.println("Finding average"); return count &gt; 0 ? ((double) total) / count : 0; } public void accept(int i) { // System.out.println("Accepting " + i); total += i; count++; } public void combine(Averager other) { // System.out.println("Combining the averager : " + other); total += other.total; count += other.count; } @Override public String toString() { return "[total : " + total + ", count: " + count + "]"; } } } 1) Is there any reason, that I should use collect instead of reduce here? 2) If I enable all the debug sysouts, I can see that the operations perfomed are exactly the same between, collect and reduce. And the combiner was not being used at all, in both cases. 3) If I make the streams parallel, the collect is always returning me correct result. The reduce() is giving me different results each time. 4) Should I not use reduce, in parallel streams? Thanks, Paul
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23661052
score: 10
tagged with: functional-programming
has answer: http://stackoverflow.com/a/23661052
answer count: 1
favorite count: 0
tagged with: lambda
tagged with: java-8
upvote count: 11
has title: Finding average using reduce and collect
type: AnsweredQuestion

http://stackoverflow.com/comment/36562729
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23775503
score: 0
has text: @SotiriosDelimanolis why is it not possible? I am getting the file name in controller.

http://stackoverflow.com/a/23777483
type: Answer
has body: Tomcat scans the web application for class files (both under WEB-INF/classes and in JARs). The class files are then passed to a heavily edited, package renamed local copy of the Apache Commons Byte Code Engineering Library (BCEL). Tomcat's version of BCEL is optimised to process only those parts of the byte code Tomcat is interested in (annotations, super class if any, implemented interfaces) and to skip over the rest as fast as possible. BCEL reads the class files directly from disk. Tomcat does some careful caching of the results from BCEL so that even for the most complex of class hierarchies each class is only ever processed once and no post-processing is required to get the full list if annotations (including those inherited from super classes) for any class. The annotation scan also checks for matches to the @HandlesTypes annotation for SCIs. Scanning every class for annotations is expensive however you do it (and one of the reasons I'm not a fan of this particular feature). Tomcat's implementation went through several iterations before arriving at the efficient implementation it now uses.
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/36573434
accepted answer of: http://stackoverflow.com/q/23776644
has comment: http://stackoverflow.com/comment/36569782
answers question: http://stackoverflow.com/q/23776644
upvote count: 8
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36569097

http://stackoverflow.com/comment/36448771
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23685286
type: QuestionComment
has text: https://wiki.jenkins-ci.org/display/JENKINS/Fingerprint

http://stackoverflow.com/q/23723449
upvote count: 2
accepted answer: http://stackoverflow.com/a/23724310
tagged with: spring
has title: Spring batch integration
has body: I am looking for a guidance/solution with Spring batch integration. I have a directory to which external application will send xml files. My application should read the file content and move the file to another directory. The application should be able to process the files in parallel. Thanks in advance.
type: AnsweredQuestion
tagged with: java
type: Question
score: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23724310
tagged with: spring-batch
tagged with: polling
linked to: http://stackoverflow.com/q/19347084
has comment: http://stackoverflow.com/comment/36463412
favorite count: 0

http://stackoverflow.com/a/23793939
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36597974
answers question: http://stackoverflow.com/q/23661027
type: Answer
accepted answer of: http://stackoverflow.com/q/23661027
has body: I believe you wish to you use .setVisible(true) instead of .show() Toolbar extends Canvas as can be seen here. The two methods I just mentioned are not proper to Toolbar, rather they are methods java.awt.Canvas UPDATE Ok I see what you are doing. Really, revalidate() may be the piece you are missing to refresh the screen. Here is some code and some greater explanation: import ij.gui.Toolbar; import java.awt.Canvas; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class Test1 { public static Toolbar tool; public static JFrame f; public static boolean state = false; public static void main(String[] args) { f = new JFrame(); f.setSize(600,600); Canvas c = new Canvas(); f.add(c); tool = new Toolbar(); Graphics g = tool.getGraphics(); tool.installStartupTools(); JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("Menu"); JMenuItem toolbar = new JMenuItem("Toolbar"); menu.add(toolbar); menubar.add(menu); f.setJMenuBar(menubar); toolbar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { state = !state; tool.setVisible(state); tool.revalidate(); } }); tool.setVisible(false); f.add(tool); f.setVisible(true); } } Make sure you take your initialization code outside of your listener. That only happens once at the beginning. The action listener should be reserved for stuff that happens once per event. Like, I toggle the toolbar on and off each time the Menu item is selected. And adding the toolbar to the frame seems it is ok. It will appear at the very top (with the default layout scheme) and you can use it as you need to use it. You certainly do have other options where to display the toolbar though.
has comment: http://stackoverflow.com/comment/36598163
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36597828

http://stackoverflow.com/a/23672380
answers question: http://stackoverflow.com/q/23669385
upvote count: 1
has body: I would also note that your instance document has the root (address) element in namespace http://www.w3schools.com, while your schema defines an address element in namespace http://www.example.org/AddressSchema. You can't just sprinkle namespaces around like fairy-dust and hope they add glamour to your code; they are fundamental and you need to get them right.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/23723613
tagged with: combinations
has body: Among elements of a set, I want to list all the 3-combinations of this set. Is there a way to do it? If it was a list; for(int i=0; i&lt;list.size()-2; i++) for(int j=i+1; j&lt;list.size()-1; j++) for(int k=j+1; k&lt;list.size(); k++) System.out.println(list.get(i) + " " + list.get(j) + " " + list.get(k)); But how to do this with a set without converting it to a list?
score: 1
tagged with: java
answer count: 2
has title: Listing all the combinations of the elements of a set
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23723797
possible better answer: http://stackoverflow.com/a/23723797
type: AnsweredQuestion
tagged with: list
downvote count: 0
has answer: http://stackoverflow.com/a/23723711
accepted answer: http://stackoverflow.com/a/23723711
tagged with: set
type: Question

http://stackoverflow.com/comment/36569348
comment on: http://stackoverflow.com/q/23777807
score: 0
type: Comment
type: QuestionComment
has text: can you check your server's error.log ?

http://stackoverflow.com/comment/36444537
type: Comment
comment on: http://stackoverflow.com/a/23713822
has text: My mistake. I should have states that more clearly. Thank you anyway for your time.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23670754
linked to: http://stackoverflow.com/q/13653712
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/36363010
has answer: http://stackoverflow.com/a/23671038
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36362980
has comment: http://stackoverflow.com/comment/36362954
has body: 2014-05-14 08:41:02 Error in : org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1215) org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1148) org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1154) org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:695) sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) com.sun.proxy.$Proxy82.merge(Unknown Source) com.REP.CompanyAcce.pat.dao.BaseDAO.save(BaseDAO.java:50) sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) com.sun.proxy.$Proxy84.save(Unknown Source) com.REP.CompanyAcce.pat.service.PATThreadService.saveCandidatesData(PATThreadService.java:561) com.REP.CompanyAcce.pat.service.PATThreadService.collectCandidateData(PATThreadService.java:200) com.REP.CompanyAcce.pat.service.PATThreadService$CollectCandidateDataThread.run(PATThreadService.java:90) java.lang.Thread.run(Thread.…
tagged with: mysql
has comment: http://stackoverflow.com/comment/36362876
type: Question
has answer: http://stackoverflow.com/a/23670931
has title: Exception java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\xBC' for column 'Rins' at row 1 at
tagged with: java
has comment: http://stackoverflow.com/comment/36363038

http://stackoverflow.com/comment/36518237
score: 0
has text: I have added the structure .. help me please
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23751965

http://stackoverflow.com/comment/36275996
comment on: http://stackoverflow.com/a/23625842
type: AnswerComment
has text: according to Spring documentation if I add @Component to my class, it will be automatically picked as Aidan suggested, but I've got the same issue...
score: 0
type: Comment

http://stackoverflow.com/comment/48661423
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/30280783
has text: Yes, we dont have a load balancer, could you explain more about the implementation of your workaround?

http://stackoverflow.com/a/23734203
has comment: http://stackoverflow.com/comment/36546408
answers question: http://stackoverflow.com/q/23698049
score: 0
has body: I might have misunderstood your question, but it seems to me you are trying to access the map entries in the wrong way. To get the value of a map entry, you should use the #get method: &lt;li&gt; &lt;a href="$config.get($img_link)"&gt; &lt;img src="/assets/images/$img_src" alt="$config.get($img_alt)" /&gt; &lt;/a&gt; &lt;/li&gt; This will work provided that there is an entry in the map with the key "slide1_link", one with the key "slide1_alt", one with the key "slide2_link" etc, otherwise an empty string will be output for the not found key.
type: Answer

http://stackoverflow.com/q/23700636
type: Question
downvote count: 2
accepted answer: http://stackoverflow.com/a/23700931
tagged with: layout
score: -2
answer count: 1
has body: I need to add something to my xml layout so when the user clicks it , there is a kind of UI for contact selection (capable of selecting multiple contacts). I dont care in what type of data they are sent (I will convert them to a list). Please show me how it's done!
has title: Get contacts after picking from the UI
has answer: http://stackoverflow.com/a/23700931
tagged with: contacts
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23712752
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36495601
type: Answer
answers question: http://stackoverflow.com/q/23712645
accepted answer of: http://stackoverflow.com/q/23712645
has body: Since this question is homework for learning purposes, I will post only examples of how to implement the things you need to review and won't give a direct answer about how to apply them to your current design. Enumeration in Java is implemented by using enum. enum WeekDays { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; } Aggregation/Composition means to have a field of the other class. If it's a weak association (aggregation), it should be initialized by the setter or another method. If it's a strong association, it should be initialized in the class constructor since it is needed for the class to live/work. class WeakAssociation { } class StrongAssociation { } class NeedWeekAndStrongAssociation { private WeakAssociation weakAssociation; private StrongAssociation strongAssociation; public NeedWeekAndStrongAssociation(StrongAssociation strongAssociation) { this.strongAssociation = strongAssociation; } public void setWeakAssociation(WeakAssociation weakAssociation) { this.weakAssociation = weakAssociation; } } Usage dependency means that the class/interface will use the other class/interface within one or more of its methods: class WantToBeUsed { public void methodToBeUsed(String data) { //fancy implementation } } class CannotDoThisAlone { public void cannotDoItAlone(String data) { WantToBeUsed wantToBeUsed = new WantToBeUsed(); wantToBeUsed.methodToBeUsed(data); } }
has comment: http://stackoverflow.com/comment/36442394
score: 0
has comment: http://stackoverflow.com/comment/36442361

http://stackoverflow.com/a/23842033
answers question: http://stackoverflow.com/q/23666101
score: 1
has body: instead of : @Override public int getViewTypeCount() { return 2; } Try : @Override public int getViewTypeCount() { return getCount(); } and instead of putting ViewHolder viewHolder; in a getivew() method, try to put it in a starting of class before class constructor
has comment: http://stackoverflow.com/comment/36688490
has comment: http://stackoverflow.com/comment/43720908
type: Answer
upvote count: 2
downvote count: 1

http://stackoverflow.com/comment/36489226
has text: Thanks Priyesh. Your first reply was just what i needed.
comment on: http://stackoverflow.com/q/23736328
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23731393
type: AnsweredQuestion
tagged with: java
has title: TypeNotPresentException on javax.annotations.Nonnull
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23749151
accepted answer: http://stackoverflow.com/a/23749151
possible better answer: http://stackoverflow.com/a/30298869
favorite count: 0
has answer: http://stackoverflow.com/a/30298869
score: 2
upvote count: 2
tagged with: annotations
tagged with: maven
has body: I have added maven surefire plugin (2.17) to our project, but the build fails with the following error. Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin java.lang.TypeNotPresentException: Type javax.annotation.Nonnull not present at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:39) at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(AnnotationHelper.java:51) at com.ibm.oti.reflect.Method.getDeclaredAnnotations(Method.java:35) at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:719) at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:187) at com.ibm.oti.reflect.Method.getAnnotation(Method.java:21) at java.lang.reflect.Method.getAnnotation(Method.java:693) at com.google.inject.spi.InjectionPoint.getAtInject(InjectionPoint.java:478) at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:676) at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366) at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165) at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:609) at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:565) at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:551) at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:865) at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:790) at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:278) at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:210) at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:986) at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1019) at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:982) at com.google.inject.internal.In…

http://stackoverflow.com/a/23774910
type: AcceptedAnswer
downvote count: 0
has body: Well, you'll have to use the negated form of contains, and myMap is not bound. $eleList : List() $eleDetail : ElementDetail( $name: name ) from $eleList $map: Map( keySet not contains $name )
type: Answer
accepted answer of: http://stackoverflow.com/q/23771900
answers question: http://stackoverflow.com/q/23771900
score: 4
upvote count: 4

http://stackoverflow.com/q/23627077
has comment: http://stackoverflow.com/comment/36277578
has answer: http://stackoverflow.com/a/23627165
has comment: http://stackoverflow.com/comment/36277577
type: Question
has answer: http://stackoverflow.com/a/23627473
downvote count: 0
favorite count: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23627335
has body: I have the following code in a method ( Utils.currentPrinters is a static JsonObject ): JsonObject printers = Utils.currentPrinters; for (Map.Entry&lt;String, ?&gt; entry : Utils.currentPrinters.entrySet()) { String key = entry.getKey(); JsonObject printer = (JsonObject) entry.getValue(); if (...) { printers.remove(key); } } Utils.currentPrinters = printers; There are two threads that actually call this method. If it's only one, there are no problems at all. But after running few seconds with two threads, it crashes with the following Exception: 05-13 12:01:43.168 5739-5739/com.wasp.pos.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.util.ConcurrentModificationException at com.google.gson.internal.LinkedTreeMap$LinkedTreeMapIterator.nextNode(LinkedTreeMap.java:541) at com.google.gson.internal.LinkedTreeMap$EntrySet$1.next(LinkedTreeMap.java:565) at com.google.gson.internal.LinkedTreeMap$EntrySet$1.next(LinkedTreeMap.java:563) at com.wasp.pos.app.server.PrintersFinder.clearPrinters(PrintersFinder.java:184) at com.wasp.pos.app.server.PrintersFinder.access$000(PrintersFinder.java:30) at com.wasp.pos.app.server.PrintersFinder$1UpdateListThread.run(PrintersFinder.java:124) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:4987) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method) I could not really find anything that fixes this, ConcurrentMap or synchronized (printers) did not fixed it. Please, help.
tagged with: multithreading
upvote count: 1
has title: java.util.ConcurrentModificationException when trying to update global variable
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23627165
accepted answer: http://stackoverflow.com/a/23627335

http://stackoverflow.com/a/23700879
answers question: http://stackoverflow.com/q/23700475
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23700475
type: Answer
has body: It's possible that your app cannot send an SMS because of changes in Android 4.4. Outlined at https://developer.android.com/about/versions/android-4.4.html#SMS you can see the changes. SMS Provider The Telephony content provider (the "SMS Provider") allows apps to read and write SMS and MMS messages on the device. It includes tables for SMS and MMS messages received, drafted, sent, pending, and more. Beginning with Android 4.4, the system settings allow users to select a "default SMS app." Once selected, only the default SMS app is able to write to the SMS Provider and only the default SMS app receives the SMS_DELIVER_ACTION broadcast when the user receives an SMS or the WAP_PUSH_DELIVER_ACTION broadcast when the user receives an MMS. The default SMS app is responsible for writing details to the SMS Provider when it receives or sends a new message. Other apps that are not selected as the default SMS app can only read the SMS Provider, but may also be notified when a new SMS arrives by listening for the SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This broadcast is intended for apps that---while not selected as the default SMS app---need to read special incoming messages such as to perform phone number verification. For more information, read the blog post, Getting Your SMS Apps Ready for KitKat.
upvote count: 1

http://stackoverflow.com/q/23720563
favorite count: 0
has body: I am sort of a noob at this but have attempted to create my own mario game. It's going well but I need a variable called distanceTraveled to be determined It isn't reliable at all, when I hold the arrow key numbers go faster than if I was to tap them. Here are my codes(Everything is commented on the right): . frame.java package EvilMario; //Include this class in the EvilMario game package import javax.swing.JFrame; //Import the JFrame public class frame { //Run this class to run the game public static void main(String[] args) { //The first method called by java JFrame frame = new JFrame("EvilMario v.1.0.0 by Max Mastalerz"); //Create JFrame called frame frame.getContentPane().add(new board()); //Go to board class frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Make frame close on X click frame.setSize(600,413); //Set the frame size to the size of the background frame.setVisible(true); //Make the frame visible frame.setResizable(false); //Make sure the user can't resize the frame } } player.java package EvilMario; //Include this class in the EvilMario game package import java.awt.Image; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; public class player { int x, dx, y, nx, nx2, distanceTraveled; //x coordinate,change in x coordinate,y coordinate,1st rep bg,2nd rep bg,dist traveled Image player; //The player variable ImageIcon playerFacingLeft = new ImageIcon("D:/ICS3U1/EvilMario/images/MarioLeft.png"); //Image for player while he is turning left ImageIcon playerFacingRight = new ImageIcon("D:/ICS3U1/EvilMario/images/MarioRight.png");//Image for player while he is turning right public player() { player = playerFacingRight.getImage(); //Give the player the image x = 75; //The original x position of the player y = 265; //The original y position of the player nx = -0; //Repeating background 1 nx2 = -575; //Repeating background 2 distanceTraveled = 0; } public void move() { if(x&gt;0 &amp;&amp; x&lt;300) { //If the player is within the moving area x …
has answer: http://stackoverflow.com/a/23720789
accepted answer: http://stackoverflow.com/a/23720789
tagged with: lag
score: 1
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: event-listener
has title: How to fix java keyPressed Lag/Late events
tagged with: keypress
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/46015131
comment on: http://stackoverflow.com/a/23644173
score: 0
type: AnswerComment
type: Comment
has text: @PaulTaylor The peer has closed the connection and the local application has not. It hasn't detected end of stream on the connection correctly, or hasn't reacted to it correctly, or it is stuck doing something else.

http://stackoverflow.com/comment/36598587
comment on: http://stackoverflow.com/a/23634585
type: AnswerComment
type: Comment
score: 1
has text: Thanks for the top on my nearestEnemyX & nearestEnemyY by adding the 16 to make the numbers positive. This helped me as well, just as the accepted answer. Unfortunately I can only accept one.

http://stackoverflow.com/comment/36402469
score: 0
type: AnswerComment
type: Comment
has text: Yes, I'd agree with you about that phrasing implying `head==null` indicates an empty list, but it could also be that the phrasing is wrong.
comment on: http://stackoverflow.com/a/23691017

http://stackoverflow.com/comment/36279812
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23628302
has text: The `14` is a `yy` i.e. 2 digit year.
score: 0

http://stackoverflow.com/comment/36427653
comment on: http://stackoverflow.com/a/23704027
has text: I updated the code, it prints as 1 121 32123. i guess the problem is in the limits, how can I change?
type: Comment
score: 0
type: AnswerComment

mocking
tags question: http://stackoverflow.com/q/23759690
tags question: http://stackoverflow.com/q/23624355
tags question: http://stackoverflow.com/q/23720341
tags question: http://stackoverflow.com/q/23653583
tag name: mocking
tags question: http://stackoverflow.com/q/23648108
type: Tag
tags question: http://stackoverflow.com/q/23655705

http://stackoverflow.com/q/23729821
has answer: http://stackoverflow.com/a/23730003
downvote count: 0
possible better answer: http://stackoverflow.com/a/23730003
favorite count: 0
has title: Can't understand the definition of a Java statement
has comment: http://stackoverflow.com/comment/36476099
has body: I think I understand this part: "Some statements contain other statements as part of their structure; such other statements are substatements of the statement." Source: (second paragraph) http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html Please correct me if I'm wrong: This refers to method calls, which contain multiple statements within. This also refers to actions such as performing some kind of operation like calculating or concatting a String while initializing. What I'm having troubles understand is this: "We say that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U" I'm not gonna lie, they totally lost me here. I can't imagine this in my head, or write it out on paper. The wording has me totally confused. Can someone please explain this is an easier to understand fashion?
tagged with: jls
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23730500
has comment: http://stackoverflow.com/comment/36476058
upvote count: 1
has comment: http://stackoverflow.com/comment/36476075
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23730500

http://stackoverflow.com/a/23616175
has body: Simply In SecondCourse.java public class SecondCourse { Course obj = new Course(); // creates new obj for Course class @Before public void setUp() throws Exception { //courseName = new Course(); //You won't need this. system.out.println("Here is how your obj can be called "+ obj.courseName); }
answers question: http://stackoverflow.com/q/23615781
score: 0
type: Answer

http://stackoverflow.com/a/23739272
has body: You need use VMWare tools installed on your guests and run commands inside the guest. This article illustrates how to do so using vijava: http://www.doublecloud.org/2012/02/run-program-in-guest-operating-system-on-vmware/ If you use windows I recommend PowerCLI + Invoke-VmScript cmdlet(https://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Invoke-VMScript.html) It will allow you to run a powershell command (for a windows boxes) to determine partition layout. The following lines will return $True if GPT partition is detected. $disks = gwmi -query "Select * from Win32_DiskPartition" foreach($disk in $disks) { if ($disk.Type.StartsWith("GPT")){ return $true } } Similarly, on a linux guests something like this will achieve desired effect: fdisk -l | grep -i gpt &gt; /dev/null ; echo $? Above command will return 0 if GPT partitions exits because you should get a warning "WARNING: GPT (GUID Partition Table) detected on.." which grep -i gpt will pick up.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23698478

http://stackoverflow.com/comment/36268325
type: Comment
type: QuestionComment
has text: https://i.sstatic.net/KRVMA.png This is an image of my GUI interface. What I want is that: if the user enter the date under the date column, it will automatically adding '-' (dash) between the numbers. Thanks for helping me.
comment on: http://stackoverflow.com/q/23621652
score: 0

http://stackoverflow.com/comment/36260345
type: Comment
type: QuestionComment
has text: @djechlin *vampires scare answerers* ?? Also, that still doesn't change the fact OP tried and needs coding help.
score: 0
comment on: http://stackoverflow.com/q/23617672

http://stackoverflow.com/q/23730092
linked to: http://stackoverflow.com/q/10271540
has body: What are the different ways that I can access the length of an array, a collection (List, Set, etc.), and a String object? Why is it different?
linked to: http://stackoverflow.com/q/1965500
linked to: http://stackoverflow.com/q/23729508
answer count: 3
has comment: http://stackoverflow.com/comment/36476489
accepted answer: http://stackoverflow.com/a/23730093
has comment: http://stackoverflow.com/comment/36476360
tagged with: arrays
has comment: http://stackoverflow.com/comment/36476623
tagged with: string
has comment: http://stackoverflow.com/comment/36476375
score: 23
favorite count: 0
linked to: http://stackoverflow.com/q/9652732
possible better answer: http://stackoverflow.com/a/48330537
has comment: http://stackoverflow.com/comment/36476756
has answer: http://stackoverflow.com/a/60582570
has answer: http://stackoverflow.com/a/48330537
upvote count: 29
downvote count: 6
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23730093
tagged with: collections
has comment: http://stackoverflow.com/comment/36476679
type: Question
has title: How can I get the size of an array, a Collection, or a String in Java?
has comment: http://stackoverflow.com/comment/36476512

http://stackoverflow.com/a/23714903
has body: Depends on how you look at it. Either there's no such thing as anything like shared_ptr in Java because there's no such thing as value objects in Java (except the raw types like int) and RAII doesn't exist there. Or...everything in Java is just like shared_ptr because everything is a share reference that acts more like a reference counted pointer.
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23714853

http://stackoverflow.com/a/23729717
answers question: http://stackoverflow.com/q/23728525
score: 1
has body: You are doing split on read line from the file using \t but actually i copied your data file and checked it is having only space not \t. so replace this line String[] line = input.nextLine().split("\t"); to String[] line = input.nextLine().split(" "); when we put split based on \t then line variable gets complete first line of a file as there is no tab in your data file. so line becomes 45 67 89 12 -3 so nums[row][col] = Integer.parseInt(line[col]); line is doing parsing of integer but actual line is 45 67 89 12 -3 and it has spaces , so it will throw number format exception. since it is handled using catch block it goes to next exception Array index bound exception as you are trying to access array but no element in it because of Number format exception.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36437354
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23709949
has text: Doing that right now :)

http://stackoverflow.com/comment/36317980
has text: @user1791574 Works fine with the labels but can't change legend's labels...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23633489

http://stackoverflow.com/q/23712783
type: Question
score: 0
tagged with: contacts
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23712854
accepted answer: http://stackoverflow.com/a/23712854
has title: Get contact info fail?
type: AnsweredQuestion
tagged with: java
has body: I am making the user choose multiple contacts whose phone nums/names I add into a LinkedHashSet in order to avoid duplicates. My for loop (looping through the linked hash set is not getting excecuted. I believe there is an issue with the contact information gathering although that part gets excecuted) private static final int Req_Code = 1; private LinkedHashSet&lt;String&gt; names = new LinkedHashSet&lt;String&gt;(); private LinkedHashSet&lt;String&gt; numbers = new LinkedHashSet&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fetchContacts(); final Button sendBtn = (Button) findViewById(R.id.send); final EditText text = (EditText) findViewById(R.id.text); sendBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String t = text.getText().toString(); if(!t.equalsIgnoreCase("") &amp;&amp; t != null){ for(int i = 0;i &gt; names.size(); i++){//After debud messages , the only part of the program not getting excecuted is this loop. Log.i("shit", (String) numbers.toArray()[i] + " " + (String) names.toArray()[i]); } text.setText(""); numbers = new LinkedHashSet&lt;String&gt;(); names = new LinkedHashSet&lt;String&gt;(); } } }); } private void fetchContacts() { Log.i("shit", "fetching"); Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI); startActivityForResult(contactPickerIntent, Req_Code); } @SuppressWarnings("deprecation") protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Req_Code) { if(resultCode == RESULT_OK){ Uri uri = data.getData(); Cursor cursor = getContentResolver().query(uri, null, null, null, null); cursor.moveToFirst(); names.add(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME))); cursor.moveToFirst(); numbers.add(cursor.getString(cursor.getColumnIndex(Phone.NUMBER))); fetchContacts(); }else if (resultCode == R…

http://stackoverflow.com/comment/36480919
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23732521
has text: It will be O(nsqrt(n)), **not** O(nlogn). I gave a detailed answer in [this thread](http://stackoverflow.com/q/23361957/572670) for the reasoning.
type: Comment

http://stackoverflow.com/comment/36455778
score: 0
has text: I'm not convinced. The order of the names in a hash is not random, and is likely to stay consistent if the input JSON is the same.
type: Comment
comment on: http://stackoverflow.com/a/23717791
type: AnswerComment

http://stackoverflow.com/q/23730722
answer count: 1
tagged with: jquery
favorite count: 0
has answer: http://stackoverflow.com/a/23730967
has comment: http://stackoverflow.com/comment/36477572
score: -3
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36477743
type: AnsweredQuestion
tagged with: java
has body: I am developing a financial website where on click on pdf or excel sheet i need to convert existing data into an PDF and it should get downloaded. Can you help me how to start about this ?? Can it be done through scripting or does it require JAVA ?? Thanks
downvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/23730967
has title: how to convert html data into an excel or PDF and attach it for download?
tagged with: javascript
upvote count: 0

http://stackoverflow.com/q/23771705
type: Question
tagged with: build
has title: create system metrics with maven java project and Travis CI and github hosted project
score: 1
tagged with: java
upvote count: 1
answer count: 1
downvote count: 0
tagged with: travis-ci
favorite count: 0
has body: My teacher needs me to use a continuous integration build server so i used Travis CI and my java project is hosted on github. It is working quite fine on Travis: https://travis-ci.org/fabiophillip/calculadoralib But he asked me to check code metrics(lines of code, number of classes, methods etc) after the automatic build is complete... Anyone has any idea how to do that? I have tried to use PMD, but i have contacted Travis CI to help me and they said Travis is not integrated to PMD at all. My .travis.yml is like this: language: java jdk: - openjdk7 script: - mvn install -DskipTests=false - mvn pmd:pmd I am using the command pmd:pmd to create the report, but the Travis terminal gives me nothing about it... How do i get the report? My github project is this: https://github.com/fabiophillip/calculadoralib You can check my pom.xml there too
has answer: http://stackoverflow.com/a/34028884
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/23687743
has comment: http://stackoverflow.com/comment/36395889
tagged with: java
has body: If I got a void function like the following... public void OutputString() { System.out.println("This is my string..."); } How can I call this function and add it's output to a JLabel? I tried something like the following but it didn't work... JLabel myLabel=new JLabel(String.valueof(MyClass.OutputString()));
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/23687794
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36396147
has comment: http://stackoverflow.com/comment/36396083
score: -1
has answer: http://stackoverflow.com/a/23687794
tagged with: swing
answer count: 1
downvote count: 1
has title: Displaying The Println of a void function in a JLabel

http://stackoverflow.com/q/23641437
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23701329
type: Question
has comment: http://stackoverflow.com/comment/36392332
upvote count: 0
has comment: http://stackoverflow.com/comment/36353848
answer count: 1
has body: So I made a clone of pong in Lightweight Java Game Library, by basically following this tutorial: http://www.youtube.com/watch?v=z0S5Ded2IJY&amp;list=PL513808FE7D9A5D68 Now the thing is: It works absolutely fine from Netbans, but when I build the application into a .jar it just does nothing when I run it. Do I maybe have to reference some natives? If I run the .jar with cmd, it tells me: java.lang.UnsatisfiedLinkError: no lwjgl in lwjgl.library.path In Netbeans the project has -DJava.library.path="NATIVEPATH" as run time parameter. Any ideas how I can fix this? Edit: I uploaded said .jar so you can test it if you have some time to spend: http://www.file-upload.net/download-8915614/Pong4.jar.html
favorite count: 0
score: -1
type: UnansweredQuestion
has title: Exported LWJGL-OpenGL Application does not run (Java)
downvote count: 1
tagged with: pong
has comment: http://stackoverflow.com/comment/36394491
tagged with: opengl

http://stackoverflow.com/q/23709980
has comment: http://stackoverflow.com/comment/36437368
has comment: http://stackoverflow.com/comment/36437455
tagged with: android
has title: Java NullPointerException with interstitual.setAdListener(new AdListener(){ (Admob)
has comment: http://stackoverflow.com/comment/36437651
has comment: http://stackoverflow.com/comment/36437353
has comment: http://stackoverflow.com/comment/36437603
answer count: 0
has body: The code: interstitial.setAdListener(new AdListener(){ public void onAdLoaded(){ display(); }); } I am using AdMob interstitial Ad, but somehow when the line was run, there was java.lang.NullPointerException. The method is in a method for timer, as shown below: public void progress(){ timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask(){ public void run(){ runOnUiThread(new Runnable() { public void run(){ progress -= 1; totalTime += 500 - (level - 1) * 50; timeForLevel += 500 - (level - 1) * 50; showTimeForLevel(); showTotalTime(); if(progress &lt; 0){ timer.cancel(); interstitial.setAdListener(new AdListener(){ public void onAdLoaded(){ display(); } }); Intent loseIntent = new Intent(Game.this, Lose.class); loseIntent.putExtra("level", level); loseIntent.putExtra("score", score); loseIntent.putExtra("time", totalTime); loseIntent.putExtra("taps", totalTaps); startActivityForResult(loseIntent, 0); } if(progress &gt;= 0){ setGraphics(); } po.getProgress(progress, scrWidth); progressGraphics(); } }); } }, (long)(500 / Math.pow(1 + 0.2/1, level)), (long)(500 / Math.pow(1 + 0.2/1, level))); } What is causing this exception to happen? And how am I going to solve it? LogCat Error: 05-17 17:43:51.571: E/AndroidRuntime(6588): FATAL EXCEPTION: main 05-17 17:43:51.571: E/AndroidRuntime(6588): java.lang.NullPointerException 05-17 17:43:51.571: E/AndroidRuntime(6588): at com.spamclicker.Game$2$1.run(Game.java:158) 05-17 17:43:51.571: E/AndroidRuntime(6588): at android.os.Handler.handleCallback(Handler.java:730) 05-17 17:43:51.571: E/AndroidRuntime(6588): at android.os.Handler.dispatchMessage(Handler.java:92) 05-17 17:43:51.571: E/AndroidRuntime(6588): at android.os.Looper.loop(Looper.java:137) 05-17 17:43:51.571: E/AndroidRuntime(6588): at android.app.ActivityThread.main(ActivityThread.java:5493) 05-17 17:43:51.571: E/AndroidRuntime(6588): at java.lang.reflect.Method.invokeNative(Native Method) 05-17 17:43:51.571: E/AndroidRuntime(6588): at java.lang.reflect.Method.in…
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: admob
has comment: http://stackoverflow.com/comment/36437388
has comment: http://stackoverflow.com/comment/36437429
score: 0

http://stackoverflow.com/comment/36411770
comment on: http://stackoverflow.com/q/23696775
type: Comment
type: QuestionComment
score: 1
has text: I think you are using mysql-driver.jar instead of Microsoft SQL server driver jar file

http://stackoverflow.com/comment/50580581
type: AnswerComment
comment on: http://stackoverflow.com/a/24172801
has text: Works fine. After adding this in web.xml the console shows `[artifact:mvn] DEBUG: org.springframework.core.env.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [servletConfigInitParams] [artifact:mvn] DEBUG: org.springframework.core.env.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams] [artifact:mvn] DEBUG: org.springframework.core.env.PropertySourcesPropertyResolver - Found key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams] with type [String] and value 'dev'`
type: Comment
score: 2

http://stackoverflow.com/comment/36590349
comment on: http://stackoverflow.com/a/23766230
has text: yes, here was the problem .. I had `@Component` and not `@Controller` because I used autocomplete when I wrote `@Co` and I didn't pay attention but I paid with one full day for this.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36345083
has text: @Raghunandan i just wanted see the error on my own codes sorry for polluting the space but you know im a bit excited on my first steps of learning.. Again sorry for that
type: Comment
comment on: http://stackoverflow.com/q/23661200
score: 0
type: QuestionComment

http://stackoverflow.com/q/23744364
has title: Create bean by calling another bean's method
tagged with: java
tagged with: set
type: Question
has answer: http://stackoverflow.com/a/23745940
tagged with: javabeans
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23745940
has body: I am not familiar with Java or Spring. I have a bean injected which is a Map. I want to inject another bean which will be Set of all the keys in Map. ` &lt;util:map id="servers"&gt; &lt;entry key="www.google.com" value="google" /&gt; &lt;entry key="www.amazon.com" value="amazon" /&gt; &lt;entry key="www.apple.com" value="apple" /&gt; &lt;/util:map&gt; ` I want use this bean to create a Set by calling Map.keySet() method. ` &lt;bean id="serverHosts" &gt; &lt;value&gt;&lt;/value&gt; &lt;/bean&gt; ` How to I initialize this bean?
tagged with: spring
tagged with: dictionary
type: AnsweredQuestion

http://stackoverflow.com/q/23768553
has comment: http://stackoverflow.com/comment/36567185
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36549753
has comment: http://stackoverflow.com/comment/36552417
has answer: http://stackoverflow.com/a/23770570
has comment: http://stackoverflow.com/comment/36567119
type: Question
has answer: http://stackoverflow.com/a/23775156
upvote count: 5
tagged with: java
tagged with: mysql
has title: Can I re-use a PreparedStatement if it hits a transient exception?
tagged with: innodb
answer count: 2
accepted answer: http://stackoverflow.com/a/23770570
possible better answer: http://stackoverflow.com/a/23775156
score: 5
downvote count: 0
has body: I have a block of code which updates records in a database. Reduced example: ... statement = connection.prepareStatement( "INSERT INTO thistable (name) VALUES (?)", PreparedStatement.RETURN_GENERATED_KEYS ); statement.setString( 1, "Fred" ); statement.addBatch( ); statement.setString( 2, "Joe" ); statement.addBatch( ); statement.executeBatch( ); ... This is part of some code which is processing a lot of records, and the code is running a lot of threads for speed. That's all fine, but as the load increases on the live environment, I've been noticing a few SQLTransientExceptions being thrown. It seems I can't do anything about these except retry the transaction. My question is: could the batch have been cleared even though the statement failed? Am I OK to simply retry the executeBatch line, or do I need to re-create the entire batch? And is this the same for non-batch statements? In short, and more generally, is this a good way to handle transient exceptions? statement.setString( 1, "Fred" ); statement.addBatch( ); statement.setString( 2, "Joe" ); statement.addBatch( ); for( int attempt = 0; ; attempt ++ ) { try { statement.executeBatch( ); break; } catch( SQLTransientException ex ) { if( attempt &gt;= 3 ) { throw ex; } try { Thread.sleep( attempt * attempt * 100 ); } catch( InterruptedException ex2 ) { throw ex; } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/36551100

http://stackoverflow.com/comment/36415620
has text: Please describe in detail what you tried (including the relevant code), and what the outcome was. I suppose this is related to OSGi (and Gradle's OSGi plugin?), although you don't mention this.
score: 0
comment on: http://stackoverflow.com/q/23698598
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36561324
has text: Please tag this with the appropriate language - I'm assuming Java.
comment on: http://stackoverflow.com/q/23774941
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23700756
type: Question
upvote count: 4
downvote count: 0
score: 4
tagged with: jtable
has body: Hovercraft Full of Eels helped me already by pointing me too a TableCellRenderer but now: I can draw a circle with no problems. I'm just confused as how the original ImageIcons(inside all cells) get overriden with empty cells and a black circle. SSCEE: package sccee; import java.awt.Graphics; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.SwingWorker; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; public class SCCEE extends JFrame { private JTable spelbordTabel; URL url = this.getClass().getResource("/resources/leeg.png"); ImageIcon leeg = new ImageIcon(new ImageIcon(url).getImage().getScaledInstance(100, 100, java.awt.Image.SCALE_SMOOTH)); public static void main(String[] args) { java.awt.EventQueue.invokeLater(() -&gt; { SCCEE testFrame = new SCCEE(); testFrame.setBounds(0, 0, 700, 700); testFrame.setVisible(true); }); } public SCCEE() { initComponents(); updateTableImages(); } private void initComponents() { spelbordTabel = new javax.swing.JTable(); spelbordTabel.setModel(new DefaultTableModel(new Object[][]{ {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null},}, new String[]{ "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7" }) { @Override public Class getColumnClass(int columnIndex) { return ImageIcon.class; } boolean[] canEdit = new boolean[]{false, false, false, false, false, false, false}; @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); spelbordTabel.setAutoscrolls(false); spelbordTabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); spelbordTabel.setOpaque(false); spelbordTabel.setReques…
has answer: http://stackoverflow.com/a/23717997
answer count: 4
possible better answer: http://stackoverflow.com/a/23717997
favorite count: 0
has answer: http://stackoverflow.com/a/23741975
tagged with: paint
has comment: http://stackoverflow.com/comment/36495796
has answer: http://stackoverflow.com/a/23742420
has answer: http://stackoverflow.com/a/23808998
has comment: http://stackoverflow.com/comment/36492429
has comment: http://stackoverflow.com/comment/36492603
tagged with: swing
tagged with: tablecellrenderer
has title: Overriding CellRenderer, ImageIcon disappears
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23741975

http://stackoverflow.com/comment/36410607
has text: @Evan has a point. Do you know the keys (name, header, aname, lname) are always the same or come from a specific set?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23695951
score: 0

http://stackoverflow.com/q/23627732
favorite count: 0
tagged with: protocol-buffers
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36278769
has comment: http://stackoverflow.com/comment/36278956
has comment: http://stackoverflow.com/comment/36377184
tagged with: c++
has title: Deserializing a protobuf ByteArray in Java that was passed from C++ over JNI
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23661544
type: Question
has body: i have a protobuffer message, whose fields are filled with data. I am serializing this message in C++ first to a char* and then copying the contents of that char* to a jbyteArray. Then i return the jbyteArray to my java-class, where i want to deserialize it, so i can access the individual fields of the message/class. But i don't really know how. This is my code so far: public String IMEI(){ GetDeviceInfo nativeDeviceInfo = new GetDeviceInfo(); byte[] ret = nativeDeviceInfo.getDeviceData(); CellPhoneDevice.Builder device = CellPhoneDevice.newBuilder(); try { device.mergeFrom(ret); } catch (InvalidProtocolBufferException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(!device.hasImeiNumber()) return "imei empty"; long imei = device.getImeiNumber(); String str = String.valueOf(imei); // String str = new String(ret); //see if ByteArray is even filled return str; } i've checked if the byteArray does contain data (see commented out line) and it is filled, so i'm guessing i'm doing something wrong with parsing the byteArray. I've searched a lot of websites/tutorials, but there wasn't much on deserializing byteArrays and if there was, i couldn't replicate it (method undefined and such stuff). When i run this code, it executes without any errors, but the string that should contain the imei only contains "0" and the method returns the "imei empty"-string. So, yes... could someone please tell me, what's the way to deserialize a byteArray?
tagged with: java-native-interface
tagged with: arrays
has comment: http://stackoverflow.com/comment/36278826
upvote count: 1
has comment: http://stackoverflow.com/comment/36324173
answer count: 1

http://stackoverflow.com/q/23717382
has body: I compiled my code and got the error: C:\Users\RJ\Desktop&gt;javac windowTest.java windowTest.java:17: error: &lt;identifier&gt; expected click.addActionListener(new ActionListener(){ ^ windowTest.java:22: error: ';' expected }); ^ 2 errors I am still very new to java and would appreciate examples and/or step by step help with explanations. If I move the override I get an error saying I didn't override. My code is: import java.awt.*; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.*; import java.util.Scanner; public class windowTest extends JFrame implements ActionListener{ public static void main(String args[]){ JFrame frame = new JFrame(); JLabel label = new JLabel("This is a test."); JButton click = new JButton("Test"); JPanel buttonPan = new JPanel(); JPanel textPan = new JPanel(); final JTextField textIn = new JTextField(); @Override click.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String text = textIn.getText(); System.out.println(text); } }); buttonPan.setSize(100, 100); textIn.setPreferredSize(new Dimension(700, 48)); textPan.add(textIn); buttonPan.add(click); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(800, 700); frame.setLocationRelativeTo(null); frame.setLayout(new BorderLayout()); label.setHorizontalAlignment(JLabel.CENTER); label.setVerticalAlignment(JLabel.CENTER); frame.add(label, BorderLayout.NORTH); frame.add(buttonPan, BorderLayout.SOUTH); frame.add(textPan, BorderLayout.CENTER); frame.setVisible(true); frame.setTitle("Window Test"); } }
tagged with: swing
tagged with: jbutton
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/36451400
has title: Identifier expected in an ActionListener
has answer: http://stackoverflow.com/a/23717409
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23717409
has comment: http://stackoverflow.com/comment/36451424
has comment: http://stackoverflow.com/comment/36451431
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36451463
has comment: http://stackoverflow.com/comment/36451434
tagged with: java

http://stackoverflow.com/q/23735308
duplicate of: http://stackoverflow.com/q/22439314
has comment: http://stackoverflow.com/comment/36485659
has answer: http://stackoverflow.com/a/23735378
linked to: http://stackoverflow.com/q/22439314
score: 0
has body: I have two calendar objects, they seems to contain same dates but the compareTo() method is returning -1 as result, Can any one explain the reason behind this. On debugging the two Calendar objects, the result is shown as : 2014-06-01T00:00:00.000Z for both calendar objects but the compareTo() is returning -1. Even the long time in millis for both dates are different.
has comment: http://stackoverflow.com/comment/36486428
has comment: http://stackoverflow.com/comment/36485793
has answer: http://stackoverflow.com/a/23736202
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36485667
answer count: 4
has comment: http://stackoverflow.com/comment/36511882
tagged with: java
has answer: http://stackoverflow.com/a/23735487
has answer: http://stackoverflow.com/a/23735492
has comment: http://stackoverflow.com/comment/36513053
has title: Java same Dates containing different time in milli seconds
type: Question

parameter-passing
tags question: http://stackoverflow.com/q/23710681
tag name: parameter-passing
type: Tag
tags question: http://stackoverflow.com/q/23759620

http://stackoverflow.com/comment/115888097
type: Comment
comment on: http://stackoverflow.com/a/23676927
score: 0
type: AnswerComment
has text: what is your BaseView?

http://stackoverflow.com/q/23703431
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23703591
type: Question
linked to: http://stackoverflow.com/q/19840505
downvote count: 0
has answer: http://stackoverflow.com/a/65343663
tagged with: android
has answer: http://stackoverflow.com/a/23703713
answer count: 4
has body: I'm trying to parse some JSON. Here is the code. frc-manual.usfirst.org/a/GetAllItems/ManualID=3 I have been trying for several hours to get it work but every example I have seen online uses getJSONObject(int) but I can only use getJSONObject(String). This is making impossible. Am I overlooking something? import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserFactory; import android.annotation.SuppressLint; public class JSON { private String html = "html"; private String version = "version"; private String pageString = null; private String urlString = "http://frc-manual.usfirst.org/a/GetAllItems/ManualID=3"; public volatile boolean parsingComplete = true; public JSON(String page){ this.pageString = page; } public String getHTML(){ return html; } public String getVersion(){ return version; } @SuppressLint("NewApi") public void readAndParseJSON(String in) { try { JSONObject reader = new JSONObject(in); JSONObject head = reader.getJSONObject("data").getJSONObject("SubChapter").getJSONObject("3").getJSONObject("children").getJSONObject(pageString); if(head != null){ html = head.getString("item_content_text"); html = html + head.length(); for(int i = 0; i &lt; head.length();i++){ JSONObject children = head.getJSONObject(i); if(children != null){ html = html + children.getString("item_content_text"); } } } //html = html + listFromJsonSorted(head.getJSONObject("children")); JSONObject main = reader.getJSONObject("data"); version = main.getString("LatestManualUpdate"); parsingC…
favorite count: 0
has answer: http://stackoverflow.com/a/23703730
linked to: http://stackoverflow.com/q/18334947
type: UnansweredQuestion
has title: Use getJSONObject(int)
score: 3
upvote count: 3

http://stackoverflow.com/comment/36358121
has text: The meaning of the message is that you are trying to talk RMI to a non-RMI endpoint, or possibly an RMI/SSL endpoint. But why in this configuration is another question.
type: Comment
comment on: http://stackoverflow.com/q/23663543
score: 0
type: QuestionComment

http://stackoverflow.com/a/23723986
has comment: http://stackoverflow.com/comment/36465304
has comment: http://stackoverflow.com/comment/36465128
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36465658
has comment: http://stackoverflow.com/comment/36465210
score: 3
answers question: http://stackoverflow.com/q/23723945
downvote count: 0
has body: Is it usual to do things this way? UI programming is event-based in Swing. Twisting it into any other style will not make it easier for you. What you might mean is that you should minimize the code in that UI part. This means that you shouldn't tie the UI to the logic, therefore creating dense coupling. In this example, the file-reading code should be moved into another method, ideally in another class. All my program inside an event handler? To answer this specific question: No, that'd be terrible! It's okay to invoke your program from there, but don't write the code in the event-handler!

http://stackoverflow.com/comment/36477578
type: QuestionComment
comment on: http://stackoverflow.com/q/23730382
type: Comment
has text: @Giri I tried this but no use, same problem
score: 0

http://stackoverflow.com/q/23744845
downvote count: 1
has answer: http://stackoverflow.com/a/23745133
tagged with: java
has comment: http://stackoverflow.com/comment/36503808
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23744956
has comment: http://stackoverflow.com/comment/36503739
has comment: http://stackoverflow.com/comment/36503814
accepted answer: http://stackoverflow.com/a/23745133
favorite count: 0
has answer: http://stackoverflow.com/a/23744896
has body: I have written a java code to create a file if file name is provided in command line argument, if command line argument is not entered it will create file in default folder import java.io.File; import java.io.IOException; public class Outputlogs { private final String path = "C:/temp/logs.txt"; public void createLogFile(String fileName) { if(fileName != null &amp;&amp; !fileName.isEmpty()) { File yourFile = new File(fileName); if(!yourFile.exists()) { try { yourFile.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { File yourFile = new File(path); if(!yourFile.exists()) { try { yourFile.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } public class MainClass() { public static void main(String[] argv) { String fileName = argv[0]; Outputlogs logs= new Outputlogs(); logs.createLogFile(fileName); } If i am providing command line arguments, its successfully creating the file but if command line argument is not entered, i am getting java.lang.ArrayIndexOutOfBoundsException How to achieve my scenario if command line argument is not entered it should create default folder. Please help
type: Question
has answer: http://stackoverflow.com/a/23746520
has title: default behavior if command line argument not provided
has comment: http://stackoverflow.com/comment/36503711
possible better answer: http://stackoverflow.com/a/23744896
has comment: http://stackoverflow.com/comment/36503714
score: 0
upvote count: 1

http://stackoverflow.com/comment/36365455
has text: Is the second edit enough?
comment on: http://stackoverflow.com/q/23668631
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/35213499
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/119463003
score: 2
downvote count: 0
has body: As you stated, you can use a static driver, but, yes, you are risking a shared memory issue if you do any parallelization directly at the test code level. I've avoided using a static driver for just this reason, it's bad design for a test suite that may grow into parallelization. Running a single process launching tests on multiple servers in a selenium grid would not work. The way I've designed around this situation is to pass the driver (created in the @Before) to each page object when I initialize them. If the suite WILL NOT grow, you can still use the static driver, and launch multiple tests as separate jobs (i.e. separate Jenkins jobs, or separate runs from the command line, etc)
answers question: http://stackoverflow.com/q/23735885

http://stackoverflow.com/q/23639847
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
has title: JLabel.setText() relocates all labels in mousewheelevent
tagged with: settext
tagged with: location
has comment: http://stackoverflow.com/comment/36303625
score: 0
has comment: http://stackoverflow.com/comment/36520378
has body: EDIT: leaving short code which shows issue: Then label.setText("") is called and it has to change the text, i.e. scaler overcame 50 barrier the label dissapears for the mousewheelevent -> re-emerges on next event. Also a problem of the label not being present on the Load-up. In actual program labels stack together in 1 spot if any of them has .setText() changing value or .setVisible changing (These two methods I need to be able to use without affecting labels positioning) import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JLayeredPane; import javax.swing.JPanel; import javax.swing.OverlayLayout; public class brokenLabel extends JFrame { private JLayeredPane layerPane; private JPanel breakingLabelPanel = new JPanel(); private JLabel label; private int scaler = 50; private int xstart = 200; private int ystart = 200; public static void main(String[] args) { @SuppressWarnings("unused") brokenLabel program = new brokenLabel(); } public brokenLabel() { // Frame setup used on the program final JFrame frame = new JFrame("This is a slideshow"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); layerPane = new JLayeredPane(); frame.setContentPane(layerPane); // Panel used (it's similar to what's added on the actual program) breakingLabelPanel.setOpaque(true); breakingLabelPanel.setLayout(new OverlayLayout(breakingLabelPanel)); breakingLabelPanel.setVisible(true); breakingLabelPanel.setSize(getMaximumSize()); breakingLabelPanel.addMouseWheelListener(new MouseWheelListener(){ @Override public void mouseWheelMoved(MouseWheelEvent arg0) { if (scaler &gt; 5 || arg0.getWheelRotation() &lt; 0) scaler = scaler - 5*arg0.getWheelRotation(); setTexts(); } }); //The testing label label = new JLabel(new String("1")); label.setLocation(xstart , ystart); breakingLabelPanel.add(label); frame.add(breakingLabelPanel,layerPane); frame.setVisib…
tagged with: jlabel
answer count: 0

http://stackoverflow.com/comment/36276270
comment on: http://stackoverflow.com/a/23625652
type: Comment
has text: given the dpi of an image , can't i set the height and width to resize the image ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23679930
has body: Instead of verifying existance of cookies. You should verify some exact value, that you can prevously set with setCookies method.
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23679716

http://stackoverflow.com/comment/36440171
type: Comment
has text: Thank you for the suggestion. I tried it, and unfortunately, that does not change the exception. I even adopted your Autowired form for DataSource, thinking that Spring may not see my one-arg ListableBeanFactory form for the transaction manager method. Using the Autowired form did not help, either.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23711495

http://stackoverflow.com/q/23714471
has comment: http://stackoverflow.com/comment/36445635
tagged with: java
has comment: http://stackoverflow.com/comment/36447083
linked to: http://stackoverflow.com/q/1732348
score: 0
answer count: 2
tagged with: validation
has title: How to validate complete html using java
possible better answer: http://stackoverflow.com/a/37037474
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/4217801
has body: I want to validate HTML tags and it contents using java. Validation should make sure all the html tags are closed properly. There is no mistake in the tag creation area. For eg or I need to validate such kind of things. while googling I got a regular expression like this <(\"[^\"]*\"|'[^']*'|[^'\">])*> But it wont validate all the HTMLs are closed or not? So how can I add that also with this. My sample code is attached below. Please help me. package com.test; import java.util.regex.Matcher; import java.util.regex.Pattern; public class htmlValidator { private static Pattern pattern; private static Matcher matcher; private static final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"; public void HTMLTagValidator(){ pattern = Pattern.compile(HTML_TAG_PATTERN); } public static boolean validate(final String tag){ matcher = pattern.matcher(tag); return matcher.matches(); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String htmlStr = " This is first paragraph. This is first paragraph. Yes this is spab "; System.out.println("htmlStr :- "+htmlStr); validate(htmlStr); } }
has comment: http://stackoverflow.com/comment/36445717
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36445533
upvote count: 1
has answer: http://stackoverflow.com/a/23714619
accepted answer: http://stackoverflow.com/a/23714619
downvote count: 1
has answer: http://stackoverflow.com/a/37037474
type: Question

http://stackoverflow.com/a/23706765
has body: for(int i=1; i==2500; i++) to for(int i=1; i &lt; 2500; i++)
type: Answer
answers question: http://stackoverflow.com/q/23706745
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/36410469
score: 0
type: Comment
type: QuestionComment
has text: Can you give use the stacktrace and tell use where in your code the exception occurs? You call `generated.get(...)` a lot of time.
comment on: http://stackoverflow.com/q/23695985

dialog
tags question: http://stackoverflow.com/q/23672100
tag name: dialog
tags question: http://stackoverflow.com/q/23627414
type: Tag
tags question: http://stackoverflow.com/q/23676152
tags question: http://stackoverflow.com/q/23693117
tags question: http://stackoverflow.com/q/23693034

http://stackoverflow.com/q/23753359
has body: I am using inheritIO() to redirect output from a child process in my program to the System.out and System.err, and input to System.in. These are all redirected by System.setOut() and the like: // Reassign System IO System.setIn(cpanel.getConsole().getInputStream()); System.setOut(new PrintStream(cpanel.getConsole().getOutputStream())); System.setErr(new PrintStream(cpanel.getConsole().getOutputStream())); However when I run the process: String[] fullargs = new String[sargs.length+4]; fullargs[0] = "java"; fullargs[1] = "-classpath"; // Runtime classpath option. fullargs[2] = cpath; // Specify the classpath. fullargs[3] = mname; // Specify class to run. for(int i=0; i&lt;sargs.length; i++) { fullargs[i+4] = sargs[i]; // Put together arguments. } ProcessBuilder proc = new ProcessBuilder() .inheritIO() .command(fullargs); try { System.out.println("RUNNING..."); proc.start(); } catch(IOException ioe) { JOptionPane.showMessageDialog(null, "There was a system error invoking this program.", "ERROR", JOptionPane.ERROR_MESSAGE); } It redirects to what used to be System.out etc. rather than what they've been redirected to. If I comment out the inheritIO() line, the output is lost to time and doesn't appear anywhere. With inheritIO() it goes to the standard console of the parent process rather than the redirected one. The line where I print "RUNNING" goes to the proper redirected location. In other words, inheritIO() is doing exactly what it should if I hadn't redirected the output streams of the parent process. It's going to the parent process's old console. I have no idea why this is happening and I'm pulling my hair out here. I've seen that inheritIO() doesn't work in Windows, but this issue is the same on Mac OS and Linux. I'm using Java 7.
linked to: http://stackoverflow.com/q/23131139
tagged with: java-7
answer count: 1
has answer: http://stackoverflow.com/a/32351355
accepted answer: http://stackoverflow.com/a/32351355
has title: ProcessBuilder.inheritIO() sending output to the wrong place
favorite count: 0
tagged with: processbuilder
tagged with: http-redirect
has comment: http://stackoverflow.com/comment/36520535
has comment: http://stackoverflow.com/comment/36521403
tagged with: system.out
type: AnsweredQuestion
score: 3
downvote count: 0
linked to: http://stackoverflow.com/q/14165517
tagged with: java
type: Question
upvote count: 3

http://stackoverflow.com/q/23661171
upvote count: 3
has comment: http://stackoverflow.com/comment/36360227
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36348714
has title: logback: how do I differentiate logging between test and main when using groovy configuration?
has body: I understand that, when using xml configuration, you can put a logback-test.xml under src/test/resources for test phase logging and logback.xml under src/main/resources for main logging. However, how can I achieve the same thing for groovy configuration? Thank you very much.
score: 3
has comment: http://stackoverflow.com/comment/36348964
tagged with: java
tagged with: logback
has comment: http://stackoverflow.com/comment/36348869
type: Question
tagged with: groovy
has answer: http://stackoverflow.com/a/24919167
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36349838
type: Comment
type: QuestionComment
has text: I havent used eclipse in a while, maybe removing junit project nature from the project? (Just guessing cannot check though)
comment on: http://stackoverflow.com/q/23663726
score: 0

http://stackoverflow.com/comment/36538044
score: 0
type: AnswerComment
type: Comment
has text: @user3354638: But why? The code I've given does the same sort of thing, but in one go. Do you mean you've got an *abstract* `caster` method in the superclass, which you then implement in each subclass? While that removes a *potentially* invalid cast, I don't think it has any practical benefit.
comment on: http://stackoverflow.com/a/23762014

http://stackoverflow.com/a/78418219
answers question: http://stackoverflow.com/q/23726899
has body: Resolve by @user3645667 : I have found how to do it. Editing the file netbeans.conf from the etc directory located at the installation directory of NetBeans. In the netbeans_default_options option, add -J-Dfile.encoding=UTF-8.
score: 0
type: Answer

http://stackoverflow.com/comment/36375478
type: QuestionComment
comment on: http://stackoverflow.com/q/23677364
has text: I do not understand your question. Please clarify. What language/tool you're using and what do you mean with `I also want to check quotes`?
score: 4
type: Comment

http://stackoverflow.com/a/23722569
answers question: http://stackoverflow.com/q/23722444
has body: you are doing mistake at onCreateOptionMenu. @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; } Please check here or completely remove this
type: Answer
score: 0

http://stackoverflow.com/q/23773379
answer count: 1
tagged with: paintcomponent
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
downvote count: 1
has body: How come the polygon I tell my program to display. Here is my code of the class I call. package rubiksCube; /*class that contains my paint component*/ import java.awt.*; import javax.swing.JPanel; public class Display extends JPanel{ Polygon[][] p = {{new Polygon(),new Polygon(),new Polygon()}, {new Polygon(),new Polygon(),new Polygon()}, {new Polygon(),new Polygon(),new Polygon()}}; int[] rx = {0,0,0,0}; int[] ry = {0,0,0,0}; int rsN = 0; public void renderSide(int sN,int[] x,int[] y){ rsN = sN; ry = y; rx = x; } public void paintComponent(Graphics g){ g.clearRect(0, 0, 100, 100); for(int y = 0;y&lt;3;y++){ for(int x = 0;x&lt;3;x++){ System.out.print(x); System.out.println(y); g.setColor(getColor(Main.j[rsN][(y*3)+x])); p[y][x].addPoint((((rx[0]-rx[3])*(y/3)+rx[0])-((rx[1]-rx[2]))*(y/3)+rx[1])*(x/3)+((rx[0]-rx[3])*(y/3)+rx[0]),((((ry[0]-ry[3])*(x/3)+ry[0])-((ry[1]-ry[2]))*(x/3)+ry[1]))*(y/3)+((ry[0]-ry[3])*(x/3)+ry[0])); p[y][x].addPoint((((rx[0]-rx[3])*(y/3)+rx[0])-((rx[1]-rx[2]))*(y/3)+rx[1])*(x+1/3)+((rx[0]-rx[3])*(y/3)+rx[0]),((((ry[0]-ry[3])*(x/3)+ry[0])-((ry[1]-ry[2]))*(x/3)+ry[1])*(y/3))+((ry[0]-ry[3])*(x/3)+ry[0])); p[y][x].addPoint((((rx[0]-rx[3])*(y/3)+rx[0])-((rx[1]-rx[2]))*(y/3)+rx[1])*(x+1/3)+((rx[0]-rx[3])*(y/3)+rx[0]),((((ry[0]-ry[3])*(x/3)+ry[0])-((ry[1]-ry[2]))*(x/3)+ry[1]))*(y+1/3)+((ry[0]-ry[3])*(x/3)+ry[0])); p[y][x].addPoint((((rx[0]-rx[3])*(y/3)+rx[0])-((rx[1]-rx[2]))*(y/3)+rx[1])*(x/3)+((rx[0]-rx[3])*(y/3)+rx[0]),((((ry[0]-ry[3])*(x/3)+ry[0])-((ry[1]-ry[2]))*(x/3)+ry[1]))*(y+1/3)+((ry[0]-ry[3])*(x/3)+ry[0])); g.fillPolygon(p[y][x]); } } } public Color getColor(int i){ switch(i){ case 0: return Color.WHITE; case 1: return Color.GREEN; case 2: return Color.RED; case 3: return Color.YELLOW; case 4: return Color.BLUE; } return Color.ORANGE; } } //my main class package rubiksCube; import java.awt.Graphics; import javax.swing.JFrame; public class Main { public static int[][] j = { {0,0,0,0,0,0,0,0,0}, {1,1,1,1,1,1,1,1,1}, {2,2,2,2,2,2,2,2,2}, {3,3,…
tagged with: graphics
has answer: http://stackoverflow.com/a/23773459
tagged with: java
score: -1
type: Question
upvote count: 0
favorite count: 0
has title: Java Gridbag layout fillPolygon not displaying?

http://stackoverflow.com/q/23766470
has answer: http://stackoverflow.com/a/23766626
has title: Javadoc Multi-Line Declaration Syntax?
has body: If I have the variable declaration: /** * The Resource folder for the program Information. */ public static final Path RESOURCE_FOLDER_PATH = Paths.get("", "Resources"), /** * The folder holding all faction information. */ FACTION_FOLDER_PATH = Paths.get(RESOURCE_FOLDER_PATH.toString(), "Faction Information"); The Javadoc will not document the latter Path variable. Does Javadoc support this type of documenting style or do I have to declare them separately?
favorite count: 0
has comment: http://stackoverflow.com/comment/36545631
tagged with: path
accepted answer: http://stackoverflow.com/a/23766626
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36546148
score: 1
has comment: http://stackoverflow.com/comment/36546396
tagged with: java
tagged with: javadoc
tagged with: file
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36546414

http://stackoverflow.com/comment/36486407
type: QuestionComment
comment on: http://stackoverflow.com/q/23733953
has text: @Stultuske - I am still facing the same issue. Edited the above post with my updated code.
type: Comment
score: 0

http://stackoverflow.com/q/23741247
tagged with: postgresql
has body: I try to query PostgreSQL database via Hibernate native sql interface. But I'm getting org.hibernate.MappingException: No Dialect mapping for JDBC type: 2002 SQL query is quite complex, but via (e.g.) pgAdmin works fine. Does anyone have any idea where the problem should be? WebpageDaoImpl.java public PageDto search(final String term, final Long parentNodeId, final String localeCode){ hqlQuery = sessionFactory.getCurrentSession().createSQLQuery(buildSearchQuery(false)); hqlQuery.setCacheable(false); hqlQuery.setString("locale", localeCode); hqlQuery.setString("query", term); hqlQuery.setString("fullTextQuery", term.replace(" ", "&amp;")); hqlQuery.setLong("nodeId", parentNodeId); items.setItems(hqlQuery.list()); } private String buildSearchQuery(){ StringBuilder sql = new StringBuilder(); sql.append("with recursive tmp_webpage(id, parent) as ( ") .append(" values(cast(-1 as bigint), cast(:nodeId as bigint)) ") .append(" union all ") .append(" select w.id, w.parent_id ") .append(" from tmp_webpage as tw, webpage as w ") .append(" where w.id = parent ") .append(" ) ") .append("SELECT w FROM webpage w ") .append(" inner join webpage_content wc ON w.id=wc.webpage_id ") .append("WHERE wc.localized_key= :locale AND w.enabled=true (") .append(" unaccent(lower(wc.title)) like CONCAT('%', unaccent(lower(:query)) , '%') OR ") .append(" wc.webpage_tsvector @@ to_tsquery( cast( wc.localized_key as regconfig), :fullTextQuery) ) "); .append("GROUP BY w.id, wc.webpage_tsvector, wc.localized_key ") .append("ORDER BY ts_rank(wc.webpage_tsvector, to_tsquery(cast( wc.localized_key as regconfig), :fullTextQuery )) DESC"); return sql.toString(); } Webpage.java public class Webpage{ private Long id; private Webpage parent; private Set&lt;Webpage&gt; childrens; // ... @ElementCollection @CollectionTable(name = "webpage_content") @MapKeyJoinColumn(name = "locale") private Map&lt;String, WebpageContent&gt; localized; //... } WebpageContent.java @Embeddable public class WebpageContent { priv…
type: AnsweredQuestion
downvote count: 0
tagged with: hql
type: Question
score: 3
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23742842
accepted answer: http://stackoverflow.com/a/23742842
upvote count: 3
tagged with: sql
answer count: 1
has title: MappingException: No Dialect mapping for JDBC type: 2002
favorite count: 0

http://stackoverflow.com/q/23687127
has body: I am trying to set some javascript items on my page, but the items are getting set after the javascript runs on the page. So for example, I created a Console.log() method to display stuff in my java console for debugging purposes. But the items are getting set after the page code runs so the logging doesn't work (See second block of code). Is there a way for me to initiate the code before the javascript on the page runs? So, here is how I am initiating the item in my Java application: webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener&lt;Worker.State&gt;(){ if(newState.equals(Worker.State.SUCCEEDED)){ JSObject win = (JSObject)Browser.webEngine.executeScript("window"); win.setMember("$js", new JavaScriptBinder()); win.setMember("console", new JSConsole()); } } Here is a javascript example: &lt;script&gt; // This line doesn't work: console.log("Hello"); element.addEventListener("click", function(){ // This line does work: console.log("Hello from a click"); }); &lt;/script&gt;
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23687416
has title: javafx WebView setMember() before script
downvote count: 0
answer count: 1
tagged with: javascript
favorite count: 0
type: UnansweredQuestion
upvote count: 1
type: Question

http://stackoverflow.com/a/23729097
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23728632
has body: Create another batch script that simply starts it. All you would need to do is to change the relative location of the Tomcat directory in the script.

http://stackoverflow.com/a/23643767
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23627847
answers question: http://stackoverflow.com/q/23627847
has comment: http://stackoverflow.com/comment/36380444
type: Answer
upvote count: 1
has body: If it is about just getting the first three rows use scan shell command with LIMIT set to 3: hbase(main):001:0&gt; scan 'demo', {LIMIT =&gt; 3} If you wish to do it using Java API, set a loop over ResultScanner which breaks after the third iteration. Simple and easy. public static void main(String[] args) throws IOException { Configuration conf = HBaseConfiguration.create(); HTable table = new HTable(conf, "demo"); Scan s = new Scan(); ResultScanner rs = table.getScanner(s); int check = 0; for(Result r : rs){ if(++check &gt; 3) break; for (KeyValue kv : r.raw()){ System.out.println("Qualifier : " + Bytes.toString(kv.getQualifier())); } } rs.close(); table.close(); } } And if you wish to get 3 random rows, use RandomRowFilter with the above approach. HTH

http://stackoverflow.com/a/23618392
has comment: http://stackoverflow.com/comment/36261073
has comment: http://stackoverflow.com/comment/36261212
score: 4
has comment: http://stackoverflow.com/comment/36261474
has comment: http://stackoverflow.com/comment/36261123
has comment: http://stackoverflow.com/comment/36261018
type: Answer
answers question: http://stackoverflow.com/q/23618298
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23618298
downvote count: 0
has comment: http://stackoverflow.com/comment/36261683
has comment: http://stackoverflow.com/comment/36261298
has body: Neither of these rules allows covariant return types. Signatures of a method refer to the method name and the types and order of its arguments, but not to the return type. From JLS, Section 8.4.8.3: If a method declaration d1 with return type R1 overrides or hides the declaration of another method d2 with return type R2, then d1 must be return-type-substitutable (§8.4.5) for d2, or a compile-time error occurs. This rule allows for covariant return types - refining the return type of a method when overriding it. That refers to Section 8.4.5, which states: A method declaration d1 with return type R1 is return-type-substitutable for another method d2 with return type R2 iff any of the following is true: If R1 is void then R2 is void. If R1 is a primitive type then R2 is identical to R1. If R1 is a reference type then one of the following is true: R1, adapted to the type parameters of d2 (§8.4.4), is a subtype of R2. R1 can be converted to a subtype of R2 by unchecked conversion (§5.1.9). d1 does not have the same signature as d2 (§8.4.2), and R1 = |R2|. (emphasis mine) That part I bolded allows covariant return types.
has comment: http://stackoverflow.com/comment/36261090
has comment: http://stackoverflow.com/comment/36261177
has comment: http://stackoverflow.com/comment/36262137
type: AcceptedAnswer

http://stackoverflow.com/comment/36479564
type: AnswerComment
score: 0
type: Comment
has text: Thanks. By the way, do you have experience with FX and data binding? I got this doubt: http://stackoverflow.com/questions/23730904/how-to-properly-use-javafx-tableview-and-observablelist-classes
comment on: http://stackoverflow.com/a/23698340

http://stackoverflow.com/q/23703603
has comment: http://stackoverflow.com/comment/36425810
type: Question
has answer: http://stackoverflow.com/a/23703654
tagged with: object
linked to: http://stackoverflow.com/q/2233902
has comment: http://stackoverflow.com/comment/36425350
score: 4
upvote count: 4
answer count: 3
has body: I've taken a year of java course at school and my understanding of casting is pretty limited. The type of casting I understand is casting int to double. This makes sense; 1 would become 1.0 The type of casting I don't quite understand is: casting a custom object (say superRectangle) to another customer object (eg, myRectangle). (this is assuming myRectangle is a subclass of superRectangle) What happens to all the private or public fields associated with an instance of superRectangle? How does the program know this is a legit move? For all that matters I could've just casted an int to a string, and what is that supposed to mean anyway?
tagged with: casting
downvote count: 0
has comment: http://stackoverflow.com/comment/36425325
favorite count: 0
has comment: http://stackoverflow.com/comment/36425723
has answer: http://stackoverflow.com/a/23703715
tagged with: subclass
has title: Can Java cast anything?
accepted answer: http://stackoverflow.com/a/23703715
possible better answer: http://stackoverflow.com/a/23703672
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23703672
tagged with: java

http://stackoverflow.com/a/23671299
answers question: http://stackoverflow.com/q/23669885
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
has body: If you are not using nodemanager to startup the servers: Create a file named boot.properties at $domain_home/security/boot.properties with the following content username=&lt;USERNAME&gt; password=&lt;PASSWORD&gt; Start the server now and it will automatically pickup the username/password from this file. The server will also encrypt the file. Reference If you are using nodemanager to startup the servers: You need to enroll the server to the nodemanager and the boot.properties file will be automatically created at $domain_home/servers/server_name/data/nodemanager/ Reference
type: Answer
accepted answer of: http://stackoverflow.com/q/23669885

http://stackoverflow.com/q/23707388
has comment: http://stackoverflow.com/comment/36490150
answer count: 1
has comment: http://stackoverflow.com/comment/36498209
linked to: http://stackoverflow.com/q/17527933
has comment: http://stackoverflow.com/comment/36493035
favorite count: 0
has body: Previously, I have a set of Google Drive API code, which works fine in the following scenarios Save new file to appdata Update previous file in appdata Save new file to non-appdata Update previous file in non-appdata Few days ago, I encounter scenario 2 no longer work (Update previous file in appdata), whereas other scenarios still work without problem. I will be getting the following exception. com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error { "code": 500, "errors": [ { "domain": "global", "message": "Internal Error", "reason": "internalError" } ], "message": "Internal Error" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at org.yccheok.jstock.gui.Utils.updateFile(Utils.java:1414) I'm using both DRIVE and DRIVE_APPDATA scope - authorizeDrive() The code is as follow saveToGoogleDrive() - Save or update file in appdata, doesn't work during update file. Work during saving new file. saveToLegacyGoogleDrive() - Save or update file in non-appdata, all works! Exception is being thrown at Line 1414, which is com.google.api.services.drive.model.File updatedFile = service.files().update(fileId, file, mediaContent).setNewRevision(false).execute(); Searching previous file in appdata using query title contains 'jstock-fe…
has comment: http://stackoverflow.com/comment/36492880
has title: Unable update file store in appdata scope - 500 Internal Server Error
tagged with: google-drive-api
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36493678
has comment: http://stackoverflow.com/comment/36493538
tagged with: java
has comment: http://stackoverflow.com/comment/36493221
has comment: http://stackoverflow.com/comment/36498524
has comment: http://stackoverflow.com/comment/36495586
downvote count: 1
linked to: http://stackoverflow.com/q/23734503
type: Question
has answer: http://stackoverflow.com/a/23742537
accepted answer: http://stackoverflow.com/a/23742537
score: 18
upvote count: 19
has comment: http://stackoverflow.com/comment/36493553
has comment: http://stackoverflow.com/comment/36477463

http://stackoverflow.com/q/23775949
has body: I want the functionality of Google Now app, like when it's day time, the header is a sunny image, when it becomes noon or sundown, the image changes to a sundown image, when it's night the image changes to a night image, and same for the morning one. I'm trying to implement my background which does this very same thing, how must I go about implementing this? I've searched up on this but the answers are for html and website development. And most of the others are based on time interval and I think that's what I should use but I would like something like this. Written in non-tech language 01:00/1am - Morning - Image changes to Morning.png on the imageview (R.id.view). 09:00/9am - Normal - Image changes to Daytime.png on the imageview (R.id.view). 12:00/12pm - Noon - Image changes to Noon.png on the imageview (R.id.view). 19:00/7pm - Night - Image changes to Noon.png on the imageview (R.id.view). How I can achieve something similar to this?
tagged with: android
has answer: http://stackoverflow.com/a/23776140
accepted answer: http://stackoverflow.com/a/23776140
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/494180
has comment: http://stackoverflow.com/comment/36563557
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23776108
type: Question
answer count: 2
tagged with: imageview
has title: Change an image according to time of day
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/36563790
has answer: http://stackoverflow.com/a/23776108

html-editor
tags question: http://stackoverflow.com/q/23735815
tag name: html-editor
type: Tag
tags question: http://stackoverflow.com/q/23755530

http://stackoverflow.com/q/23732227
tagged with: null
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36480524
score: 0
has comment: http://stackoverflow.com/comment/36480899
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36480816
answer count: 0
has title: Eclipse Null Analysis weird type mismatch error
tagged with: java
has comment: http://stackoverflow.com/comment/36480239
type: Question
has body: I am learning to use Eclipse's Null Analysis in my project by enable annotation-based null analysis in Preferences &gt; Java &gt; Compiler &gt; Errors/Warnings, but I have encountered a weird error when doing the following. 1) Create 2 interfaces: public interface Book {} and import org.eclipse.jdt.annotation.NonNull; public interface BookService { public @NonNull Book getBook(Long id); } 2) Create 2 classes implementing the above interfaces: public class BookImpl implements Book {} and import org.eclipse.jdt.annotation.NonNull; public class BookServiceImpl implements BookService { @Override public @NonNull Book getBook(Long id) { return new BookImpl(); //error "Type mismatch: cannot convert from BookImpl to Book" } } An error occurs at the statement return new BookImpl(); that reads Type mismatch: cannot convert from BookImpl to Book. What is the cause of this error and how to solve it? Additional Detail I use Java 8 and Eclipse Java EE IDE for Web Developers, version: Kepler Service Release 2. Update I have try eclipse Luna M7 Release (4.4.0M7) and no error appear. The problem is likely because an eclipse's bug and it seem to be fixed in the new version as mentioned by @user3580294 in the comments below.
has comment: http://stackoverflow.com/comment/36480832

http://stackoverflow.com/q/23748942
has answer: http://stackoverflow.com/a/23748963
tagged with: mouseevent
has title: possible lossy conversion from long to int?
tagged with: random
answer count: 3
has answer: http://stackoverflow.com/a/23748970
duplicate of: http://stackoverflow.com/q/51632152
favorite count: 0
tagged with: colors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23748962
score: 2
linked to: http://stackoverflow.com/q/51632152
tagged with: java
downvote count: 3
type: Question
upvote count: 5
has body: I have this program that is pretty much a calculator but with a moving JLabel that is supposed to change colors every time you click the label, but i have 3 errors at the very bottom of the code that i have marked with a comment. all three are: error: incompatible types: possible lossy conversion from long to int public class TestCalculator { private ResultPane resultPane; public static void main(String[] args) { new TestCalculator(); } public TestCalculator() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); resultPane = new ResultPane(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setGlassPane(resultPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new CalculatorPane(resultPane)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setBounds(200,200,500,400); } }); } public class ResultPane extends JPanel { private JLabel result; private Timer timer; private int xDelta = (Math.random() &gt; 0.5) ? 1 : -1; private int yDelta = (Math.random() &gt; 0.5) ? 1 : -1; public void setLabelForeground(Color color) { result.setForeground(color); } public ResultPane() { setOpaque(false); setLayout(null); result = new JLabel(); Font font = result.getFont(); font = font.deriveFont(Font.BOLD, 26f); result.setFont(font); add(result); HandlerClass handler = new HandlerClass(); result.addMouseListener(handler); result.addMouseMotionListener(handler); timer = new Timer(40, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Point point = result.getLocation(); point.x += xDelta; point.y += yDelta; if (point.x &lt; 0) { point.x = 0; xDelta *= -1; } else if (point.x + result.getWidth() &gt; getWidth()) { point.x = getWidth() - result.getWidth(); xDelta *= -1; }…

http://stackoverflow.com/comment/36433981
type: QuestionComment
has text: Do you have a question to ask?
score: 0
comment on: http://stackoverflow.com/q/23708178
type: Comment

http://stackoverflow.com/comment/36301075
score: 0
comment on: http://stackoverflow.com/q/23618135
type: QuestionComment
type: Comment
has text: @will yeah i understand, I will just try and fix what i have in my code. I'm running out of time and have other projects to do. Wish i got his shell earlier. Thanks for your help anyway though.

http://stackoverflow.com/comment/36434161
score: 0
type: AnswerComment
has text: so you got your thing working, with the link provided.
type: Comment
comment on: http://stackoverflow.com/a/23707913

http://stackoverflow.com/q/23637381
tagged with: loops
type: Question
tagged with: do-while
has body: I didn't find any practical use of do-while loop. As a studied we don't have control over the do-while loop when it executes for the first time and everything which can be done with do-while loop, can be don with while or for loop (assuming). My Question is: Is there any situation where we use a do-while loop, or any particular situation where it gives more reliable results as compared to for and while loops?
favorite count: 0
has title: Why do we use do-while loop when there are better loops available?
has comment: http://stackoverflow.com/comment/36298491
has comment: http://stackoverflow.com/comment/36297861
has answer: http://stackoverflow.com/a/23637418
has answer: http://stackoverflow.com/a/23637530
score: 1
has answer: http://stackoverflow.com/a/23637474
answer count: 4
upvote count: 2
has comment: http://stackoverflow.com/comment/36297518
possible better answer: http://stackoverflow.com/a/23637435
has comment: http://stackoverflow.com/comment/36297539
has comment: http://stackoverflow.com/comment/36297726
downvote count: 1
has answer: http://stackoverflow.com/a/23637435
has comment: http://stackoverflow.com/comment/36297701
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23637418
tagged with: java

http://stackoverflow.com/a/23679269
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23675538
has body: org.jscience.mathematics.number.FloatingPoint initialValue = org.jscience.mathematics.number.FloatingPoint.valueOf("145.123456789"); org.jscience.mathematics.number.FloatingPoint divideWith = org.jscience.mathematics.number.FloatingPoint.valueOf("3"); org.jscience.mathematics.number.FloatingPoint result = initialValue.divide(divideWith); System.out.println(result.doubleValue() ); org.jscience.mathematics.number.FloatingPoint finalResult = result.times(divideWith); System.out.println(finalResult.doubleValue() );
answers question: http://stackoverflow.com/q/23675538

http://stackoverflow.com/comment/36460340
type: Comment
score: 2
has text: You mean like a `HashSet`?
comment on: http://stackoverflow.com/q/23722011
type: QuestionComment

http://stackoverflow.com/a/23663796
has comment: http://stackoverflow.com/comment/36425415
has comment: http://stackoverflow.com/comment/36351366
type: Answer
answers question: http://stackoverflow.com/q/23662380
has body: I'm going to guess that 'one' is in the root directory, and that therefore "/one/../" resolves to the root and "/one/../../" and "/one/../../two" are undefined.
has comment: http://stackoverflow.com/comment/36372987
score: 0
has comment: http://stackoverflow.com/comment/36392394
has comment: http://stackoverflow.com/comment/36389568

http://stackoverflow.com/q/23626154
linked to: http://stackoverflow.com/q/8258244
tagged with: java
tagged with: image
has answer: http://stackoverflow.com/a/23626208
score: 0
answer count: 2
has body: OK guys, so I'm trying to compile my game into a jar file, but I can't get the loading of images to work. When run from NetBeans, all is fine. But in the JAR, the URL is always null. Here is the code I'm using: URL url = this.getClass().getResource("/textures/Lava.jpg"); BufferedImage sourceImage = null; try { sourceImage = ImageIO.read(url); } catch(IOException e) { System.out.println(e.getMessage()); } I have tried unziping the JAR and checking the contents, my textures folder is there and the images inside also. Any ideas what I'm doing wrong?
tagged with: jar
linked to: http://stackoverflow.com/q/403256
has answer: http://stackoverflow.com/a/23626182
has title: Accesing resources in a JAR
duplicate of: http://stackoverflow.com/q/403256
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2393194
tagged with: javax.imageio
type: Question

http://stackoverflow.com/q/23746551
tagged with: java
has title: GWT compilation failed
has comment: http://stackoverflow.com/comment/36530792
has comment: http://stackoverflow.com/comment/36509492
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23765548
has comment: http://stackoverflow.com/comment/36507085
has body: I am developping a GWT Application and when I was about to compile I got a message "GWT Compilation Failed" without any stacktrace. Then I've tried something even simpler, like creating the sample application and I've got "Creation of element failed. Reason: Invocation of com.google.gwt.user.tools.WebAppCreator failed". I did a lot of research and tried a lot of stuff (change folder permissions, deactivate antivirus, changed version of eclipse and gwt, checked windows event logger (found nothing), recreate workspace, remove ClassPath environment variavble...). The most weird thing is that in my personal computer everything works fine, but copying the eclipse folder to my work's computer I get always the same problems. This is the .log from eclipse. !ENTRY org.eclipse.jdt.ui 4 10001 2014-05-19 17:07:17.829 !MESSAGE Internal Error !STACK 1 Java Model Exception: Core Exception [code 0] Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details. at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:50) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5204) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.core.runtime.CoreException: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details. at com.google.gwt.eclipse.core.runtime.tools.WebAppProjectCreatorRunner.createProject(WebAppProjectCreatorRunner.java:70) at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.createGWTProject(WebAppProjectCreator.java:683) at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.create(WebAppProjectCreator.java:292) at com.google.gdt.eclipse.sui…
has comment: http://stackoverflow.com/comment/36509777
has comment: http://stackoverflow.com/comment/36507330
answer count: 1
accepted answer: http://stackoverflow.com/a/23765548
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/36509959
tagged with: gwt
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/23678974
score: 1
accepted answer of: http://stackoverflow.com/q/23665048
upvote count: 1
has comment: http://stackoverflow.com/comment/36415775
has body: Where did you get 1.3 for a version? The latest is 2.12.1.
has comment: http://stackoverflow.com/comment/36445462
answers question: http://stackoverflow.com/q/23665048
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36382325

http://stackoverflow.com/comment/36386674
type: Comment
type: QuestionComment
score: 1
has text: This is very unclear. Perhaps if you provided some examples what you're trying to do with the data it would help.
comment on: http://stackoverflow.com/q/23683126

http://stackoverflow.com/a/23670424
has body: you do not need the root variable in ContactList. if a Contact is a Node you can assign it easily in Constructor or other methods of super-class Tree: public class Tree { Node root; public Tree(Node root) { this.root = root; } public void insert( String x ) { root = insert( x, root ); } } and for ContactList: public class ContactList extends Tree { public ContactList(Contact contact) { super(contact); } ... } assuming that Contact extends Node. now when you call the inherited method on a ContactList instance, the Contact instance will be used. ContactList list = new ContactList(new Contact(...)); list.insert("X"); but if you want to remove inheritance relation between Contact and Node, you should use Java Generic : public class Tree&lt;T&gt; { T root; public void insert(T node) { ... } } and then: Tree contactTree = new Tree&lt;Contact&gt;(); ... contactTree.insert(Contact c);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23669516

http://stackoverflow.com/comment/133260031
type: Comment
has text: Another way in kotlin is to do: `val rates = restTemplate.exchange("https://bitpay.com/api/rates", HttpMethod.GET, null, Array<Rate>::class.java).body!!`
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/71940625

http://stackoverflow.com/q/23761937
tagged with: ajax
score: 0
has title: How do I efficiently persist checkbox selections, in a java web app with front controller pattern?
has answer: http://stackoverflow.com/a/23763589
has body: There are several questions and answers about persisting checkbox selections when leaving or updating a web page, but the majority of them are a lot more complicated to execute, considering the code structure of my web app. What I got: A Java web application, that follows the front controller pattern. All URL's are intercepted by the front controller, which in turn finds a relevant action based on a strategy pattern, and executes an update, before redirecting to a new page, or the old one. One of a handful pages got three categories of checkboxes, which toggles visibility of page elements. each category has about 4-6 single checkboxes. What I Need: An efficient way to persist the users selected checkboxes, when navigating away from the site. Wether it is cookies or sessions is arbitrary. It does not really matter if the data is saved for a short or a long period of time, but at least for each session. What I've tried: Basic tutorials with Ajax, to send updates on every change of a checkbox. However, they base themselves upon communicating with their own servlet, which is not compliant with the Front Controller pattern ideology that intercepts all URL's. Cookies. However I do not know the scope of a cookie, or how I should use them. IE if i should use one cookie for the entire selection, or one cookie for each category of checkboxes. Directly setting a session variable in Javascript, which is not possible due to the server-side/client-side conflict. Sending an individual call to the front controller servlet every time a checkbox changes, which works, but might result in a vast number of server calls, which I think is unnecessary. I have a feeling that Ajax is the way to go here, but all solutions that are more efficient than my current working solution are very welcome. I am sorry that I cannot post any sample code, due to the fact that the webapp is being developed on my localhost, and cannot be accessed from outside.
type: UnansweredQuestion
tagged with: cookies
tagged with: session
tagged with: java
type: Question
answer count: 1
tagged with: javascript

http://stackoverflow.com/comment/36437651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23709980
score: 0
has text: display method runs after `setAdListener` so you get NPE on `interstitial.setAdListener` because `interstitial` not initialized in your code, you need initialize `interstitial` first, then use that

http://stackoverflow.com/comment/36494609
has text: So for example this ACK message could be time the message was sent, right? If the client receives the message, sends the same time message to server and this way the server knows that the message was received. The problem is that I can't easily modify the client.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23739088
score: 0

http://stackoverflow.com/q/23737528
duplicate of: http://stackoverflow.com/q/4485716
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/779519
tagged with: file
type: Question
possible better answer: http://stackoverflow.com/a/23737684
answer count: 2
linked to: http://stackoverflow.com/q/4485716
has answer: http://stackoverflow.com/a/23737684
upvote count: 1
has title: why doesnt file.delete() work?
has answer: http://stackoverflow.com/a/23737694
accepted answer: http://stackoverflow.com/a/23737694
has comment: http://stackoverflow.com/comment/36490065
duplicate of: http://stackoverflow.com/q/779519
favorite count: 0
linked to: http://stackoverflow.com/q/1729049
type: AnsweredQuestion
has body: I have a directory named "madhura" and i am trying to delete it.Directory "madhura" contains another directory "anyname" and a text file."anyname " also contains a directory.There is no error given by the code i have written ,however nothing is deleted. please help me with the issue Code: package testjava; import java.io.File; import java.io.IOException; public class DeleteDirectory { public static void main(String args[]) { File f = new File("C:\\madhura"); try { deleteDirectory(f.list()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void deleteDirectory(String[] path) throws Exception { System.out.println("Inside delteDirectory"); int i=0; int count = path.length; System.out.println(path.length); while(i&lt;count) { File f = new File(path[i]); System.out.println("file "+f+" isdiretory "+f.isDirectory()); if(f.isDirectory()) { System.out.println("Inside f.isdirectory"); deleteDirectory(f.list()); f.delete(); } else{ System.out.println("deleting "+f); System.out.println(f.delete()); } i++; } } } output: Inside delteDirectory 2 file anyname isdiretory false deleting anyname false file New Text Document.txt isdiretory false deleting New Text Document.txt false

http://stackoverflow.com/comment/36516403
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23751411
has text: What date/time is 083752 intended to represent?

http://stackoverflow.com/a/62785871
has body: This is a bit hacky and probably slow, but you can easily override toString() for a lambda using a Proxy. For non-toString() calls, simply call method.invoke(lambda, args). Then for toString(), return your desired string representation. Here's a simple static utility method that can add toString() to any lambda or interface: private static <T> T addToStringBehavior( final T t, final Function<T, String> toString) { final Class<?> aClass = t.getClass(); return (T) Proxy.newProxyInstance( aClass.getClassLoader(), aClass.getInterfaces(), (proxy, method, args) -> { if (method != null && "toString".equals(method.getName()) && (args == null || args.length == 0)) { return toString.apply(t); } return method.invoke(t, args); }); } You can use it like so: public static void main(final String[] args) { final Supplier<String> lambda = () -> "test"; System.out.println(lambda); final Supplier<String> lambdaWithToString = addToStringBehavior(lambda, (l) -> l.get()); System.out.println(lambdaWithToString); System.out.println(lambdaWithToString.get().equals(lambda.get())); } The above calls will output the following: Main$$Lambda$14/0x0000000800066840@65c7a252 test true Warning: it's likely that proxying a lambda like this will be much slower than using the lambda directly, so this may not be appropriate to use in production environments where performance is a concern. But for debugging purposes (or in tests which was where I needed it), this solution works great and basically removes the need for duplicate/boilerplate code when you need a lambda to override/implement toString().
type: Answer
answers question: http://stackoverflow.com/q/23628631
has comment: http://stackoverflow.com/comment/128460758
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/23687087
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/53604310
tagged with: jpa
downvote count: 0
has body: I have a hibernate entity Super Class: @MappedSuperclass public abstract class Pojo_Entity_SuperClass { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="ID", unique=true, nullable=false, precision=18, scale=0) protected long id; public Long getId() {return id;} //Other entity fields and methods } Next I inherite other entity classes like this: @Entity @Table(name="USR") public class Usr extends Pojo_Entity_SuperClass { //Columns, fileds and others } But in some cases I want to inherit entity with "id" field without @GeneratedValue annotation. The question is - how to disable @GeneratedValue annotation for id in child class ?
favorite count: 0
has answer: http://stackoverflow.com/a/23693791
linked to: http://stackoverflow.com/q/594597
type: UnansweredQuestion
tagged with: hibernate-mapping
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate
tagged with: orm
has title: How to not inherite Id GeneratedValue in hibernate (disable @GeneratedValue in child class)

http://stackoverflow.com/comment/36295696
score: 0
comment on: http://stackoverflow.com/q/23634696
type: QuestionComment
type: Comment
has text: @ashishduh Isn't `temptv.setWidth()` and `temptv.setHeight()` define the size of the TextView only, while the radius of the circle is set by `<corners android:radius="25dip"/>` in the XML file?

http://stackoverflow.com/comment/36335573
has text: Are you running a local web server?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23656615

http://stackoverflow.com/comment/36429024
comment on: http://stackoverflow.com/a/23705004
type: AnswerComment
has text: I don't think this answers the question, which seems to be can you put an environment variable in the value="" clause? I get the impression from the above that the answer is no, but it never answers the question directly.
type: Comment
score: 0

http://stackoverflow.com/q/23651636
downvote count: 0
accepted answer: http://stackoverflow.com/a/23653959
tagged with: collections
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23653959
score: 1
has title: How to iterate over ContentMap in jsp in magnolia
tagged with: java
tagged with: loops
type: Question
tagged with: magnolia
upvote count: 1
answer count: 1
tagged with: jsp
has body: I am new to Magnolia CMS and now I have some problems with iterating over ContentMap on my jsp I want my page to display respectively link and linkText. JSTL tags like forEach don't work in this case, e.g. I type &lt;c:forEach items="${content.events}" var="item"&gt; &lt;a href="${item.link}" target="_blank"&gt;${item.linkText}&lt;/a&gt; &lt;/c:forEach&gt; Thus my question is what is the correct way of iterating contentMap in Magnolia?
favorite count: 0

http://stackoverflow.com/q/23770539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36554630
upvote count: 1
tagged with: http
has comment: http://stackoverflow.com/comment/36554439
tagged with: chunked-encoding
has body: I am trying to make a proxy server which caches request and response. For response header which says transfer-encode: chunked How do I allocate memory for this type of response ? I tried using byte[chunksize] and reading the chunk, but the size is characters and not bytes. Also please help me how can I send the normal response body in this format. Resources: http://en.wikipedia.org/wiki/Chunked_transfer_encoding
has comment: http://stackoverflow.com/comment/36553951
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36554466
has title: reading chunked response body
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36554449
answer count: 0

http://stackoverflow.com/q/23644090
tagged with: http
type: Question
score: 1
tagged with: java
tagged with: jetty-9
has body: We have an application REST gateway deployed over jetty 9.0.3 server.For authentication and authorization of services deployed in jetty is taken care by apache commons-httpclient3.1. when there are huge number of concurrent threads hitting Rest gateway, lot of CLOSE_WAIT are piling up in REST gateway machine. Http connections which are opened for sending request to enabler(END POINT)are closed properly by calling releaseConnections method of apache commons. Please let me know how to handle these CLOSE_WAIT or any clues why connections are ending up in CLOSE_WAIT.
has answer: http://stackoverflow.com/a/23644173
answer count: 2
upvote count: 1
tagged with: apache
accepted answer: http://stackoverflow.com/a/23752686
favorite count: 0
has answer: http://stackoverflow.com/a/23752686
has title: Too many Close_wait in jetty 9.0.3
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23644173
downvote count: 0

http://stackoverflow.com/a/23629123
upvote count: 3
has body: You can override this behavior with @XmlSchemaType(name="date") annotation. Javadoc Maps a Java type to a simple schema built-in type.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23623400
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23623400
type: Answer

http://stackoverflow.com/a/23625466
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23622189
upvote count: 1
has body: /* means every public request to your web-app. It means for your jsp it should be public accessed, since it is in WEB-INF and not public it will give error. If you use only / it means server took the request and the web-app processes it internal without any public access.
type: Answer

aspose
tags question: http://stackoverflow.com/q/23683732
type: Tag
tag name: aspose

http://stackoverflow.com/q/23653273
type: Question
tagged with: jira-rest-java-api
has answer: http://stackoverflow.com/a/29484188
tagged with: java
has answer: http://stackoverflow.com/a/23771868
tagged with: jira
answer count: 2
tagged with: jql
accepted answer: http://stackoverflow.com/a/23771868
type: AnsweredQuestion
score: 0
tagged with: jira-rest-api
has title: get all issues stored in jira
has body: hi i want to get all issues stored in jira from java using jql or any othere way. i try to use this code: for(String name:getProjectsNames()){ String jqlRequest = "project = \""+name+"\""; SearchResult result = restClient.getSearchClient().searchJql( jqlRequest, 10000,0, pm); final Iterable&lt;BasicIssue&gt; issues = result.getIssues(); for (BasicIssue is : issues) { Issue issue = restClient.getIssueClient().getIssue(is.getKey(), pm); ........... } it give me the result but it take a very long time. is there a query or a rest API URL or any other way that give me all issues? please help me
possible better answer: http://stackoverflow.com/a/29484188

http://stackoverflow.com/q/23672341
has answer: http://stackoverflow.com/a/23672635
tagged with: java
has answer: http://stackoverflow.com/a/23672562
has body: I am using the following code to get the screen brightness. private static int getBrightness(Context context) { try { int brightness = Settings.System.getInt(context.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS); return brightness; } catch (Exception e) { } return 0; } This code gives me the current brightness = 102 (which is correct). But I need to set the default brightness mode to 'auto'. How do I do that?
type: Question
tagged with: brightness
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23672562
has title: Set default screen brightness to 'auto'
tagged with: android
possible better answer: http://stackoverflow.com/a/23672635
type: AnsweredQuestion

http://stackoverflow.com/comment/36420399
comment on: http://stackoverflow.com/q/23701113
score: 0
type: Comment
has text: i don't understand your question very well? you want that the text being selected even if the user input a new value? if it's that you can use a `DocumentListener` to do that.
type: QuestionComment

http://stackoverflow.com/comment/36348420
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23662271
has text: Thank you for your detailed explanation, I have run some tests and indeed if I where to do GetNameExcists(null) (when making sure the variable is empty) then it does indeed just keep on going till inside that method, I didn't know java behaved this way but thats something that I will keep in mind in futher debugging problems.
score: 0

http://stackoverflow.com/comment/36343250
comment on: http://stackoverflow.com/q/23660161
has text: yes, have tried that as well, but still does not work. thanks
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36427281
type: Comment
type: QuestionComment
has text: I really don't understand your question, but for information about the `EDT` I suggest you read the section from the Swing tutorial on [Concurrency](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html).
score: 2
comment on: http://stackoverflow.com/q/23704493

http://stackoverflow.com/comment/36483533
comment on: http://stackoverflow.com/a/23732657
type: AnswerComment
score: 0
type: Comment
has text: Maybe you're using an old version of iText.

http://stackoverflow.com/comment/36510905
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23748266
has text: @user2864740: `"" + n`, however, will create at least two additional objects in the background, rather than just generate the string directly. Just because it's shorter to type doen't make it correct...
type: AnswerComment

http://stackoverflow.com/comment/36486446
type: AnswerComment
has text: thank you so much your answer is useful for me now my code is working :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23735151

http://stackoverflow.com/q/23770579
type: UnansweredQuestion
tagged with: java
has title: FB login authentication mechanics
has answer: http://stackoverflow.com/a/23772892
tagged with: authentication
tagged with: facebook-login
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23771814
has body: I read online and understand how to use the FB connect and how to create an app that uses the fb login. What I want to know is whether it is possible to manipulate the data between the authentication. So here's what I am confuse about. So we have FB server my application my server. So when I open my application, my application will ask for fb login and pw, we send those info to FB server. The FB server then give my application a token, then my application will send the token to my server, then my server will verify with FB server? Is this how it works? If that's the way it works why there's no hacking in FB login, can't people make fake tokens?

http://stackoverflow.com/q/23670029
answer count: 1
score: 0
tagged with: heap-memory
tagged with: out-of-memory
duplicate of: http://stackoverflow.com/q/717550
has body: I am using netbeans 7.4 and jdk 7.update 45. windows server system with 4GB RAM. I have done a Application where i am creating more no. of vector objects for storing purpose. Now my problem here is, After turning on system, when i start Netbeans IDE and opening a project, here i din't even run a project , only netbeans IDE is not responding . rest of the process in the system are running fine. i reinstalled netbeans IDE also but problem still exists. I want to known whether problem is in my application or with system.
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23670249
has comment: http://stackoverflow.com/comment/36362317
linked to: http://stackoverflow.com/q/717550
has title: how to solve outofmemory java heap space for netbeans
tagged with: java
type: Question

http://stackoverflow.com/q/23667199
tagged with: web
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25753813
score: 3
downvote count: 0
tagged with: java
has body: I have the following method that renders a list of users on the template, but I got a 500 Internal Error when firing up Spark in IntelliJ. private void renderTemplate() throws IOException, TemplateException { List<String> users = new ArrayList<>(); users.add("John Doe"); users.add("Tony Doe"); get("/admin", (request, response) -> { return new ModelAndView(users, "spark/template/freemarker/admin_template.ftl"); }, new FreeMarkerEngine()); } The content of my admin_template.ftl is: Administration My Admin <#list users as user> $user </#list> Does anyone know how to render the list on freemarker template? thanks for replies!
has title: Rendering a List on Freemarker template from Spark web Framework
has comment: http://stackoverflow.com/comment/58525146
type: Question
tagged with: frameworks
tagged with: spark-java
upvote count: 3
tagged with: freemarker
linked to: http://stackoverflow.com/q/14749623
answer count: 1

http://stackoverflow.com/comment/36494342
comment on: http://stackoverflow.com/q/23739557
has text: What I mean is that Eclipse is telling me in this case that "enum" is a reserved keyword. It doesn't seem to recognize that I want to use enum. So I am not sure if I am using enums correct or if it's eclipse fault.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36342809
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23660096
has text: @DirkyJerky There is no compilation error but I don't think it execute my command.

http://stackoverflow.com/a/23705509
has body: "How should I force next() method not to step forward if there's no row returned?" That's what it does, rs.next() will be false in such case.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23705381
has comment: http://stackoverflow.com/comment/36436681
has comment: http://stackoverflow.com/comment/36449779

http://stackoverflow.com/a/23734952
score: 1
accepted answer of: http://stackoverflow.com/q/23734354
has body: You need to append the timestamp to the filename, at best right before the extension. Note that operating systems may not allow some characters to appear in a filename, for example the colon and the slash may not be use on windows, so yo need to find a substitue for them. Also you need to check the return value of renameTo to check whether the file was realy moved or not. returns true if and only if the renaming succeeded; false otherwise You could try something like this: public static void main(String[] args) { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); String ts = dateFormat.format(date); File source = new File("D:\\A1\\"); File dest = new File("D:\\A2\\"); for (File file : source.listFiles()) { String x = (source + "\\" + file.getName()); String y = (dest + "\\" + addTimestamp(file.getName(), ts)); File f1 = new File(x); if(f1.renameTo(new File(y))){ System.out.println("moved: " + y); } else { System.out.println("unable to move: " + y); } } } private static String addTimestamp(String name, String ts) { int lastIndexOf = name.lastIndexOf('.'); return (lastIndexOf == -1 ? name + "_" + ts : name.substring(0, lastIndexOf) + "_" + ts + name.substring(lastIndexOf)) .replaceAll("[\\/:\\*\\?\"&lt;&gt;| ]", "_"); } Finally for moving files better use Files#move as the javadoc of renameTo itself suggests.
answers question: http://stackoverflow.com/q/23734354
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23634909
has answer: http://stackoverflow.com/a/23635111
tagged with: collections
answer count: 1
score: -6
tagged with: java
tagged with: indexoutofboundsexception
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23635111
upvote count: 0
has comment: http://stackoverflow.com/comment/36292602
has comment: http://stackoverflow.com/comment/36292877
has title: Reflection - Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
has body: The below is the code I tried to work from Oracle for understanding Reflection. I am getting the following error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at classdeclarationspy.ClassDeclarationSpy.main(ClassDeclarationSpy.java:29) Please help solving this error. /** * * @author 113282 */ public class ClassDeclarationSpy { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try { Class&lt;?&gt; c = Class.forName(args[0]); out.format("Class:%n %s%n%n", c.getCanonicalName()); out.format("Modifiers:%n %s%n%n", Modifier.toString(c.getModifiers())); out.format("Type Parameters:%n"); TypeVariable[] tv = c.getTypeParameters(); if (tv.length != 0) { out.format(" "); for (TypeVariable t : tv) out.format("%s ", t.getName()); out.format("%n%n"); } else { out.format(" -- No Type Parameters --%n%n"); } out.format("Implemented Interfaces:%n"); Type[] intfs = c.getGenericInterfaces(); if (intfs.length != 0) { for (Type intf : intfs) out.format(" %s%n", intf.toString()); out.format("%n"); } else { out.format(" -- No Implemented Interfaces --%n%n"); } out.format("Inheritance Path:%n"); List&lt;Class&gt; l = new ArrayList&lt;Class&gt;(); printAncestor(c, l); if (l.size() != 0) { for (Class&lt;?&gt; cl : l) out.format(" %s%n", cl.getCanonicalName()); out.format("%n"); } else { out.format(" -- No Super Classes --%n%n"); } out.format("Annotations:%n"); Annotation[] ann = c.getAnnotations(); if (ann.length != 0) { for (Annotation a : ann) out.format(" %s%n", a.toString()); out.format("%n"); } else { out.format(" -- No Annotations --%n%n"); } // production code should handle this exception more gracefully } catch (ClassNotFoundException x) { if (args.length == 0) { throw new IllegalArgumentException("year is required"); } } } private static void printAncestor(Class&lt;?&gt; c, List&lt;Class&gt; l) { Class&lt;?&gt; ancestor = c.getSuperclass(); if (ancestor != null) { l.add(ancestor); prin…
favorite count: 0
type: Question
downvote count: 6
tagged with: reflection

http://stackoverflow.com/q/23735734
answer count: 3
has answer: http://stackoverflow.com/a/23735838
favorite count: 0
has comment: http://stackoverflow.com/comment/36486486
upvote count: 0
type: UnansweredQuestion
has body: I found the following JVM argument in my working environment -Xms12288m This specifies initial heap size -Xmx12288m This specifies max heap size one doubt here, If it reaches beyond this it will throw exception(Out of memory) ? -Xns:3g what is this argument specifies? Thanks in advance
linked to: http://stackoverflow.com/q/19864293
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/36486894
has answer: http://stackoverflow.com/a/23735830
tagged with: java
has title: what is the use of -Xns option
has comment: http://stackoverflow.com/comment/36486832
type: Question
score: -2
has answer: http://stackoverflow.com/a/23736520
downvote count: 2

http://stackoverflow.com/comment/61962877
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23633032
has text: If I want it to use the JSON resolver for all requests, not just the `application/json` ones, then what should I do?
type: Comment

http://stackoverflow.com/a/23648888
has comment: http://stackoverflow.com/comment/36326476
answers question: http://stackoverflow.com/q/23648643
has comment: http://stackoverflow.com/comment/36321729
has body: @Roman Bondar I guesss OP wanted to know more than just the setting. Basically, JREs are meant to be downwards compatible, so that you are able to execute java classes compiled with version 6 with a runtime from java 7. But as always, there may be special cases when things have to be changed, e.g. container or libraries. I remember a case back when I migrated to java 6 that it required a special version of JBoss. Check out this Oracle blog as a starting point.
type: Answer
has comment: http://stackoverflow.com/comment/36320754
has comment: http://stackoverflow.com/comment/36320436
score: 0
has comment: http://stackoverflow.com/comment/36321819

http://stackoverflow.com/q/23636368
has answer: http://stackoverflow.com/a/75275123
has title: How to disable spring-security login screen?
downvote count: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/51908496
favorite count: 0
has answer: http://stackoverflow.com/a/77116756
has answer: http://stackoverflow.com/a/77291688
has answer: http://stackoverflow.com/a/69351853
has answer: http://stackoverflow.com/a/23648756
tagged with: spring
has answer: http://stackoverflow.com/a/76173480
has body: I'm using spring-boot-starter-security dependency, to make use of several classes that come with spring-security. But as I want to integrate it in an existing vaadin application, I only want to make use of the classes, and not of the default login/auth screen of spring. How can I disable this screen? I cannot make any configurations by extending WebSecurityConfigurerAdapter as my main entry class already extends SpringBootServletInitializer. Also, vaadin applications basically run on the same URL path all the time and use internal navigation. @EnableAutoConfiguration public class MyApp extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(MyApp.class); } public static void main(String[] args) { SpringApplication.run(MyApp.class, args); } } So, what could I do to disable the login screen, but though make use of spring security features?
has answer: http://stackoverflow.com/a/74585909
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/73081927
has answer: http://stackoverflow.com/a/76778447
upvote count: 73
has answer: http://stackoverflow.com/a/70298042
type: Question
has answer: http://stackoverflow.com/a/71390629
tagged with: spring-boot
has answer: http://stackoverflow.com/a/55913967
score: 73
possible better answer: http://stackoverflow.com/a/46155567
has answer: http://stackoverflow.com/a/59337338
has answer: http://stackoverflow.com/a/57046306
accepted answer: http://stackoverflow.com/a/23648756
has answer: http://stackoverflow.com/a/56483549
has answer: http://stackoverflow.com/a/46155567
tagged with: vaadin
has answer: http://stackoverflow.com/a/78308113
answer count: 19
has answer: http://stackoverflow.com/a/75064259

http://stackoverflow.com/a/23672570
type: Answer
answers question: http://stackoverflow.com/q/23672279
has comment: http://stackoverflow.com/comment/36367537
has comment: http://stackoverflow.com/comment/36368456
score: 1
has body: Have a look to this answer https://stackoverflow.com/a/20948389/1897572 Just wondering, why between -128 and 127? A larger range of integers may be cached, but at least those between -128 and 127 must be cached because it is mandated by the Java Language Specification (emphasis mine): If the value p being boxed is true, false, a byte, or a char in the range \u0000 to \u007f, or an int or short number between -128 and 127 (inclusive), then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2. The rationale for this requirement is explained in the same paragraph: Ideally, boxing a given primitive value p, would always yield an identical reference. In practice, this may not be feasible using existing implementation techniques. The rules above are a pragmatic compromise. The final clause above requires that certain common values always be boxed into indistinguishable objects. [...] This ensures that in most common cases, the behavior will be the desired one, without imposing an undue performance penalty, especially on small devices. Less memory-limited implementations might, for example, cache all char and short values, as well as int and long values in the range of -32K to +32K. How can I cache other values outside of this range.? You can use the -XX:AutoBoxCacheMax JVM option, which is not really documented in the list of available Hotspot JVM Options. However it is mentioned in the comments inside the Integer class around line 590: The size of the cache may be controlled by the -XX:AutoBoxCacheMax=&lt;size&gt; option. Note that this is implementation specific and may or may not be available on other JVMs.
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/23747985
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23756461
has body: I have an android activity that shows three spinners. The same three have equal information to choose, because you are supposed to choose three things among five. what I want to do is display the information based on what is selected now. For example if in the first spinner I selected "Coins" I do not want to be able to select coins in the two spinners left, if in the second spinner you selected "Capital" I don't want to show either capital and coins in the last one. this is my xml for the activity: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/typeDrinks" style="@style/textStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Select three question for ask" android:textSize="22sp" /> <Spinner android:id="@+id/spinner_type1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="8sp" android:gravity="center" /> <TextView android:id="@+id/textRangeOfPrices" style="@style/textStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/linearLayout1" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:background="#449def" android:gravity="center" android:text="Select another one" android:textSize="22sp" /> <Spinner android:id="@+id/spinner_type2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="8sp" android:gravity="center" /> <TextView android:id="@+id/textViewDistance" style="@style/textStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/linearLayout2" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:background="#449def" android:gravity="center" android:text="The last one" android:textSize="22sp" /> <Spinner android:id="@+id/spinner_type3" android:layout_width="fill_parent" android:layo…
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23751000
answer count: 2
tagged with: android-spinner
accepted answer: http://stackoverflow.com/a/23756461
possible better answer: http://stackoverflow.com/a/23751000
has title: How to save the display information between spinners android
tagged with: android

http://stackoverflow.com/q/23641079
accepted answer: http://stackoverflow.com/a/23641161
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36305263
tagged with: constructor
has comment: http://stackoverflow.com/comment/36305342
has body: I have a Super class and some Sub class that extend the super class. Every sub class have some constructor methods that accept a type of any Sub type. abstract class Super {} final class Sub1 extends Super { public Sub1(Sub1 arg) {} //... public Sub1(Sub4 arg) {} } //... final class SubN extends Super { public SubN(Sub3 arg) {} //... public SubN(SubN arg) {} } } Now I want to create a method in the Super class to cast from one Sub type to another. Let's say public Super cast(Super arg) { if (arg instanceof Sub1) { return new Sub1(this); } else if (arg instanceof Sub2) { return new Sub2(this); }//... return null; } It would be stupid to repeat this pattern for all the sub classes. A solution that I found out is this one (using reflection) but is too slow. public Super cast(Super arg) { try { Class&lt;? extends Super&gt; type = arg.getClass(); return type.getConstructor(this.getClass()).newInstance(this); } catch (Exception e) { return null; } } Are there alternatives?
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36305304
score: 0
tagged with: casting
has comment: http://stackoverflow.com/comment/36305220
tagged with: runtime
answer count: 1
has answer: http://stackoverflow.com/a/23641161
has title: Java runtime subtype constructor call

http://stackoverflow.com/comment/36478800
type: Comment
comment on: http://stackoverflow.com/a/23731469
type: AnswerComment
has text: I would replace `Math.pow(n, 2)` with `n*n` since `n` is an integer and for small powers, the unrolled version is more readable. Furthermore since `n` is an integer, it will be more efficient (otherwise `2` must always be interpreted first, etc.).
score: 0

http://stackoverflow.com/comment/36361066
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23656013
has text: I am able to get user's windows login user name .. yes we are using ladp for authentication.. but again how to bypass authentication in my java application ..
type: AnswerComment

http://stackoverflow.com/comment/36536780
has text: @ fadedreamz so the value of the args inside the `CallStaticObjectMethod ` is fine?This souldn't contain somehow me filepath instead of this weird value?
comment on: http://stackoverflow.com/q/23757428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23713884
has comment: http://stackoverflow.com/comment/36445380
has title: Caching in a JSP Spring MVC application
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36444450
tagged with: spring
has comment: http://stackoverflow.com/comment/36445155
tagged with: java
has body: I am a beginner in developing JSP/web applications and I've gotten to the point where I'm thinking about implementing some kind of caching in my application but I don't exactly know how to do this. I've worked on and Android app before we I did caching and just saved data to SQLite and did a quick SQL count query to the server's table to see if the count returned was the same to what was in SQLite. If it was then no new data has been updated on the server, if that count was different then add it to the SQLite table (normally this was a small number of record increases). So that was quite easy and self explanatory. However, I don't know what rules to follow when doing this in a web application that uses JSP and the Spring MVC framework. I am also using Tomcat as my test sever. Is there some location where I can save things and grab them later? Or is this not the appropriate way to do things? Someone who has more experience than myself, give me some advice or wisdom. I would certainly appreciate it and would love to learn more on this subject! Also please don't mark this question as nonconstructive. This application is for work and needs to be completed in a certain time frame. I am aware there are some nifty tools and helpers out there such as Squid.
type: Question
has answer: http://stackoverflow.com/a/23715670
has comment: http://stackoverflow.com/comment/36446169
has comment: http://stackoverflow.com/comment/36445196
score: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/36378000
has text: In that case my answer won't do, it also describes N queues. I asked a similar question before: see http://stackoverflow.com/q/21491215/1341546 - unfortunately, no answers.
type: AnswerComment
comment on: http://stackoverflow.com/a/23670547
score: 0
type: Comment

http://stackoverflow.com/a/23742404
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36503965
downvote count: 0
has body: General comments: Use reasonable variable names if you want people to take the time to read your code. "b1", "l1" mean nothing. Get rid of all the setBounds() statements. Your panel uses a FlowLayout and the FlowLayout will determine the size/location of the components. It doesn't appear the next time I type anything to search. You are adding the table to the CENTER of the BorderLayout. So you now have two tables displayed in the CENTER. Swing paints the tables in reverse order to how the table were added. So the second table gets painted first, and the first table added gets painted second. So the first table is painted on top of the second table. So you would need to remove the old scollpane first before adding the second scrollpane. However there is an easier solution. As Sergiy has already suggested just create a new TableModel and replace the TableModel in the existing table: table.setModel( theNewModel ); So really you should create the JTable and scrollpane and add it to your frame when you create the initial GUI. Then your search logic will just create a new DefaultTableModel and you update the table with the code from above. Edit: In the constructor where you create all the Swing components the basic code might be something like: mainPanel.add(topPanel, BorderLayout.PAGE_START); JScrollPane scrollPane = new JScrollPane(table); // added mainPanel.add(scrollPane, BorderLayout.CENTER); // added Now you have created and added an empty table to your GUI. The model is empty so there is nothing to display. Now in your showTableData() method you don't need to create any more Swing components, So delete all those line of code that create the scrollpane and add the scrollpane to the frame. The remaining code creates the model and adds it to the table and then adds data to the model so it should work as is. Although to be more efficient, you may want to move the table.setModel(...) statement to the end of the method so the table is only updated once after all the data…
has comment: http://stackoverflow.com/comment/36505494
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23741794
answers question: http://stackoverflow.com/q/23741794

http://stackoverflow.com/comment/36367769
has text: Thankyou, I did the ? extends A thing but had problems with the return, I had to cast it.
comment on: http://stackoverflow.com/a/23673318
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36446017
score: 0
type: Comment
type: QuestionComment
has text: v.getTag() is null then
comment on: http://stackoverflow.com/q/23714661

http://stackoverflow.com/a/23777550
answers question: http://stackoverflow.com/q/23702191
accepted answer of: http://stackoverflow.com/q/23702191
downvote count: 0
score: 1
has body: Ok, I found the problem. It's not mentioned in my question, but instances had cyclic references (intended). After removing cyclic reference it works.
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/23629325
tagged with: java
type: Question
tagged with: jasper-reports
has title: The report is not showing
score: 0
linked to: http://stackoverflow.com/q/6845231
has answer: http://stackoverflow.com/a/23629751
answer count: 1
has comment: http://stackoverflow.com/comment/36282220
type: UnansweredQuestion
has body: I have a problem with my report on project in NetBeans. Why is my report cannot viewing while I execute my project.jar but there is no problem while I debug on NetBeans? Here's the source code File file = new File("**src/Report/TIKET.jrxml**");// is this the problem? jasperDesign = JRXmlLoader.load(file); param.clear(); jasperReport = JasperCompileManager.compileReport(jasperDesign); jasperPrint = JasperFillManager.fillReport(jasperReport, param,cnn); JasperViewer.viewReport(jasperPrint, false);
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36281836

http://stackoverflow.com/a/23646986
has body: No doubt your code works even without the interface at this moment, but. Implementing an interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler. If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile. For example, if you have multiple animal classes, each implementing Animal, if later on you want to change the structure of the Animal interface, it helps you to easier change the structure of all your animal calsses. Another example, lets say you work on a group object, and the leader tells you and someone else to make some classes based on a structure given by him (the interface), implementing the interface asures that you got all the method names and structures right. If later on the leader decides that the structure of the classes isn't good, he will change the interface, forcing you to change your class. For more information, read What is an interface or Undersanding interfaces and their Usefullness
type: Answer
has comment: http://stackoverflow.com/comment/36316883
answers question: http://stackoverflow.com/q/23646745
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23646745
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/50782308
score: 0
comment on: http://stackoverflow.com/a/23945840
type: Comment
has text: Using AppiumDriver is a quite different setup; in situations where it is necessary to use RemoteWebDriver, do you know of a way to switch contexts?
type: AnswerComment

http://stackoverflow.com/comment/36524990
type: AnswerComment
comment on: http://stackoverflow.com/a/23755475
type: Comment
has text: JAR files are only containers - besides containing the types, they have otherwise nothing to do with situation, excepting the ordering in which types are searched/resolved.
score: 0

http://stackoverflow.com/comment/36385137
comment on: http://stackoverflow.com/q/23682243
type: Comment
type: QuestionComment
has text: What do you mean by _overcome_ it? Do you understand the error?
score: 1

http://stackoverflow.com/q/23640383
tagged with: java
has comment: http://stackoverflow.com/comment/36303769
type: Question
accepted answer: http://stackoverflow.com/a/23640539
has answer: http://stackoverflow.com/a/23640479
tagged with: image
has title: Program crashing when reading an image within a .jar file
answer count: 2
score: 2
possible better answer: http://stackoverflow.com/a/23640479
tagged with: jar
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23640539
type: AnsweredQuestion
has body: Ok, so I'm having a program where you can upload images of a house for rent, and the image is then copied over to a directory where all images are. Then in another window it loads all the images to presentation that I can click on. This is working perfectly fine when compiling and running through Sublime Text. But after creating a .jar file and running it, there's some problems. I can upload an image and copy it over to the image directory fine, but when I go to the other JFrame-window where all the images are supposed to be presented, it locks the program and have to be closed through task manager. Any suggestions? Here's the code when starting the program, where stock images of some houses are loaded into the main image directory for all images of houses: public void copyStockImages(String filename) { String filepath = "Images/Testimages/" + filename; BufferedImage image = null; try { image = ImageIO.read(getClass().getResource(filepath)); } catch( FileNotFoundException fnfe ){ System.out.println( "File not found: " + filepath ); } catch( IOException ioe ){ System.out.println( "Error reading image" ); } String newFilePath = "Images/houseImages/" + filename; File fileOut = new File( newFilePath ); if( fileOut.exists() ){ return; } try{ ImageIO.write( image, "jpg", fileOut ); } catch( IOException ioe ){ System.out.println( "Error reading image" ); } } Upload images: private void uploadImages(HouseForRent house) { if(filepaths.isEmpty()) { return; } Iterator&lt;String&gt; iter = filepaths.iterator(); while( iter.hasNext() ) { String filepath = i.next(); String filetype = findFiletype( filepath ); BufferedImage image = null; try { image = ImageIO.read( new File( filepath ) ); } catch( FileNotFoundException fnfe ) { dialog( "Cannon find file: " + filepath ); } catch( IOException ioe ) { dialog( "Error reading file" ); } catch(NullPointerException npe) { } try { saveImage( image, filetype, house ); } catch( IOException ioe ) { dialog( "Error reading from file: " + ioe.t…

http://stackoverflow.com/comment/36569955
comment on: http://stackoverflow.com/q/23653699
has text: `WString` is right I believe. Calling `GetLastError` directly is problematic. Sorry, I should have realised. The framework (Java runtime, JNA etc.) will call Win32 API functions in between the actual call returning, and your call to `GetLastError`. Thus the error code is lost. This question has more info: http://stackoverflow.com/questions/8413963/how-to-make-getlasterror-reliably-work-with-jna You will need to follow the advice in the answer there, which just happens to be mine!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36419729
has text: That's what I am asking in the post!! You can't have SwingWorker in one class and PropertyChangeListener in another, right? There are two different threads!
type: AnswerComment
comment on: http://stackoverflow.com/a/23700079
score: 0
type: Comment

http://stackoverflow.com/comment/36392563
comment on: http://stackoverflow.com/a/23670880
score: 0
type: AnswerComment
type: Comment
has text: @ColinD that's the thing; if `.getEncoded()` is not what is needed, you can just change the `Funnel`; if you shortcut this way, you are condemned to a refactoring if `.getEncoded()` is not what you want

http://stackoverflow.com/q/23654026
tagged with: layout-manager
has answer: http://stackoverflow.com/a/23654819
tagged with: flowlayout
has title: Adding gridLayout onto a JLabel with FlowLayout already implemented
linked to: http://stackoverflow.com/q/17874717
score: 0
has body: I need to add a grid layout with border factory under the buttons on my GUI! I have tried many different ways and none seem to work. I have put my current code underneath... public abstract class TestVehicles extends Vehicle implements ActionListener { public static void main(String[] args) { JFrame carPark = new JFrame("Car Park"); carPark.setSize(750, 750); carPark.setResizable(false); carPark.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); placeComponets(carPark); carPark.setVisible(true); } public static void placeComponets(JFrame carPark) { carPark.setLayout(new FlowLayout()); JLabel userLabel = new JLabel(""); userLabel.setBounds(750, 750, 750, 750); carPark.add(userLabel); userLabel.setBackground(Color.LIGHT_GRAY); userLabel.setOpaque(true); userLabel.setHorizontalAlignment(SwingConstants.LEFT); userLabel.setVerticalAlignment(SwingConstants.TOP); JButton addCar = new JButton("Add Car"); addCar.setBounds(10, 10, 100, 100); carPark.add(addCar); addCar.setVisible(true); ActionListener addCarButtonListener = new AddCarButtonListener(); addCar.addActionListener(addCarButtonListener); addCar.setVisible(true); JButton addLorry = new JButton("Add Lorry"); addLorry.setBounds(10, 10, 25, 25); carPark.add(addLorry); addLorry.setVisible(true); ActionListener addLorryButtonListener = new AddLorryButtonListener(); addLorry.addActionListener(addLorryButtonListener); addLorry.setVisible(true); JButton addCoach = new JButton("Add Coach"); addCoach.setBounds(10, 10, 100, 100); carPark.add(addCoach); addCoach.setVisible(true); ActionListener addCoachButtonListener = new AddCoachButtonListener(); addCoach.addActionListener(addCoachButtonListener); addCoach.setVisible(true); JPanel gridPanel = new JPanel(); JPanel gridPanelLayout = new JPanel(new GridLayout(4, 5, 10, 10)); carPark.add(gridPanelLayout); gridPanelLayout.setBackground(Color.WHITE); gridPanelLayout.setBorder(BorderFactory.createEmptyBorder(4, 4, 10, 10)); Border redBorder = BorderFactory.createLineBorder(Color.RED); …
type: UnansweredQuestion
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36356222
tagged with: java
tagged with: grid-layout
linked to: http://stackoverflow.com/q/5621338
answer count: 1

http://stackoverflow.com/q/23632574
linked to: http://stackoverflow.com/q/7187090
tagged with: java
has answer: http://stackoverflow.com/a/23632856
tagged with: eclipse
type: Question
answer count: 2
tagged with: glassfish
score: 0
has answer: http://stackoverflow.com/a/23664975
has body: I've similar question as in the link, but its didn't resolved my issue. Could someone please advise? How to register existing Glassfish server in Eclipse? I'm new to java and tried installing glassfish in IBM data studio (similar to eclipse) as in the tutorial - http://javaeenotes.blogspot.com/2010/08/glassfish-integration-in-eclipse-36.html and tried running a JSP file on the server - its showing that the username and password as incorrect. when I was pointing to GlassFish I gave the username as 'admin' and the password also same as 'admin'. How can i get thru this? Later, after downloading Java EE and now in Eclipse when I tried downloading glassfish , its not showing up in the 'additional server adapters' list. May be because its already installed. Now how can I register this existing glass fish server in Eclipse? could you please let me know how can I get thru above 2 issues? Thank you
type: UnansweredQuestion
has title: How to register existing Glassfish server and how to change username/password

http://stackoverflow.com/a/23622301
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36288335
has comment: http://stackoverflow.com/comment/36289248
downvote count: 0
answers question: http://stackoverflow.com/q/23617271
has body: The query sql1 has is defined as " SELECT a.NU_ACORDO , a.NU_MOVIMENTACAO , v.NU_CONTRATO.."- it is selecting 3 fields from Acordo, not a full instance, so JPA is giving you a list of object arrays containing the 3 values for each row. If you want full entities, change the query to be "SELECT a FROM Acordo a..." Instead.
has comment: http://stackoverflow.com/comment/36289230
type: Answer

http://stackoverflow.com/q/23686881
accepted answer: http://stackoverflow.com/a/23687546
type: Question
tagged with: java
tagged with: asynctaskloader
answer count: 1
downvote count: 0
has title: Does AsyncTaskLoader really inherit from AsyncTaskLoader?
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/23687546
tagged with: android-asynctask
tagged with: android-studio
type: AnsweredQuestion
score: 1
has body: If you highlight a class in Drodio (Android Studio) and mash Ctrl+N, it will show you the inheritance hierarchy for that class, like so for AsyncTask: This seems to indicate that AsyncTaskLoader inherits from AsyncTaskLoader? Is that so? If so, was that intentional? Or what is going on here? UPDATE My bad; I read "Ctrl+N" in the tip where it really says, "Ctrl+H". Here's what you get with the latter: (though still not just what I expected)
upvote count: 1

http://stackoverflow.com/comment/36281033
has text: Hi Gabriel, put the images in your classpath and avoid absolute references.
comment on: http://stackoverflow.com/q/23628914
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23645988
tagged with: java
tagged with: gxt
has answer: http://stackoverflow.com/a/23646124
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/23646080
score: -2
has comment: http://stackoverflow.com/comment/36314602
has comment: http://stackoverflow.com/comment/36314603
downvote count: 4
has answer: http://stackoverflow.com/a/23646183
accepted answer: http://stackoverflow.com/a/23646124
has answer: http://stackoverflow.com/a/23646054
has title: What does this represent in java?
favorite count: 0
possible better answer: http://stackoverflow.com/a/23646051
answer count: 5
has answer: http://stackoverflow.com/a/23646051
has comment: http://stackoverflow.com/comment/36314821
has body: servicesDto.setPhotospath(values.get("photospath") == null ? null :values.get("photospath").toString()); What is represented here and why is null used in this manner: '== null ? null' Note : I am Fresher please give me a such reference and Explain me Bro/Sis/Friends. Thanking you...!!!
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/36539251
comment on: http://stackoverflow.com/q/23763345
type: Comment
type: QuestionComment
has text: What sort of Eclipse RCP application? e4 or 3.x? Using a workspace with the org.eclipse.resources plugin or managing files some other way?
score: 0

http://stackoverflow.com/q/23690353
has comment: http://stackoverflow.com/comment/36424337
has comment: http://stackoverflow.com/comment/36401296
type: UnansweredQuestion
tagged with: android
tagged with: android-popupwindow
answer count: 0
has comment: http://stackoverflow.com/comment/36401109
has title: Putting chart on android popup
has comment: http://stackoverflow.com/comment/36401539
tagged with: achartengine
has comment: http://stackoverflow.com/comment/36403511
has comment: http://stackoverflow.com/comment/36414032
type: Question
has comment: http://stackoverflow.com/comment/36411725
tagged with: java
has comment: http://stackoverflow.com/comment/36401330
has body: I am using AChartEngine to make charts which seems to be working quite well so far. The only thing to make this perfect would be to be able to put this chart on a popup. Unfortunately I have no idea how to do this. Whenever I try to include the chart's function to be called with the popup I get a NullPointerException. Here is the code for my popup window (which is called whenever I click on a button) void popupWindow(){ LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.activity_report_popup_layout, null); final PopupWindow popupWindow = new PopupWindow( popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss); btnDismiss.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); }}); popupWindow.showAsDropDown(plotsButton, 50, -30); } Here is the relevant popup layout xml code: &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Popup" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_marginTop="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="This is a simple popup" /&gt; &lt;Button android:id="@+id/dismiss" android:layout_marginTop="10dp" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Close" /&gt; &lt;LinearLayout android:orientation="horizontal" android:id="@+id/chart_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/tv_title" &gt; &lt;/LinearLayout&gt; Edit: Decided to also add the chart code: private void openChart(){ Date[] dt = new Date[dates.size()]; float[] visits =…
score: 0
has comment: http://stackoverflow.com/comment/36425798
has comment: http://stackoverflow.com/comment/36414196
has comment: http://stackoverflow.com/comment/36431069

http://stackoverflow.com/comment/36445446
has text: actually, it is already, see my answer...
comment on: http://stackoverflow.com/q/23714267
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23722231
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23722043
answers question: http://stackoverflow.com/q/23722043
type: Answer
downvote count: 0
score: 1
has body: Commonly this is solved by making two actions - one that's doing the business (stores a reservation) and second one that shows the result to the user. After successfull storing of reservation in the first action, redirect to the second one. From user point of view it will be one action and if he hits the reload button, only view action is performed again.
upvote count: 1

http://stackoverflow.com/comment/54949187
has text: What do you mean by "generate 3D model"?
type: Comment
comment on: http://stackoverflow.com/a/23658824
score: 0
type: AnswerComment

http://stackoverflow.com/q/23716987
tagged with: math
has answer: http://stackoverflow.com/a/23717011
linked to: http://stackoverflow.com/q/101439
answer count: 2
has comment: http://stackoverflow.com/comment/36450604
accepted answer: http://stackoverflow.com/a/23717011
has comment: http://stackoverflow.com/comment/36450806
has comment: http://stackoverflow.com/comment/36450671
has comment: http://stackoverflow.com/comment/36450861
favorite count: 0
has comment: http://stackoverflow.com/comment/36452066
has title: Why basic math functions aren't overloaded for different types in Java, Math?
possible better answer: http://stackoverflow.com/a/23717196
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23717196
tagged with: overloading
has body: I have really interesting question. Recently I figured out, that Math.pow() takes only (double, double) args and I wonder why there is no overloaded functions with other types combinations such as (int, int) or (int, double) atc ... I think this is big hole and paintfull weakness so I belive there is A REASON. Can anybody explain it to me, please? Consider these two methods: private int simplePow(int x) { return x * x; } private int harderPow(int x) { return (int) Math.pow(x, 2); } first one is much faster than second... problem is, that if you know, that you use power with (int, int), calculation is much effective and you don't need to take care of problems with double variables.
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36450885
downvote count: 1
has comment: http://stackoverflow.com/comment/36450634
type: Question
tagged with: pow

http://stackoverflow.com/a/23778438
type: Answer
has comment: http://stackoverflow.com/comment/36737271
has body: This is the logic. See if the DIV has title attribute. If it does not have the seat is available. Change the logic as per your need. List&lt;WebElement&gt; seats = driver.findElements(By.cssSelector("div.GXXXXXX.GXXXXXXX")); for (WebElement seat : seats) { if(seat.getAttribute("title") != null){ System.out.println("Seat is not available"); }else{ System.out.println("Seat is available"); seat.click(); // break the loop if you wish } }
upvote count: 1
answers question: http://stackoverflow.com/q/23777802
accepted answer of: http://stackoverflow.com/q/23777802
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36738867

http://stackoverflow.com/comment/36261123
has text: @gstackoverflow How is that a contradiction? The subclass method `d1` can declare a more narrow return type `R1` than the superclass method being overridden, `d2`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23618392
type: AnswerComment

http://stackoverflow.com/comment/36325273
has text: You don't need reconnect code after all in `run()` just need to check in run() if connection is connected that's all because you can set a setting in mysql when connecting like this. `"&autoReconnect=true"` which will automatically reconnect without any extra code.
score: 0
comment on: http://stackoverflow.com/q/23651074
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23664142
score: -3
has answer: http://stackoverflow.com/a/23664836
tagged with: java
type: Question
has body: //read each character in the string st[] array and compare it with second array st1[]. for(int i=0;i&lt;=7;i++){ for(int j=0;j&lt;=31;j++){ if(st[i].charAt(j)!= st1[i].charAt(j)) x++; } }
downvote count: 4
has title: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 31
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36350487
has answer: http://stackoverflow.com/a/23664176
has answer: http://stackoverflow.com/a/23664180
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36399759
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23689549
has text: What have you found so far? Have you looked in the documentation? Do some research of your own.

http://stackoverflow.com/comment/36383637
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23680382
has text: @alexpfb: I guess [using `ThreadLocal`](http://stackoverflow.com/a/6456776/581205) is best.
score: 0

http://stackoverflow.com/comment/36384024
score: 0
type: Comment
type: QuestionComment
has text: Ok. Sorry for the incovenience, it is the first time i am asking questions like this.
comment on: http://stackoverflow.com/q/23681277

http://stackoverflow.com/comment/36314262
type: Comment
comment on: http://stackoverflow.com/q/23644667
score: 0
has text: namespace already applied like this <context:component-scan base-package="com.*"/> also tried with what you suggested <context:component-scan base-package="*"/>, both doesn't give me what i want
type: QuestionComment

http://stackoverflow.com/comment/36830452
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23704616
has text: ok, it seems then it's not possible with the current version of dropwizard.. @condit if you want to put that in an answer I'll close this question, thanks
type: Comment

http://stackoverflow.com/comment/36562006
type: Comment
comment on: http://stackoverflow.com/a/23730853
score: 0
type: AnswerComment
has text: You know, you could just use 1. `e.getLocationOnScreen()` or 2. `e.getPoint` which will give the point within the context of the component that generated the event

http://stackoverflow.com/a/23684806
answers question: http://stackoverflow.com/q/23683933
type: Answer
accepted answer of: http://stackoverflow.com/q/23683933
has comment: http://stackoverflow.com/comment/36393339
upvote count: 1
has body: DB2 is looking for a method with the signature (String, int, String, String): (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V Note "I" as the second parameter type, it's not "Ljava/lang/Integer". The SQL INTEGER data type maps to Java int, so you'll need to change your method signature.
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/q/23664129
type: Question
has answer: http://stackoverflow.com/a/23664194
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/23664194
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23664228
tagged with: jframe
possible better answer: http://stackoverflow.com/a/23664228
type: AnsweredQuestion
has title: Adding a public class that extends JPanel to JFrame
has body: Basically as the title says, I'm having a bit of an issue working out how to add a class that extends JPanel to a JFrame. I've looked on here and on other forums, but no answer that I've tried out has work. I've also got 3 separate files, my main.java my frame.java and panel.java (abbreviated for convenience) Apparently it's good practice to have public classes in different files(?) or so I've been told! I'd appreciate any help on how to actually add the JPanel to the JFrame, even just a link to some documentation I may not have seen. Also I'm open to any constructive criticisms that anyone has about the way I've entered/laid out my code. Thanks! main.java public class MyGuiAttempt { public static void main(String[] args) { new mainFrame(); } } frame.java public class mainFrame extends JFrame { public mainFrame() { setVisible(true); setTitle("My Game"); setSize(800, 600); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(mainScreenMenu); //This is where I'm clearly going wrong. } } panel.java public class mainScreenMenu extends JPanel { public mainScreenMenu() { JLabel homeMenuBackground = new JLabel(new ImageIcon("images/my_image.jpg")); setPreferredSize(new Dimension(800,600)); add(homeMenuBackground); setVisible(true); } }
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/36355484
comment on: http://stackoverflow.com/a/23666730
score: 0
type: AnswerComment
type: Comment
has text: @fadytaher And *that* is because the argument to `split` is a regular expression. Escape the `.`.

http://stackoverflow.com/q/23704316
tagged with: android
linked to: http://stackoverflow.com/q/2042813
has comment: http://stackoverflow.com/comment/36427141
has title: Java syntax WRT static methods in an Android program
score: 0
tagged with: java
has body: I normally do Windows/C#/C++ programming but I dabble in Android so I've been asked to look at Android program to fix a bug in it. I do not have a mandate to re-architect it, so what's static stays static. The problem is this: In one Activity it has a public static method. It also has all the usual non-static methods. There's one instance of this particular Activity class. I want to be able to call some non-static methods on this Activity class and access some of its data from the static method. Obviously if I try to do so directly I get, Cannot make a static reference to the non-static method ... I assume there must be a way to stash some reference to that specific instance of Activity class in some global public place during the onStart() or onCreate() methods using this or some context, and then use that in the static method to make the calls, e.g., myStoredClassInstance.aNonStaticMethod(); ...but I don't know the syntax. Can anyone help me out on this? PS Before you say this is a duplicate of this: calling non-static method in static method in Java note that that question is about calling a non-static method of a separate class, so the answers involved creating a new instance of that class on the fly. In my case I want to know the syntax of accessing an existing specific class.
answer count: 1
has answer: http://stackoverflow.com/a/23705023
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/36427813

http://stackoverflow.com/a/23719620
downvote count: 0
type: Answer
has body: ArrayList is a data structure in the Collections framework which is built on top of arrays I.e. It's implementation is done with the help of arrays. Since size is to be defined in arrays, it initializes size to be 10 at first. When you add values, it becomes the 11th item. Now you might wonder how is this dynamic and how it works, well when size is reached to its limit it creates a new array double the size, copies the old stuff and discards the prev array. Would recommend you to take a look at the implementation. To the user, it looks like dynamic but when you look through debugger you would see nulls. Array STARTS at 0 to 10 which makes it 11 elements and your newly added item becomes 12th but for public api, it's still the first element. Check here for complete implementation of ArrayList: link
upvote count: 1
answers question: http://stackoverflow.com/q/23719303
score: 1

http://stackoverflow.com/a/23762925
type: Answer
answers question: http://stackoverflow.com/q/23743449
has comment: http://stackoverflow.com/comment/36615348
has body: You do not need an AffineTransform, the rotate method is a special case of it. I also don't know why you call translate since you already know the location at which you draw. Here is how to rotate text: public class Draw extends JFrame { Draw() { setContentPane(new MyPanel()); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(300,300); setVisible(true); } class MyPanel extends JPanel { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; int haX = 30; int haY = 100; g2d.rotate(-Math.PI/2, haX, haY); g2d.drawString("999", haX, haY); } } public static void main(String[] args) { new Draw(); } }
score: 0

http://stackoverflow.com/a/23707213
has comment: http://stackoverflow.com/comment/36512634
score: 0
has comment: http://stackoverflow.com/comment/36474274
answers question: http://stackoverflow.com/q/23706358
has comment: http://stackoverflow.com/comment/36476213
type: Answer
has body: Background: Floating point numbers have rounding issues, so they should never be compared with "==". This is false. You do need to be awake when writing floating-point code, but reasoning about the errors that are possible in your program is in many cases straightforward. If you cannot do this, it behooves you to at least get an empirical estimate of how wrong your computed values are and think about whether the errors you're seeing are acceptably small. What this means is that you cannot avoid getting your hands dirty and thinking about what your program is doing. If you're going to work with approximate comparisons, you need to have some idea of what differences mean that two values really are different and what differences mean that two quantities might be the same. // should be 1.38, but end up with 1.3800000000000001 This is also false. Notice that the closest double to 1.37 is 0x1.5eb851eb851ecp+0 and the closest double to 0.01 is 0x1.47ae147ae147bp-7. When you add these, you get 0x1.6147ae147ae14f6p+0, which rounds to 0x1.6147ae147ae15p+0. The closest double to 1.38 is 0x1.6147ae147ae14p+0. There are several reasons why two slightly different doubles do not compare ==. Here are two: If they did so, that would break transitivity. (There would be a, b, and c such that a == b and b == c but !(a == c). If they did so, carefully-written numerical code would stop working. The real issue with trying to find a double in a list is that NaN does not compare == to itself. You may try using a loop that checks needle == haystack[i] || needle != needle &amp;&amp; haystack[i] != haystack[i].

http://stackoverflow.com/comment/36321996
type: Comment
type: QuestionComment
has text: @eRRor 404, I've edited my O.P. to make it clear that I get no warning when I compile Test.java.
comment on: http://stackoverflow.com/q/23649650
score: 0

http://stackoverflow.com/q/23710977
answer count: 1
tagged with: javascript
has comment: http://stackoverflow.com/comment/36443851
has answer: http://stackoverflow.com/a/24400278
score: 0
tagged with: android
type: UnansweredQuestion
type: Question
tagged with: android-webview
has body: I am creating an application which shows an external website in a webview. I want to fill the username and password fields of that web view with my custom values, but i am not finding any success to do so: HERE IS THE WEBSITE PAGE SOURCE SNIPPET: Username * Password * And here is my Android Code Snippet: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); browser = (WebView)findViewById(R.id.webView1); browser.setWebViewClient(new MyBrowser()); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setJavaScriptEnabled(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.loadUrl(AppConstants.LOGIN_URL); } private class MyBrowser extends WebViewClient { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); String TAG="onPageFinished"; Logger.i(TAG,"Called.."); if(url.equals(AppConstants.LOGIN_URL)) { Logger.i(TAG,"Login page load done.."); updateStatus("Login Page Loaded..!",TYPE_GREEN); browser.loadUrl(getLoginScript("USER_NAME","PASS_WORD")); } } } public static String getLoginScript(String userName,String password){ return "javascript: {" + "document.getElementsByName('userName').value = '"+userName +"';" + "document.getElementsByName('password').value = '"+password+"'; };"; } On the Running the above code: -I get a new web Page with a text as USER_NAME Please Help me! I need to get this working... Thanks in advance.
tagged with: java
has title: Autofill fields in web view android

http://stackoverflow.com/a/23672820
has body: Assuming that you initialize the next parameter to a null value, when you remove your last node, head will now point to null. When you do this: a = head, you are assigning a to null since there are no more nodes left. When you try and access the .next property, a will be null so you get that exception. To fix this: public String toString() { String result = " "; ListNode a=head; if(a != null) { while (a.next!=null){ result +=" "+a.item; a=a.next; } result+=" "+a.item; } else { result = "List is Empty"; } return result; }
answers question: http://stackoverflow.com/q/23672725
type: Answer
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/99453976
type: AnswerComment
comment on: http://stackoverflow.com/a/27920613
type: Comment
score: 1
has text: seems right, this is deprecated :( http://mongodb.github.io/mongo-java-driver/3.10/javadoc/com/mongodb/AggregationOptions.Builder.html

http://stackoverflow.com/comment/36442772
comment on: http://stackoverflow.com/a/23712423
type: AnswerComment
has text: @user3633989: you will advance from beginner to intermediate **much** quicker if you try to first write it yourself. Then if stuck come back with your code and your specific questions. Also for future questions, you should never ask folks here to write code for you. That's not how this place works, and can upset some of the volunteers here. While we'll be happy answering questions and providing directions, ultimately the problem is yours, the code should be yours.
score: 0
type: Comment

http://stackoverflow.com/comment/36485467
has text: possible your Textviews are null, wrong Ids bij findViewById, or your text (question / answer) can be null, this is not allowed, check both: textviews + string values. Something is null
comment on: http://stackoverflow.com/q/23735163
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36466678
score: 1
comment on: http://stackoverflow.com/q/23725226
has text: On windows, you need to run the appropriate regedit commands to add this type with a default application.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36507183
comment on: http://stackoverflow.com/q/23746332
has text: I did try to do that actually, on this line int[][] num = new int[str1.length()][str2.length()]; the maximum number it can be is 1000 (trial and error) so figured i can break up the text into 1000 sections for every 1 million characters, but WarAndPeace is around 3 million+ characters, and that would need 4000+ sections of the text, which is just as bad because i also need to worry about how long it takes as well.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36262696
type: AnswerComment
score: 0
type: Comment
has text: @LancePreston it is written in my answer: *Note that nextLine will consume every input until the `Scanner` finds a new break line input. This means that you have to add an additional `nextLine()` before reading the data for the books*. If you just read the `nextInt` and then try to read the `nextLine`, `nextInt` will read the `integer` input and `nextLine` will read everything until the break line input: everything between the integer input and the break line input.
comment on: http://stackoverflow.com/a/23618923

http://stackoverflow.com/comment/36323929
comment on: http://stackoverflow.com/a/23650788
score: 0
type: AnswerComment
has text: I cleared exactly that I am looking for a solution without opening new threads. Your suggestion works only if you can organise your code execution as handling callbacks from a loop.
type: Comment

http://stackoverflow.com/comment/36467466
score: 0
type: Comment
type: QuestionComment
has text: well isnt it supposed to?!
comment on: http://stackoverflow.com/q/23725604

http://stackoverflow.com/comment/36454678
type: Comment
type: QuestionComment
has text: Are you allowed to use built-in collections (such as `List`)?
comment on: http://stackoverflow.com/q/23718983
score: 0

http://stackoverflow.com/q/23729963
has body: How would you put the result of the following iteration into an ArrayList along with other objects. Note that the ArrayList is of type "Shape" which is an abstract class for(int row = 0; row &lt; numberOfRows; row++){ for(int col = 0; col &lt; numberOfColumns; col++) { if(row==0 || col==0) { System.out.print(borderCharacter + " "); } else if(row == numberOfRows - 1 || col == numberOfColumns - 1) { System.out.print(borderCharacter + " "); } else { System.out.print(" "); } } //close col forLoop System.out.println(); } // close row forLoop Also this for an assignment so we have been instructed to use ArrayLists or LinkedLists (only been programming for 2-3 months all up)
tagged with: arraylist
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36476221
tagged with: java
has answer: http://stackoverflow.com/a/23730014
type: Question
has title: my Java and Arraylists aren't playing nice

http://stackoverflow.com/q/23638462
has answer: http://stackoverflow.com/a/46619164
tagged with: spring-security
upvote count: 19
favorite count: 0
tagged with: spring
type: AnsweredQuestion
downvote count: 0
has title: How do I add method based security to a Spring Boot project?
possible better answer: http://stackoverflow.com/a/46619164
score: 19
has answer: http://stackoverflow.com/a/23647156
type: Question
accepted answer: http://stackoverflow.com/a/23647156
tagged with: spring-boot
tagged with: java
has body: I want to add method based security to a Spring Boot project. It seemed that all I would need is to add PermissionEvaluator and MethodSecurityExpressionHandler beans, annotate my WebSecurityConfigurerAdapter with @EnableGlobalMethodSecurity(prePostEnabled = true) and the method with @PreAuthorize("isAuthenticated() and hasPermission(#param, 'somePermissionName')"). But after adding a PermissionEvaluator bean @Bean public PermissionEvaluator permissionEvaluator() { HelloPermissionEvaluator bean = new HelloPermissionEvaluator(); return bean; } I get an IllegalArgumentException: "A ServletContext is required to configure default servlet handling": Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultServletHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.web.servlet.HandlerMapping org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.defaultServletHandlerMapping()] threw exception; nested exception is java.lang.IllegalArgumentException: A ServletContext is required to configure default servlet handling at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1094) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:989) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.create…
answer count: 2

http://stackoverflow.com/comment/36347472
has text: @MikyDinescu Actually, you can do this with pure regex with some tools. That doesn't mean that the `java` tag should be removed!
score: 0
comment on: http://stackoverflow.com/q/23662527
type: Comment
type: QuestionComment

graph-algorithm
tags question: http://stackoverflow.com/q/23769169
type: Tag
tag name: graph-algorithm

http://stackoverflow.com/comment/37320591
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23759792
has text: @user3656458:Useful conversation ,finally did u reduced the PDF size or not?

http://stackoverflow.com/q/23703328
has comment: http://stackoverflow.com/comment/36424598
type: AnsweredQuestion
has body: Look at this .java file: class A { HashMap a; } It doesn't compile; I need to import java.util.HashMap;. Now consider this one: class A { String a; } It's exactly the same—except with String instead of HashMap—so it shouldn't compile, right? Wrong. Okay, so it's pretty well-known that you don't have to import String, but why is that? The "obvious" answer is because String is used far more often than HashMap, but then shouldn't ArrayList be "implicitly imported"? What about the the primitive wrapper classes, e.g. Integer and Boolean? ArrayList is used far more often than Long and Float, but I have to import ArrayList and don't need to import Float. What is the reason behind not needing to import String, Integer, Character, Exception and a few other classes?
score: 0
tagged with: java
tagged with: import
linked to: http://stackoverflow.com/q/14008664
type: Question
has answer: http://stackoverflow.com/a/23703342
upvote count: 5
duplicate of: http://stackoverflow.com/q/14008664
has comment: http://stackoverflow.com/comment/36424982
accepted answer: http://stackoverflow.com/a/23703341
downvote count: 5
has title: Why don't I have to import some classes?
answer count: 2
possible better answer: http://stackoverflow.com/a/23703342
favorite count: 0
has comment: http://stackoverflow.com/comment/36426043
has answer: http://stackoverflow.com/a/23703341

http://stackoverflow.com/q/23776277
has answer: http://stackoverflow.com/a/23787323
has answer: http://stackoverflow.com/a/23776642
type: UnansweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has title: insert multiple rows in same database table using servlet jsp in eclipse
tagged with: servlets
has body: I m trying insert multiple rows in same database (each row had many fields) on submit but unable to do so. I m successfully able to insert single row but when it comes for multiple rows I got stuck. This is the jsp page where you take an input to dynamically add no of rows. There is no separate submit button for each row instead single submit button to insert all rows. 1.> projmgrsuccessful.jsp Another popup <input type="hidden" name="pid" value="<c:out value="${pid}" />"> Enter the no of employee involved in project Close This is java code snippet where I processing the data like connecting to the database and inserting it into database table. 2.> AddProjectTaskDAO.java package com.pms.servlet; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.Statement; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class AddProjectTaskDAO */ @WebServlet("/AddProjectTaskDAO") public class AddProjectTaskDAO extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AddProjectTaskDAO() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter pw = response.getWriter(); Connection conn=null; String url="jdbc:mysql://localhost:3306/"; String dbName="projectmanagement"; String driver="com.mysql.jdbc.Driver"; String dbUsername="root"; String dbPassword="root"; try{ String Projid=" "; String Projuname…
answer count: 2
tagged with: jstl
tagged with: sql
tagged with: jsp
favorite count: 0
score: -1

http://stackoverflow.com/a/23757045
has body: The problem you are having is you cannot reference non-static variables (instances of MyClass) from the static context (main menu in java_main class). Either you change your MyClass like this, public static class Myclass Or take out MyClass out of the java_main class. And remove the public access modifier from the MyClass. Because you cannot have two public classes in the same file. public class java_main { public static void main(String[] args) { Myclass my = new Myclass(3,4); Myclass your = new Myclass(); } } class Myclass { public int a,b; public Myclass(int i, int j) { a = i; b = j; } public Myclass() { a = 1; b = 2; } } Hope this helps for you or someone else. Cheers!
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23756304

http://stackoverflow.com/comment/36542052
score: 0
type: Comment
type: QuestionComment
has text: but my code insert my data in same line in file xml , when my data is big i can't read my data
comment on: http://stackoverflow.com/q/23764724

http://stackoverflow.com/comment/36278956
type: QuestionComment
comment on: http://stackoverflow.com/q/23627732
has text: Sorry, what's going wrong is, that the String does not contain the expected imei-number, but "0". Also the "if(!device.hasImeiNumber())" shows, that it has no ImeiNumber set.
score: 0
type: Comment

http://stackoverflow.com/q/23673447
score: 0
answer count: 2
tagged with: annotations
tagged with: spring
has title: Invalid line definition XML
has body: Spring throws a NPE while calling the @PostCOnstruct method. Apparently it does not initialize ONLY ONE variable which is already specified inside a bean at the XML file. The XML file looks like this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;context:annotation-config/&gt; &lt;bean id="blueprint" class="com.rfslabs.TheDAO"&gt; &lt;property name="SLEEP_TIME" value="1"/&gt; &lt;property name="LIFESPAN_BIG" value="60"/&gt; &lt;property name="LIFESPAN_SMALL" value="20"/&gt; &lt;property name="ALERT_SIZE" value="80"/&gt; &lt;property name="MAX_SIZE" value="3072"/&gt; &lt;property name="BUILD_FOLDER" value="/var/www/clients/client2/web6/web/builds/"/&gt; &lt;property name="EXISTING" value="4"/&gt; &lt;property name="ALERT_L1" value="none"/&gt; &lt;property name="ALERT_L2" value="none"/&gt; &lt;/bean&gt; &lt;/beans&gt; The variable that is null after this: ApplicationContext con = new FileSystemXmlApplicationContext("res/config.xml"); dao = (TheDAO) con.getBean("blueprint"); is the String ALERT_L2 I have provided setters and getters for all the variables in TheDAO class, see it for yourself: public class TheDAO { public int SLEEP_TIME;//SECONDS public int LIFESPAN_BIG;//SECONDS public int LIFESPAN_SMALL;//SECONDS public int ALERT_SIZE;//IN % public int MAX_SIZE;//IN MB public int EXISTING; public File BUILD_FOLDER; public String ALERT_L1; public String ALERT_L2; public String getALERT_L1() { return ALERT_L1; } public void setALERT_L1(String aLERT_L1) { ALERT_L1 = aLERT_L1; } public String getALERT_L2() { return ALERT_L2; } public void setALERT_L2(…
tagged with: java
has answer: http://stackoverflow.com/a/23673572
has answer: http://stackoverflow.com/a/23673657
tagged with: nullpointerexception
type: Question
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/23673657
accepted answer: http://stackoverflow.com/a/23673572

http://stackoverflow.com/comment/36279792
score: 3
comment on: http://stackoverflow.com/q/23628302
type: Comment
type: QuestionComment
has text: Why would you store a date in a database as a string at all, and not as a date?

http://stackoverflow.com/comment/36275359
score: 1
has text: We're supposed to help others not criticize them for their lack of knowledge. I agree static works and would be fine.
comment on: http://stackoverflow.com/a/23625942
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36442381
type: Comment
type: QuestionComment
has text: If your `NewRound` constructor already has the necessary data to start all over again, then it should work.
score: 1
comment on: http://stackoverflow.com/q/23712808

http://stackoverflow.com/comment/36362455
has text: I would suggest this tutorial: [http://spring.io/guides/gs/securing-web/](http://spring.io/guides/gs/securing-web/)
type: QuestionComment
comment on: http://stackoverflow.com/q/23661492
type: Comment
score: 2

http://stackoverflow.com/comment/46418129
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23665648
score: 0
has text: Did you find any solution for it so i can upload with proguard.

http://stackoverflow.com/q/23681465
has answer: http://stackoverflow.com/a/23681516
accepted answer: http://stackoverflow.com/a/23681516
favorite count: 0
has body: I have defined this enum : public enum UsageType { START("start"), PAUSE("pause"), RESUME("resume"), STOP("stop"), DESTROY("destroy"); private final String mType; private UsageType(String type) { mType = type; } /** * Get the string representation of the UsageType * @return string representation of the UsageType */ public String getAsText() { return mType; } } In another class, I have a constractor that takes string, and I want to make an enum with that string: public class AppUsage { private String mActivityName; private String mFormattedTime; private UsageType mUsageType; public AppUsage(String activityName, String formattedTime, String usageType) { mActivityName = activityName; mFormattedTime = formattedTime; mUsageType = mUsageType.valueOf(usageType); //HERE STRING TO ENUM! } //Setters and Getters.... Here is the error I get: java.lang.IllegalArgumentException: start is not a constant in com.embedonix.mobilehealth.serverwork.usage.UsageType at java.lang.Enum.valueOf(Enum.java:198) at com.embedonix.mobilehealth.serverwork.usage.UsageType.valueOf(UsageType.java:6)
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/23682711
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23681596
has answer: http://stackoverflow.com/a/23681596
type: Question
has title: Convert String to enum in Java
has answer: http://stackoverflow.com/a/23681665
type: AnsweredQuestion
tagged with: enums
upvote count: 1
has answer: http://stackoverflow.com/a/23681876

http://stackoverflow.com/comment/36345891
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23659283
has text: why not try it, see what datastore type a "short" will create, and then do an INSERT of the max of a short + 1 ... does the datastore throw an SQLException?

gwt
tags question: http://stackoverflow.com/q/23632010
tags question: http://stackoverflow.com/q/23631242
tags question: http://stackoverflow.com/q/23760158
tag name: gwt
tags question: http://stackoverflow.com/q/23742185
tags question: http://stackoverflow.com/q/23645988
tags question: http://stackoverflow.com/q/23693653
tags question: http://stackoverflow.com/q/23674153
tags question: http://stackoverflow.com/q/23637123
tags question: http://stackoverflow.com/q/23630193
type: Tag
tags question: http://stackoverflow.com/q/23715268
tags question: http://stackoverflow.com/q/23680521
tags question: http://stackoverflow.com/q/23630407
tags question: http://stackoverflow.com/q/23695647
tags question: http://stackoverflow.com/q/23755490
tags question: http://stackoverflow.com/q/23746551
tags question: http://stackoverflow.com/q/23772895
tags question: http://stackoverflow.com/q/23697516
tags question: http://stackoverflow.com/q/23660064
tags question: http://stackoverflow.com/q/23725959
tags question: http://stackoverflow.com/q/23692748
tags question: http://stackoverflow.com/q/23762637
tags question: http://stackoverflow.com/q/23683767
tags question: http://stackoverflow.com/q/23626993
tags question: http://stackoverflow.com/q/23686457
tags question: http://stackoverflow.com/q/23692338
tags question: http://stackoverflow.com/q/23777482
tags question: http://stackoverflow.com/q/23625921
tags question: http://stackoverflow.com/q/23620580
tags question: http://stackoverflow.com/q/23710744
tags question: http://stackoverflow.com/q/23658950
tags question: http://stackoverflow.com/q/23654757
tags question: http://stackoverflow.com/q/23713809
tags question: http://stackoverflow.com/q/23674589

http://stackoverflow.com/a/23721099
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23720976
type: Answer
has body: Some context is needed. If the previous symbol is nothing or one of *,/,-,+,(, the | is opening; otherwise, it is closing.
accepted answer of: http://stackoverflow.com/q/23720976
has comment: http://stackoverflow.com/comment/36459323
score: 0

http://stackoverflow.com/a/23755945
type: Answer
has body: Since you are reassigning words[cnt] = words[cnt].replace() it looks like you first change a to e and then change this e to a b. You should loop through all the letters in words[cnt], translate it into a new letter and append that to a StringBuilder builder. Then, after the loop is finished, assign words[cnt] the value of builder.toString(). StringBuilder builder = new StringBuilder(); for (int pos = 0; pos &lt; words[cnt].length(); pos++) { builder.append(translateLetter(words[cnt].charAt(pos), letterFrequency)); } words[cnt] = builder.toString(); You probably also want replaceAll instead of replace, but after making the StringBuilder change this won't matter.
has comment: http://stackoverflow.com/comment/36528813
answers question: http://stackoverflow.com/q/23755376
has comment: http://stackoverflow.com/comment/36533106
accepted answer of: http://stackoverflow.com/q/23755376
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/36512133
comment on: http://stackoverflow.com/a/23748884
type: AnswerComment
score: 0
has text: You can also call `add(anInteger)` on a `List<? super Integer>`, although I fail to imagine any reason why you ever would.
type: Comment

http://stackoverflow.com/a/23773352
has body: Game tutorials that I have came across with java tutorial uses JFrame, JPanel, and canvas to draw the game. I, also, ran across tutorial started off using teaching GraphicsDevice api in java.awt library. I am confused. From the description of the GraphicsDevice api, I think it allows the game to be full screen; however, isn't that achievable with JFrame already? Can anyone tell me whats the difference with and without GraphicsDevice api? Canvas provides access to BufferStrategy which provides you with the ability to take control over the rendering process. This is commonly known as active rendering, as opposed to the way Swing works, which uses a passive rendering process Full-Screen Exclusive Mode provides some benifits over frame based rendering, typically, it will be faster as you have exclusive access to the screen without hinderance from other windows or the OS wanting to perform extra painting due to changes it (the OS) may detect/require Also, I came across some posts suggesting OpenGL EU. If I understand correctly, it allows game graphics performance to be boosted. Is it encouraged to use OpenGL for every game? Is it something similar to GraphicsDevice api? If yes, I would assume it can not co-exist in the same game with GraphicsDevices api; otherwise, I would assume they can co-exist and the game can take advantage of both api. Correct me if I am wrong...I am really not understanding much so far. Java, at least through Swing, not sure about AWT, can use both OpenGL and DirectX for it's rendering pipeline, having said that, there are some additional benefits to using OpenGL bindings directly, one would be the inclusion of 3D capabilities. I'd recommend trying to develop concepts and algorithms first, understand how to keep the game state separate from the game view and game controller, understand the purpose of the main game loop, for example, these concepts will always be important regardless of what you are developing... iOS has OpenGL bindings/capabilitie…
score: 0
has comment: http://stackoverflow.com/comment/36588637
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23773244
accepted answer of: http://stackoverflow.com/q/23773244

http://stackoverflow.com/q/23673925
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36369647
has comment: http://stackoverflow.com/comment/36369177
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36368944
tagged with: java
has comment: http://stackoverflow.com/comment/36368936
has body: I do have a problem with threading: I have some networt operations (downloads) to do in one of my activities. I wrote a thread for this, so that this happens in the background of my UI thread. But I am doing it wrong in some way, and I do not know how to fix this issue. My code is: private void startDownload(){ progressBar.setVisibility(View.VISIBLE); Downloader loader = new Downloader(); loader.start(); try { loader.join(); } catch (InterruptedException e) { e.printStackTrace(); } } Now the problem is, the progress bar appears when loader is almost done. It won't show up before I start loader. I think this is because i join() loader with my UI thread, but I don't know how to circumvent this. I have to wait for loader to finish, because following code will process files downloaded from loader. I had one idea: I could use a loop like while(loader.isAlive()){ //doSomething } But I am not sure if this would solve my problem. EDIT: Ok I will replace my thread by an AsyncTask. This seems to make sense due to the fact that I need the data in the UI in further progression of my programm. But can somebody explain to me why my progressBar was not shown although I set Visibility to TRUE before starting loader thread? Thank you!
has answer: http://stackoverflow.com/a/23674179
type: Question
accepted answer: http://stackoverflow.com/a/23674186
possible better answer: http://stackoverflow.com/a/23674179
downvote count: 0
has comment: http://stackoverflow.com/comment/36369846
has comment: http://stackoverflow.com/comment/36369010
has comment: http://stackoverflow.com/comment/36370640
answer count: 3
has comment: http://stackoverflow.com/comment/36368921
tagged with: android
has title: Threading and UI
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36369121
has comment: http://stackoverflow.com/comment/36368923
favorite count: 0
has answer: http://stackoverflow.com/a/23674537
upvote count: 2
has answer: http://stackoverflow.com/a/23674186

launch
tags question: http://stackoverflow.com/q/23634147
tags question: http://stackoverflow.com/q/23777467
type: Tag
tag name: launch

http://stackoverflow.com/comment/36265063
comment on: http://stackoverflow.com/q/23620313
type: Comment
type: QuestionComment
has text: @yvesbastos For what function? Give me something I can try out! Tell me what input to put in, what function you're integrating, what output to expect, and what "wrong" results you're getting. Otherwise, how can I possibly see what your issue is?
score: 0

http://stackoverflow.com/q/23629000
tagged with: types
downvote count: 0
answer count: 1
score: 4
has title: Calling Haskell function returning String from Java
favorite count: 0
tagged with: ghc
has body: I want to call a Haskell function that is operating on text and returns text (actually the processing is complicated and the Haskell code is split into few modules, but this probably isn't the case). I tried the approach described here: Communication between Java and Haskell and modified it to work with Strings. But I'm getting the error: error: initializing argument 1 of ‘void* myFunction_hs(HsPtr)’ [-fpermissive] extern HsPtr myFunction_hs(HsPtr a1); ^ The relevant code and compilation is here: in Haskell: foreign export ccall myFunction_hs :: CString -&gt; IO CString in Java: import com.googlecode.javacpp.*; import com.googlecode.javacpp.annotation.*; @Platform(include={"&lt;HsFFI.h&gt;","myModule_stub.h"}) public class MyModule { static { Loader.load(); } public static native void hs_init(int[] argc, @Cast("char***") @ByPtrPtr PointerPointer argv); public static native String myFunction_hs(String text); public static void main(String[] args) { hs_init(null, null); String s = myFunction_hs("This is some String."); System.out.println("Result: " + s); } } And the compilation: $ ghc -fPIC -c -O myModule.hs $ javac -cp javacpp.jar MyModule.java $ java -jar javacpp.jar -Dcompiler.path=ghc -Dcompiler.output.prefix="-optc-O3 -Wall MyModule.o -dynamic -fPIC -shared -lstdc++ -lHSrts-ghc7.6.3 -o " -Dcompiler.linkpath.prefix2="-optl -Wl,-rpath," MyModule Do you have any idea what goes wrong?
accepted answer: http://stackoverflow.com/a/23800471
has comment: http://stackoverflow.com/comment/36281474
has comment: http://stackoverflow.com/comment/36281301
linked to: http://stackoverflow.com/q/10370177
type: AnsweredQuestion
tagged with: java
tagged with: haskell
has answer: http://stackoverflow.com/a/23800471
type: Question
upvote count: 4
tagged with: ffi

http://stackoverflow.com/comment/36329189
has text: It will be interesting to know how we can get file size using js.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23649525

http://stackoverflow.com/q/23672876
tagged with: jackson
has answer: http://stackoverflow.com/a/23672966
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23673120
tagged with: serialization
tagged with: extjs
type: UnansweredQuestion
has title: Can not deserialize instance with jackson
tagged with: java
has body: I'm working on a RESTful app in which the response is passed as JSON string from Extjs to the java , so I am using the jackson to deserialize into the java POJO. Below is my request: { "filter": "[{"type":"string","value":"sdadsadsa","field":"groupName"}]", "limit": 10 } The FilterParams class looks like this: class FilterParams { @JsonProperty( value = "type" ) private String type; /** The value. */ @JsonProperty( value = "value" ) private String value; /** The group name. */ @JsonProperty( value = "field" ) private String field; } For conversion to pojo am using below code mapper.readValue(json, FilterParams.Class); But still am getting the "Can not deserialize instance of FilterParams" . How to convert it into the pojo. Any help would be greatly appreciated. Thanks.
has comment: http://stackoverflow.com/comment/36366864
type: Question

http://stackoverflow.com/q/23769423
has answer: http://stackoverflow.com/a/23770203
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36554360
tagged with: java
has answer: http://stackoverflow.com/a/23771988
accepted answer: http://stackoverflow.com/a/23771988
has comment: http://stackoverflow.com/comment/36552203
has comment: http://stackoverflow.com/comment/36552118
type: Question
has comment: http://stackoverflow.com/comment/36554422
answer count: 2
has body: I'm developing the GUI design for my database. After designing most of the frame and debugging them I released I needed to add the option to 'trigger' buttons using ENTER key, instead of only clicking on it. How should I go about it? I'm currently using MouseListener for my buttons and want to add a Listener that performs the same actions when ENTER key is pressed. Thank you
has title: Triggering JButtons via ENTER key?
score: 0
possible better answer: http://stackoverflow.com/a/23770203
has comment: http://stackoverflow.com/comment/36553126
has comment: http://stackoverflow.com/comment/36553945

http://stackoverflow.com/q/23775175
type: Question
tagged with: sql
score: 7
favorite count: 0
linked to: http://stackoverflow.com/q/38592137
tagged with: database-cursor
has comment: http://stackoverflow.com/comment/104154344
upvote count: 7
has title: org.hibernate.dialect.Oracle10gDialect does not support resultsets via stored procedures
has comment: http://stackoverflow.com/comment/38462306
has body: I'm trying to call a database stored procedure (Oracle 10g) with JPA 2.1 (Hibernate 4.3.5). The procedure returns the results in an output cursor: PROCEDURE GET_EMPLOYEE( P_ID_EMP IN VARCHAR2, P_CURSOR OUT TYPES.cursor_type ) AS ... Java code: @NamedStoredProcedureQuery(name = "Employee.findById", resultClasses = Employee.class, procedureName = "GET_EMPLOYEE", parameters = { @StoredProcedureParameter(mode = ParameterMode.IN, name = "P_ID_EMP", type = String.class), @StoredProcedureParameter(mode = ParameterMode.REF_CURSOR, name = "P_CURSOR", type = void.class) } ) Call: StoredProcedureQuery query = em.createNamedStoredProcedureQuery("Employee.findById"); query.setParameter("P_ID_EMP", "ID00001"); List&lt;Employee&gt; employees = query.getResultList(); //exception launched here This Exception is launched: Exception in thread "main" java.lang.UnsupportedOperationException: org.hibernate.dialect.Oracle10gDialect does not support resultsets via stored procedures at org.hibernate.dialect.Dialect.registerResultSetOutParameter(Dialect.java:1612) at org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport.registerRefCursorParameter(StandardRefCursorSupport.java:94) at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.prepare(AbstractParameterRegistrationImpl.java:298) at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:417) at org.hibernate.procedure.internal.ProcedureCallImpl.getOutputs(ProcedureCallImpl.java:378) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:251) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.getResultList(StoredProcedureQueryImpl.java:334) The same code works great using Eclipselink 2.5.1 (but can't use it). I know I can get a JDBC connection from the entitymanager and use the classic Resultset stuff to retrieve the results, but I would like to use JPA 2.1 - Hibernate. Thank you.
tagged with: java
tagged with: hibernate
tagged with: jpa
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23662997
has answer: http://stackoverflow.com/a/23663264
accepted answer: http://stackoverflow.com/a/23663264
tagged with: junit
has body: I need a folder structure like this: home --level1 --level2a --level2b I can create the first level with junit's temporary directory, but how do you create the levels below it? @Rule public TemporaryFolder home= new TemporaryFolder(); @Before public void setUp() { File level1= home.newFolder("level1"); }
favorite count: 0
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/43710051
has title: How to create a multi level folder structure for unit testing
has answer: http://stackoverflow.com/a/43710051
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/a/23669114
downvote count: 0
type: Answer
has body: Try out Tomcat Maven Plugin. Set up your configuration and deploy with goal tomcat7:deploy. It takes a little while to configure but it works. If you are just doing quick tests copy/paste the compiled .WAR into the tomcat\webapps folder. In case you really need to integrate both maven and eclipse on that project please update your question with the link for the sample app you are using so we can check it out. For your own projects created with m2eclipse within Eclipse the archetypes already allow you for both maven compile and Eclipse's plug-in deploy on Tomcat, but builds are independant. This helps you develop the views that dont require app or server restart.
accepted answer of: http://stackoverflow.com/q/23668854
upvote count: 1
answers question: http://stackoverflow.com/q/23668854
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36313739
score: 0
type: AnswerComment
has text: When you're not sure about the version of Eclipse you're using, you should *tell us* which version you're using. Being able to export an Executable Jar is a recent feature.
type: Comment
comment on: http://stackoverflow.com/a/23640888

http://stackoverflow.com/q/23729774
answer count: 1
has answer: http://stackoverflow.com/a/23730113
type: UnansweredQuestion
has title: Getting directory path of the master executable .jar file
linked to: http://stackoverflow.com/q/320542
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36475839
has body: In debugging I found that my current way of storing a database's files (embedded derby database) didn't work when running the executable .jar file that's compiled by NetBeans 8.0. Simply put, I need a way of getting the application to find the directory the .jarfile is being run from, and to set up the embedded DB database in the same directory. In case it helps, the current way I get it to 'work' (within the IDE) is as follows: public final void setDBSystemDir() throws UnsupportedEncodingException, SQLException{ String path = DataBase.class.getProtectionDomain().getCodeSource().getLocation().getPath(); String decodedPath = URLDecoder.decode(path, "UTF-8"); String systemDir = decodedPath + "/listData/"; System.setProperty("derby.system.home", systemDir); } Any pointers welcome.

http://stackoverflow.com/comment/36338524
comment on: http://stackoverflow.com/q/23658104
score: 0
type: QuestionComment
type: Comment
has text: linked in my comment before :)

http://stackoverflow.com/a/23730512
downvote count: 0
has comment: http://stackoverflow.com/comment/36477150
type: Answer
answers question: http://stackoverflow.com/q/23730416
has comment: http://stackoverflow.com/comment/36477086
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36477121
has body: Switch-case works with primitive, Enums and String(from java 7) data type. So in your case you can use class#getName which return string and if you are using java 7. switch(type.getName()){ case ("java.lang.String"): //... break; case ("java.lang.Integer"): //... break; ... }

http://stackoverflow.com/comment/36356839
type: Comment
type: QuestionComment
has text: I will go with `y/n` option in this case.
comment on: http://stackoverflow.com/q/23667462
score: 0

http://stackoverflow.com/a/23689924
has body: Checked the http header. SiteMinder sets their Cookie to SMSESSION by default. However this cookie isn't controlled by Spring Security. SiteMinder must deploy a logout URL and configured accordingly. Solution: &lt;logout delete-cookies="JSESSIONID,SMSESSION" logout-success-url="/" invalidate-session="true" logout-url="/logout.html"/&gt; If you want to delete multiple cookies separate them using commas. The delete-cookies attribute A comma-separated list of the names of cookies which should be deleted when the user logs out. Reference: http://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity-single.html
score: 4
answers question: http://stackoverflow.com/q/23688322
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/67240531
accepted answer of: http://stackoverflow.com/q/23688322

http://stackoverflow.com/comment/36473764
score: 0
comment on: http://stackoverflow.com/q/23728517
type: Comment
type: QuestionComment
has text: no it's not a hiDPI screen, java -version = 1.8.0. Actually, i forgot to mention it before, but the two image samples that i put in the question were taken on the same machine.

http://stackoverflow.com/comment/36417263
score: 0
type: Comment
has text: I cannot do a lot of tests, cuz the messagePlayer method only message the player once then saves that he got messaged in a preference, then it will be ignored if he scores the same next time, that is why he can get messaged for both scores ..
type: QuestionComment
comment on: http://stackoverflow.com/q/23699595

http://stackoverflow.com/comment/36342342
comment on: http://stackoverflow.com/a/23659740
type: Comment
has text: So is that means no matter what the reference type the object is when it was declared, I only need to make sure the 'real' type of this object is from a class extend from A, B or C?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23744943
accepted answer: http://stackoverflow.com/a/23745071
has title: Having unknown error with Getters and Setters
score: 1
tagged with: java
tagged with: setter
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36504067
downvote count: 0
tagged with: variables
tagged with: getter
has comment: http://stackoverflow.com/comment/36504199
has body: I have some code that is utilising a variable from one class to another, I am using getters and setters and I checked that when i setClassName() before changing class that it works but i can't acces it properly from the other class, it return's null. http://pastebin.com/6AP4c6ii -- CLASS A http://pastebin.com/QCnWDnYs -- CLASS B There is more code but it's relatively messy and long, im a noob to this and am working on ways to improve my coding and this is just a little project. Any help appreciated.
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/36503958
has comment: http://stackoverflow.com/comment/36504111
has comment: http://stackoverflow.com/comment/36504496
has answer: http://stackoverflow.com/a/23745065
has answer: http://stackoverflow.com/a/23745071
upvote count: 1
possible better answer: http://stackoverflow.com/a/23745065
has comment: http://stackoverflow.com/comment/36504393
type: AnsweredQuestion

http://stackoverflow.com/q/23625846
type: Question
tagged with: hibernate-search
has title: Consult 2 class in Hibernate Search DSL
has comment: http://stackoverflow.com/comment/36323112
score: 0
has body: I'm using hibernate search DSL 4.4.0. And I met a problem recently. E.g, I have 2 classes INDEXING and DATA_PROPERTY and I can't change them or creat a new class to associate 2 of them. Now in the SQL, I use SELECT IND.RDF_RESOURCE FROM INDEXING IND, DATA_PROPERTY DP WHERE IND.RDF_RESOURCE = DP.RDF_RESOURCE AND IND.OBJECT_TYPE_ID_INDEXED IN (........) AND DP.PARTITION_VALUE IN (......) AND ....... Part of Lucene indexing: mapping.entity(DatatypeProperty.class).indexed().providedId() .property("rdfResource",ElementType.FIELD).field().analyze(Analyze.NO).store(Store.YES) .property("partitionValue", ElementType.FIELD).field().analyze(Analyze.NO) mapping.entity(Indexing.class).indexed().providedId() .property("rdfResource",ElementType.FIELD).field().analyze(Analyze.NO).store(Store.YES) There is no association between 2 of them. How can I translate IND.RDF_RESOURCE = DP.RDF_RESOURCE in Hibernate Search DSL??? I have blocked here for a long time, thx for helping......
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36338082

http://stackoverflow.com/comment/36296291
type: QuestionComment
score: 0
has text: Specify the shell you want to use for the shell script. String[] command = {"/bin/bash", "/home/pi/tbe/testSleep.sh"}; Or add shebang in the script itself - #!/bin/bash (as first line).
comment on: http://stackoverflow.com/q/23636593
type: Comment

http://stackoverflow.com/comment/36370494
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/52734/discussion-between-ankit-sharma-and-andrea-ligios)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23670842

http://stackoverflow.com/comment/36442333
comment on: http://stackoverflow.com/a/23712636
score: 0
has text: Thanks i will give reputation when i be able to do this.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23733804
score: -1
tagged with: twitter
tagged with: web-crawler
type: Question
upvote count: 0
tagged with: text-mining
has title: how to crawl twitter for specific tweets?
has answer: http://stackoverflow.com/a/23734235
has body: I am doing a project on social media framework for banking sector and as a part of it i am trying to collect all the tweets from twitter which contains certain keywords.So do i have to write a crawler all on my own from the scratch or are there any available tools for this.If i have to write my own crawler,is writing in JAVA advisable?and any links which will guide me how to get started with coding a crawler.I dont want the code but only guidelines on how to code it. And any good links about how crawler works etc would also be very helpful.
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 1
tagged with: java

http://stackoverflow.com/q/23708522
has title: Calling paintComponent() with parameters using repaint()
answer count: 1
tagged with: graphics
tagged with: java
has answer: http://stackoverflow.com/a/23708548
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23708548
type: Question
has body: I am very new to graphics with Java, so just ask if any additional information is needed :) I am trying to paint shapes based on where the mouse clicks on the screen. Because of this, I need to pass the x and y coordinates of where I clicked to the paintComponent() method so that it will know where to paint the shape. public void mouseClicked(MouseEvent e) { System.out.println("Adding Shape"); repaint(); } class CanvasDrawArea extends JPanel{ //this should run when the program first starts @Override public void paintComponent(Graphics g){ super.paintComponent(g); canvas.setBackground(CANVAS_COLOR); } //here is where the question is public void paintComponent(Graphics g, int x, int y){ super.paintComponent(g); g.fillRect(x, y, RECTANGLE_WIDTH, RECTANGLE_HEIGHT); } } basically I am trying to overload the paintComponent by having one that runs right when the program starts by calling the repaint() / pack() method, and one that will run when I give it the x and y coordinates. I am unsure, however, how I am supposed to go about passing the x and y parameters, as there is no way to pass them in the repaint() method.
tagged with: jframe
score: 0

http://stackoverflow.com/comment/36461906
type: AnswerComment
comment on: http://stackoverflow.com/a/23721905
type: Comment
score: 0
has text: @Snowbird but do they have a _maximum_ size?

http://stackoverflow.com/comment/36490628
comment on: http://stackoverflow.com/a/23737419
has text: @ggovan -Thanks.. Ya.. Pretty dumb of me to use "null"... :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36452990
has text: @user142712 Just curious, why not add any code to the `Link` class? You don't even need to put it into the `Link` class, as the fields you need to access are `public` anyways, so once the method is written it really should be as simple as `array[x].nodeAt(i)` to get the ith node.
score: 0
comment on: http://stackoverflow.com/a/23718086
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23724311
has body: The flyweight pattern is a way to handle a situation where what you're trying to accomplish uses a lot of the same type of object. Rather than create a new instance of an object every time, the flyweight pattern reuses objects, only requiring that you track the differences in their usage. The word processor is the classic example. From your Wikipedia example: It might be desirable to have, for each character in a document, a glyph object containing its font outline, font metrics, and other formatting data, but this would amount to hundreds or thousands of bytes for each character. Instead, for every character there might be a reference to a flyweight glyph object shared by every instance of the same character in the document; only the position of each character (in the document and/or the page) would need to be stored internally. This is an accurate description of how the pattern would be used. Following your intrinsic/extrinsic distinction, the glyph objects would be the intrinsic state and the placement of those objects (e.g. what page, paragraph, and line they appear on) would be the extrinsic state/usage of the object. From your question, where I think you get confused in the example is as to what can be considered an extrinsic/intrinsic attribute. This is likely because the attributes you describe, font style, font colors, and typeface would all be reused as part of the flyweight pattern and so would be "intrinsic" in the sense that they are part of the flyweight pattern but "extrinsic" in the sense that you would account for their application to specific words of letters. For example, in a word processor you likely would have a set of glyphs for the different typefaces in bold, italic, etc; a collection of available colors could also be applied and reused. The program would then track where these attributes were applied but they would not be pure extrinsic states as you describe above. As for your code above I am not sure how it fits into the flyweight example…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36465008
has comment: http://stackoverflow.com/comment/36465065
has comment: http://stackoverflow.com/comment/36464951
has comment: http://stackoverflow.com/comment/36464977
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23724029
has comment: http://stackoverflow.com/comment/36464925
answers question: http://stackoverflow.com/q/23724029
score: 6
has comment: http://stackoverflow.com/comment/36469809
has comment: http://stackoverflow.com/comment/36464887

linked-list
tags question: http://stackoverflow.com/q/23725853
tags question: http://stackoverflow.com/q/23672725
tag name: linked-list
tags question: http://stackoverflow.com/q/23751016
tags question: http://stackoverflow.com/q/23675753
type: Tag
tags question: http://stackoverflow.com/q/23621342
tags question: http://stackoverflow.com/q/23667243
tags question: http://stackoverflow.com/q/23677835
tags question: http://stackoverflow.com/q/23648992
tags question: http://stackoverflow.com/q/23717665
tags question: http://stackoverflow.com/q/23680702
tags question: http://stackoverflow.com/q/23643338

http://stackoverflow.com/a/69160814
answers question: http://stackoverflow.com/q/23626194
score: 0
has body: In terms of Literals, the following approach worked for me: SELECT (str(?hotel) as ?hotelstr) ...
type: Answer

http://stackoverflow.com/a/23722811
type: Answer
has body: Try this: int counter = 0; TextVeiw tv = (TextView) findViewById(R.id.textView); Button button = (Button ) findViewById(R.id.but); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub counter++; if(counter%2==0){ tv.setVisibility(View.Visible);//show } else { tv.setVisibility(View.Gone);//hide } } });
has comment: http://stackoverflow.com/comment/36462149
answers question: http://stackoverflow.com/q/23722762
has comment: http://stackoverflow.com/comment/36462072
has comment: http://stackoverflow.com/comment/36462122
score: 0

http://stackoverflow.com/q/23625154
type: Question
has body: I'm writing my grammar but I have problem to allowing blank spaces. My grammar work if I write 'hello' + 'world' but if I try to compile operations like the following I have problems: 'hello' + ' world' This are my grammar files: grammar Common; identifierNum: hostId DOT observableId DOT method ':Num'; identifierString: hostId DOT observableId DOT method ':String'; hostId: ID; observableId: ID; method: ID'('')'; MUL: '*'; DIV: '/'; ADD: '+'; SUB: '-'; DOT: '.'; MIN: '&lt;'; MAX: '&gt;'; ID: [a-zA-Z] [a-zA-Z0-9]*; STRING: '\''[a-zA-Z0-9]+ '\''; DIGIT: [0-9]+ ; DOUBLE: [0-9]* DOT [0-9]+ ; WS: [ \n\t]+ -&gt; skip; and this grammar Expression; import Common; expression: stringExpr # StringExpression | numExpr # NumExpression ; stringExpr: stringExpr ADD stringExpr # Concat | STRING # BaseStr | identifierString # IdString | '(' stringExpr ')' # ParensString ; numExpr: numExpr op=(MUL|DIV) numExpr # MulDiv | numExpr op=(ADD|SUB) numExpr # AddSub | DIGIT # Int | DOUBLE # Double | identifierNum # IdNum | '(' numExpr ')' # ParensNum ; Thanks for your help!
tagged with: antlr
tagged with: grammar
answer count: 1
has answer: http://stackoverflow.com/a/23625432
tagged with: antlr4
has title: Allowing blank spaces in antlr4
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23625432

http://stackoverflow.com/comment/36310452
type: Comment
has text: Thanks! by the way, how can I get the csrfToken via javascript? Im generating this form in a js file when the user clicks on 'Bulk upload' button
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23639430

http://stackoverflow.com/q/23729845
tagged with: swing
tagged with: java
has body: Getting a warning "uses unchecked or unsafe operations" when I compile and if there are any warnings what so ever my university lecturer marks you down even if it doesn't affect anything. public class Blah { JList listbox; public Blah { public String[] name = {"Joe", "John", "James"}; doSomething(name); } private void doSomething(String[] itemArray) { if(itemArray != null) { listbox = new JList(itemArray); } } } For some reason the error comes up for the line listbox = new JList(itemArray); and I need to get rid of it. Any ideas?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23729882
tagged with: arraylist
has answer: http://stackoverflow.com/a/23729882
has answer: http://stackoverflow.com/a/23729876
type: Question
tagged with: jlist
has comment: http://stackoverflow.com/comment/36476025
has comment: http://stackoverflow.com/comment/36475964
accepted answer: http://stackoverflow.com/a/23729876
has title: Unchecked or unsafe operations. array to JList
score: 0
answer count: 2

http://stackoverflow.com/comment/36337560
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23645234
type: Comment
has text: I updated my answer to address those questions in more detail. Let me know if that makes it more clear!

http://stackoverflow.com/a/23722342
answers question: http://stackoverflow.com/q/23722282
score: 0
has body: In your code, you are re-creating the newMoveClass object every time your code runs through the do-while. You need to modify your code a little so that the instance of MoveClass you created is the same for all the iterations of the loop, like this: MoveClass newMoveClass = new MoveClass(); do{ newMoveClass.MoveAround(); newMoveClass.Location(); System.out.println("move again?"); answer = replay.next(); } while(answer.equals("yes")); A more general example might look something like this: ArrayList&lt;Integer&gt; results = new ArrayList&lt;Integer&gt;(); while(&lt;some condition&gt;) { // do computation with Integer temp Integer temp = new Integer(100); results.add(temp); } After the while loop condition no longer holds, you will have the results in the ArrayList.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36460970
type: Answer
accepted answer of: http://stackoverflow.com/q/23722282
has comment: http://stackoverflow.com/comment/36461410

http://stackoverflow.com/comment/36322027
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23649650
has text: are you using an IDE?
score: 0

http://stackoverflow.com/a/23681969
answers question: http://stackoverflow.com/q/23681031
has comment: http://stackoverflow.com/comment/36385595
score: 0
has body: Try making a method that takes different "JComponents" as a parameter and set the size that way. Since JComponents are superclass of JOptionPane and others like it, you should be able to pass in a component parameter and set its size inside the method. I haven't tried it but It's something to look into. setComponentSize(JComponent jc){ jc.setPreferredSize(new Dimension(300, 300));//set size here jc.setLocation(new Point(10, 10)); //set location here //do other stuf partaining to certain components //like JOptionPanes, JDialogs if(jc instnceof JOptionPane){ //stuff }else if(jc instance of JDialog){ jc.show(); } } JOptionPane pane = new JOptionPane(); JDialog dialog = pane.createDialog("ej"); setComponentSize(dialog); of course if you do other stuff with each type you can rename the method. I found something you might check on for max sizes too. JComponent: how to set maximum width? If it doesn't compile for some reason check this one out.Why doesn&#39;t instanceof work with JPanel and JComponent?
type: Answer

http://stackoverflow.com/q/23625927
score: 0
has title: method selection in apache cxf with queryParam
answer count: 1
tagged with: rest
tagged with: path
type: AnsweredQuestion
tagged with: cxf
tagged with: java
has body: I created a java rest resource with 2 methods both listening on the same path, but one with @QueryParam annotation as method parameter @Path("test") public class TestResource { @GET public Response filter(){ System.out.println("init"); return Response.accepted("Hello world").build(); } @GET public Response filterQuery(@QueryParam("filter") String filterQuery) { return Response.accepted("filter: " + filterQuery).build(); //... parsing filter } } But when I try GET on ../test?filter=name:Juraj;location:Slovakia or on ../test it is always calling the filter() method Is it not enough to define the QueryParam to get the second method be called? I would like to offer the user to parametrize on the same url, not on the /test/filter?name=... Can I do this somehow? Using apache-cxf 3.0.0-milestone2
type: Question
has answer: http://stackoverflow.com/a/23628812
accepted answer: http://stackoverflow.com/a/23628812

http://stackoverflow.com/a/26551844
type: AcceptedAnswer
has body: Use Conditional-Package from maven-bundle-plugin to recursively inline all required packages in your JAR bundle and activate the tag true.
score: 4
answers question: http://stackoverflow.com/q/23737169
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/70720287
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23737169

http://stackoverflow.com/comment/36350758
comment on: http://stackoverflow.com/a/23664216
type: Comment
has text: Yes, but he is not using the SwingWorker directly, he is using a Thread inside the SwingWorker
type: AnswerComment
score: 0

http://stackoverflow.com/a/23664139
has comment: http://stackoverflow.com/comment/36350628
type: AcceptedAnswer
has body: If this is a Plugin project, you should maintain the build path via the manifest editor for the plugin (the same editor manipulates both manifest.mf and plugin.xml). That's where you declare the dependencies that the plugin has, which in turn automatically maintains the build path. There are a couple of ways of expressing a dependency, either as a Required Plug-in or as an Imported Package. or
type: Answer
accepted answer of: http://stackoverflow.com/q/23663726
answers question: http://stackoverflow.com/q/23663726
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/32944263
has comment: http://stackoverflow.com/comment/103173508
downvote count: 0
has comment: http://stackoverflow.com/comment/53757139
upvote count: 34
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/127275301
has body: Change the bean id from "localResolver" to "localeResolver"
accepted answer of: http://stackoverflow.com/q/23766446
type: Answer
score: 34
answers question: http://stackoverflow.com/q/23766446

http://stackoverflow.com/q/23616114
has answer: http://stackoverflow.com/a/23616933
tagged with: integer
has answer: http://stackoverflow.com/a/23616215
score: 0
answer count: 2
tagged with: quicksort
tagged with: java
accepted answer: http://stackoverflow.com/a/23616215
type: AnsweredQuestion
tagged with: arrays
has body: So I've been trying to get the average of my integer array and my method down there isn't doing the greatest because I'm trying to fit an object reference into a primitive.. I tried using intValue and I think im using it wrong.. any ideas? //Variation 3 - Choose Mean as pivot private static int getMeanIndexAsPivotIndex(Comparable comparableArray[],int leftIndex, int rightIndex) { int sum = 0; int add = 0; for (int i = 0; i &lt; comparableArray.length; i++) { add = comparableArray[i].intValue(); sum += add; } return sum / comparableArray.length; } Here is where I made my array //Random Array Integer[] unsortedArray = new Integer[8]; for (int i = 0; i &lt; unsortedArray.length; i++) { unsortedArray[i] = randomRange(0,1000); } QuickSort.java:157: error: cannot find symbol add = comparableArray[i].intValue(); ^ symbol: method intValue(int) location: interface Comparable Note: QuickSort.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
has title: using .intValue wrong?
type: Question
possible better answer: http://stackoverflow.com/a/23616933

http://stackoverflow.com/q/23650709
tagged with: classloader
tagged with: java
upvote count: 7
has title: Strange NPE when iterating over result of ClassLoader.getResources()
has comment: http://stackoverflow.com/comment/36325070
type: Question
score: 7
has answer: http://stackoverflow.com/a/31238091
answer count: 1
downvote count: 0
has body: I would assume that the following code is safe, nevertheless I am getting an NPE while invoking hasMoreElements(). Any ideas what might be wrong? I should add that I am using Java 1.7.0_55-b13 on Windows, 64 bit. final List&lt;URL&gt; urls = new ArrayList&lt;URL&gt;(); final String plUri = "META-INF/plugin.xml"; Enumeration&lt;URL&gt; urlsEn = Thread.currentThread().getContextClassLoader().getResources(pluginsUri); if (urlsEn != null) { while (urlsEn.hasMoreElements()) { // NPE happens here final URL u = urlsEn.nextElement(); urls.add(u); } } Stack trace: java.lang.NullPointerException at sun.misc.MetaIndex.mayContain(MetaIndex.java:243) at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:830) at sun.misc.URLClassPath$2.next(URLClassPath.java:273) at sun.misc.URLClassPath$2.hasMoreElements(URLClassPath.java:283) at java.lang.ClassLoader$2.hasMoreElements(ClassLoader.java:1322) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54) at com.github.jochen.afw.core.guice.GuiceComponentFactoryBuilder.getComponentUrls(GuiceComponentFactoryBuilder.java:256) at com.github.jochen.afw.core.guice.GuiceComponentFactoryBuilder.build(GuiceComponentFactoryBuilder.java:160) at com.github.jochen.afw.core.guice.GuiceComponentFactoryBuilderTest.testSuccessfullConfiguration(GuiceComponentFactoryBuilderTest.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ....
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20887509
has comment: http://stackoverflow.com/comment/38112937

http://stackoverflow.com/q/23630197
linked to: http://stackoverflow.com/q/3244400
has comment: http://stackoverflow.com/comment/36286307
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36286539
has answer: http://stackoverflow.com/a/23630460
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3188484
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/10880326
has title: Check if a JFrame is visible (another program is not in front of it)
has comment: http://stackoverflow.com/comment/36283405
has body: I have a Java swing program consisting of many JFrames, I know not the best design, but it does the job. If I open another program, for example Firefox, and maximize that window, my JFrames are not visible. Now when I click the button on the window taskbar of one of my JFrames the JFrame popups up. When this JFrame popups up I need check if one of my other JFrames are visible, I mean are in front of Firefox window. I tried isVisible(), isShowing() and isDisplayable(), but they always return true even when the JFrame is below the Firefox window. That makes sense when reading the Java documentation. But I can't seem to find a method to tells me if my JFrame is really visible in front of the Firefox window. It puzzles me. A JFrame covered by Firefox has the following properties: 14:50:08,129 DEBUG DrawFrame - isVisible: true 14:50:08,129 DEBUG DrawFrame - isDisplayable: true 14:50:08,129 DEBUG DrawFrame - isShowing: true Just to explain my goal: I have multiple JFrames and when I click one specific JFrame button on the window taskbar I want to check if another JFrame is visible for the user. If it is not visible for the user (for example when covered by another program) than I want to make it visible. Making it visible is simple: WindowListener windowActivated and call toFront on the not visible frame, but of course this causes a loop when the other JFrame is activated again (calling windowActivated &gt; toFront &gt; windowActivated &gt; toFront, and so on). That is why I need to check the visibility before calling the toFront method. I'm not aware of a function in Java to check if a window is visible for the user, so going native may be the only solution.
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23761791
tagged with: cygwin
has comment: http://stackoverflow.com/comment/36563925
has comment: http://stackoverflow.com/comment/36563647
has comment: http://stackoverflow.com/comment/36551880
has comment: http://stackoverflow.com/comment/36548090
answer count: 1
has comment: http://stackoverflow.com/comment/36561676
favorite count: 0
has answer: http://stackoverflow.com/a/23776289
accepted answer: http://stackoverflow.com/a/23776289
tagged with: maven
has title: Maven release plugin can't commit - E155010 with node path having path twice - Cygwin & DOS
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has body: I'm having issues with my maven and svn set up. I have recently been playing with git and now I'm seeing issues with SVN. I have a feeling an install forced SVN to update, but it doesn't look to be the case from the look of my installed software. I am using cygwin, but the issues also arise when I try this through the command prompt. The setup I have on my machine is: svn, version 1.7.14 (r1542130) Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 13:51:28+0000) SlikSvn 1.7.17 Cygwin 1.7.29(0.272/5/3) I am able to commit to SVN and update from it using Tortoise SVN (version 1.7.14) but whenever I try to release my application with the release:prepare and release:perform commands, I get the following failures. The issue is that the path for the checkout is being concatenated to itself. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [INFO] BUILD SUCCESS [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [INFO] Total time: 23.693s [INFO] [INFO] Finished at: Tue May 20 14:19:59 BST 2014 [INFO] [INFO] Final Memory: 17M/138M [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Checking in modified POMs... [INFO] Executing: cmd.exe /X /C "svn --non-interactive commit --file C:\cygwin\tmp\maven-scm-1575361850.commit --targets C:\cygwin\tmp\maven-scm-6249519314346478050-targets" [INFO] Working directory: C:\Users\danielt\Workspace\Common\Adapters\Zuul\trunk [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 35.022s [INFO] Finished at: Tue May 20 14:19:59 BST 2014 [INFO] Final Memory: 13M/100M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on p…
tagged with: svn
downvote count: 0

http://stackoverflow.com/a/23743466
type: Answer
accepted answer of: http://stackoverflow.com/q/23742666
score: 1
upvote count: 1
has body: Your method is named getEditTeszt(), which makes it eligible to be a bean property by convention (with the get prefix and a return value). So when you use "#{TesztBean.editTeszt}" for you actionListener, it's reading it as a property and not a method, as you are leaving out the get in the getEditTeszt. Hence the exception message "Method not found", as a method is required. A simple fix would be just to put in the get &rarr; "#{TesztBean.getEditTeszt}". But in this context, it makes no sense. First of all, your action listener method has no reason to return anything. Especially when all you're doing is returning null. You should rather make the method return void. You may be mistaking/missing the difference between actionListener and action, the latter being the one where you do want to return a string, for navigational purposes. Read more at Differences between action and actionListener I would change the name of the method to something else more semantically appropriate. You should avoid using get for your method prefix, unless they are actual getters. You've just met one of the reason why.
has comment: http://stackoverflow.com/comment/36523193
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23742666

http://stackoverflow.com/q/23767953
tagged with: google-cloud-endpoints
type: AnsweredQuestion
tagged with: java
type: Question
has title: Using Google Cloud Endpoints with Cloud SQL and Cloud DataStore in a polygot architecture
has body: I was going through the possibility of building an universal data backend with Google Cloud Endpoints but because I was considering it for a business application so I needed to have Google Cloud SQL as my data storage and use Google Cloud DataStore to store configuration level data. This architecture really intrigued me to find more about the possibility of how to do this with Java but I'm astonished that there is not one single resource on the web where somebody show you how to use Google Cloud Endpoints with Google Cloud SQL, not even google has some documentation of how to achieve this. Does this mean that is impossible to achieve this in Google Cloud infrastructure. Can somebody point me to some resource or atleast shed some light onto this matter. Please I'd be very obliged to get some replies.
score: 0
tagged with: google-cloud-datastore
answer count: 1
tagged with: google-cloud-sql
has answer: http://stackoverflow.com/a/23784736
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/23784736

http://stackoverflow.com/comment/36540757
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23763351
has text: Nope,I'm afraid you're making a mistake. The 3.2.3 dependencies are spring security dependencies. It seems to be the last stable version.

http://stackoverflow.com/comment/36498986
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23742354
score: 0
has text: Hi! Your code is too complicated to easily read and figure out what is going, and with it all being written in Spanish it's especially difficult to follow for most of us (being native english speakers). Please read this guide on [how to provide a Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve) so we can help you better!

http://stackoverflow.com/comment/36422361
score: 0
type: QuestionComment
type: Comment
has text: What IDE are you using?
comment on: http://stackoverflow.com/q/23683708

http://stackoverflow.com/a/23701973
downvote count: 0
answers question: http://stackoverflow.com/q/23701943
type: Answer
upvote count: 33
has body: Are you just sorting Strings? If so, you don't need lambdas; there's no point. You just do import static java.util.Comparator.*; list.sort(naturalOrder()); ...though if you're sorting objects with a String field, then it makes somewhat more sense: list.sort(comparing(Foo::getString));
score: 33

http://stackoverflow.com/comment/36305350
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23641112
has text: @arshajii work with the elements I guess I could have said

http://stackoverflow.com/comment/36396158
type: QuestionComment
has text: Where would you expect to use this?
score: 2
type: Comment
comment on: http://stackoverflow.com/q/23687944

http://stackoverflow.com/a/23634136
upvote count: 1
answers question: http://stackoverflow.com/q/23633776
has body: If we agree that a method should do one thing well, I'd say this is a bad implementation. Each of those SQL operations ought to have a separate method. Each try/catch/finally should create and close resources in the narrowest scope possible (method scope). You can't have commit/rollback logic if you acquire the Connection. I'd suggest passing it into your SQL methods. Let a service or business layer, that knows about units of work, acquire the Connection and commit or rollback. I'd also say you're repeating a lot of code unnecessarily. I'd refactor to make this DRY-er.
downvote count: 0
has comment: http://stackoverflow.com/comment/36291347
type: Answer
has comment: http://stackoverflow.com/comment/36291439
score: 1

http://stackoverflow.com/comment/36400080
comment on: http://stackoverflow.com/a/23689832
type: AnswerComment
score: 0
type: Comment
has text: I think this structure is a good idea, but I find the `try .. finally { acquire }` quite strange. I'm not sure, but is that the right way to handle the case of a possible exception in the center?

http://stackoverflow.com/comment/36433907
comment on: http://stackoverflow.com/q/23707938
type: QuestionComment
has text: I am sorry that I am not quite understand the error message clearly and want to confirm whether the problem is on **useMe(TypeTest<? extends K> k)** for its boundary is larger than class declaration.
score: 0
type: Comment

http://stackoverflow.com/q/23631608
has comment: http://stackoverflow.com/comment/36287378
tagged with: java
has body: I would like to set a CheckBox ReadOnly when my new window pop up. Here is my code. getForm().getField("foreign").addValueChangeListener( new Property.ValueChangeListener(){ @Override public void valueChange(Property.ValueChangeEvent event) { changeValueForCurrency(event.getProperty().getValue()); } } ); Tried to let it happen by calling the changeValueForCurrency() changeValueForCurrency(getForm().getField("foreign")); Does not work. My mate told me something about to fire it, but It doesn't has any methods like firing it. Also, I tried to set this method below true; setImmediate(true); Still does not work
has comment: http://stackoverflow.com/comment/36301561
type: Question
tagged with: vaadin
has comment: http://stackoverflow.com/comment/36285939
score: 0
has comment: http://stackoverflow.com/comment/36290575
answer count: 1
has answer: http://stackoverflow.com/a/23775989
has title: valueChangeListener doesn't fire
type: UnansweredQuestion

http://stackoverflow.com/q/23647580
has answer: http://stackoverflow.com/a/47340512
has answer: http://stackoverflow.com/a/23647732
has comment: http://stackoverflow.com/comment/36318099
tagged with: java
has comment: http://stackoverflow.com/comment/36317992
possible better answer: http://stackoverflow.com/a/47340512
score: 6
has body: I have a huge file in the format: x a y c x d z a z s y k I want that the output will be sorted and in the form x a,d y c,k z a,s,k For this type of task a hash is the best: The straightforward TreeMap solution would be this: Map&lt;String, StringBuilder&gt; agg = Maps.newTreeMap(); while ((line = r.readLine()) != null) { String[] arr = line.split("\t"); String key = arr[0]; String value = arr[1]; if(agg.containsKey(key)) { agg.get(key).append(",").append(value); } else { agg.put(key, new StringBuilder(value)); } } } r.close(); System.out.println("Printing results"); FileWriter f = new FileWriter("out.txt"); for (String key : agg.keySet()) { f.write(key+"\t"+agg.get(key)+"\n"); } Another option would be to use a hashmap, take the keyset, sort it and iterate over it. The different part would be System.out.println("Sorting array"); List&lt;String&gt; keys = Lists.newArrayList(agg.keySet()); Collections.sort(keys); System.out.println("Printing results"); FileWriter f = new FileWriter("out.txt"); for (String key : keys) { f.write(key+"\t"+agg.get(key)+"\n"); } For me the big O is less important because it is a batch job. For me the memory usage is much more important. Which strategy is more efficient in terms of memory? HashMap and the peek in the sort phase or the TreeMap approach
has comment: http://stackoverflow.com/comment/36317762
has title: treemap vs hashmap and sort in terms of memory usage
has comment: http://stackoverflow.com/comment/36317713
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23647980
favorite count: 0
accepted answer: http://stackoverflow.com/a/23647732
type: Question
upvote count: 6
answer count: 3
has comment: http://stackoverflow.com/comment/36317800
tagged with: collections

http://stackoverflow.com/a/23755110
type: Answer
answers question: http://stackoverflow.com/q/23755037
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36573792
accepted answer of: http://stackoverflow.com/q/23755037
score: 0
has body: Just precise your libraries versions explicitly in your POM for project B: org.springframework spring-jdbc 3.1.O.RELEASE org.springframework spring-aop 3.1.O.RELEASE It will override any transitive dependency version. Be sure to precise all Spring artifacts as there are a lot. Best way would be to include all Spring deps in dependencyManagement in parent using spring.framework.version property. Then override this property to the correct version in project B: <spring.framework.version>3.1.O.RELEASE</spring.framework.version>
has comment: http://stackoverflow.com/comment/36778645

http://stackoverflow.com/comment/36549982
comment on: http://stackoverflow.com/q/23768355
type: QuestionComment
score: 0
has text: read the documentation for `execute`.
type: Comment

http://stackoverflow.com/comment/89634041
score: 0
type: AnswerComment
type: Comment
has text: Hi, I was having the same question since I am new to javafx. Thanks a lot, this answer is a very good example. In addition to this I would like to ask if it's better to create the scenes using a scenebuilder (.fxml) or dynamically using code. What is better for performance? Loading a scene takes faster than dynamic building them each time when the appropriate button is pressed? Thanks!
comment on: http://stackoverflow.com/a/23629876

http://stackoverflow.com/q/23663629
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36388963
tagged with: java
has title: Value of JSESSIONID is not changed on invalidating session
has answer: http://stackoverflow.com/a/23733305
type: Question
upvote count: 2
answer count: 2
tagged with: tomcat
favorite count: 0
tagged with: jsessionid
has answer: http://stackoverflow.com/a/23746129
accepted answer: http://stackoverflow.com/a/23746129
has comment: http://stackoverflow.com/comment/36350083
possible better answer: http://stackoverflow.com/a/23733305
has body: I needed to change JSESSIONID's domain to ".something.com" in a context.xml file: &lt;Context path="/test" sessionCookiePath="/" sessionCookieDomain=".something.com" useHttpOnly="true" /&gt; After that, when I perform a httpSession.invalidate() the session is reset but JSESSIONID value does not change. I'm using Java 7, Spring MVC and Tomcat 7. I also tried to remove the JSESSIONID cookie manually, but it seems that Tomcat or Spring are not letting I change its value. This may difficult troubleshooting on my system. I'd like to know if it's possible to change this behavior either on Spring or in Tomcat.
tagged with: tomcat7
tagged with: spring-mvc

http://stackoverflow.com/comment/36509751
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23747810
has text: That doesn't sound like random numbers to me.
score: 0

http://stackoverflow.com/q/23643992
answer count: 3
has comment: http://stackoverflow.com/comment/36425188
has body: Me again. I have to write a program that converts Fahrenheit to Celsius and vice versa using the commande line for school. I am very new to code and I have trouble location my problem. I have this code public class Temperature { public static void main(String[] args) { for (int i = 0; i < args.length; i++) { int a = Integer.parseInt(args[0]); int b = Integer.parseInt(args[1]); System.out.println ("Veuillez specifier c (celsius) ou f (fahrenheit) suivi de la température. Exemple argc arg32"); if (args[0].equals ("c")) { /*convertir en fahrenheit*/ double z = (1.8 * b) + 32; System.out.print ("La température est" + z); } else if (args[0].equals ("f")) { /*convertir en celsius*/ double y = (b - 32)/1.8; System.out.print("La température est" + y); } } } } My idea was to use to command line to first choose the unit then the temperature like so java Temperature c 35 But I get a bunch of errors when I try it. My guess being that I can't use in string in the command line? c being a string? I get the errors Exception in thread "main" java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInput.String(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Temperature.main(Temperature.java:12) I did not get any error while compiling though
has comment: http://stackoverflow.com/comment/36311194
has answer: http://stackoverflow.com/a/23644008
has answer: http://stackoverflow.com/a/23644033
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23644008
tagged with: java
has comment: http://stackoverflow.com/comment/36311059
has comment: http://stackoverflow.com/comment/36425841
has answer: http://stackoverflow.com/a/23644453
has title: Using a string in the command line
type: Question
accepted answer: http://stackoverflow.com/a/23644033
score: 0

http://stackoverflow.com/q/23730382
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23730677
has comment: http://stackoverflow.com/comment/36477135
has comment: http://stackoverflow.com/comment/36476866
has body: I have a Java file "RemoteXMLRead.java" with the lines: import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.apache.commons.io.filefilter.WildcardFileFilter; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; import java.io.File; import java.io.FileFilter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class RemoteXMLRead { public static void main(String argv[]) { Connection conn = null; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url3 = "jdbc:sqlserver://127.0.0.1:1433;databaseName=TestPerfomenceTrack"; conn = DriverManager.getConnection(url3, "reliantUser", "F4C78266-021e"); Statement stmt = conn.createStatement(); String sql = ""; List&lt;File&gt; files = listf("C:\\jenkins\\jobs\\AdvBackOffice\\builds"); File dir = new File(files.get(258), sql); FileFilter fileFilter2 = new WildcardFileFilter("*.xml"); File[] files2 = dir.listFiles(fileFilter2); File fXmlFile = files2[1]; System.out.println(fXmlFile); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("case"); for (int temp = 0; temp &lt; nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; sql="EXEC [spXMLDataForTestCasesTrack] " + "'"+eElement.getElementsByTagName("duration").item(0).getTextContent()+"'," + "'"+eElement.getElementsByTagName("className").item(0).getTextContent()+"'," + "'"+eElement.getElementsByTagName("testName").item(0).getTextContent()+"'," + "'"+eElement.getElementsByTagName("skipped").item(0).getTextContent()+"'," + ""+eElement.getElementsByTag…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36477578
tagged with: apache
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36477326
linked to: http://stackoverflow.com/q/12291058
has title: error: package org.apache.commons.io.filefilter does not exist

html-email
tags question: http://stackoverflow.com/q/23717667
tags question: http://stackoverflow.com/q/23721464
type: Tag
tag name: html-email

http://stackoverflow.com/comment/36511611
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23748422
has text: This is a 'top level' class in Processing i.e. in a separate tab, but maybe Processing on compilation embeds it in another class, I don't know. I have no experience of Java, but I do know C# pretty well and yeah I wouldn't program like this in C#, but Processing is geared in a C like way.

jdbc
tags question: http://stackoverflow.com/q/23700376
tags question: http://stackoverflow.com/q/23653036
tags question: http://stackoverflow.com/q/23777581
tags question: http://stackoverflow.com/q/23686030
tags question: http://stackoverflow.com/q/23732409
tags question: http://stackoverflow.com/q/23679324
tags question: http://stackoverflow.com/q/23760981
tags question: http://stackoverflow.com/q/23650021
tags question: http://stackoverflow.com/q/23747817
tags question: http://stackoverflow.com/q/23714579
tags question: http://stackoverflow.com/q/23667818
tags question: http://stackoverflow.com/q/23696775
tags question: http://stackoverflow.com/q/23625439
tags question: http://stackoverflow.com/q/23766462
tags question: http://stackoverflow.com/q/23672722
tags question: http://stackoverflow.com/q/23739849
tags question: http://stackoverflow.com/q/23709883
tags question: http://stackoverflow.com/q/23631144
tags question: http://stackoverflow.com/q/23626727
tags question: http://stackoverflow.com/q/23621705
tags question: http://stackoverflow.com/q/23735509
tags question: http://stackoverflow.com/q/23636814
tags question: http://stackoverflow.com/q/23711419
type: Tag
tags question: http://stackoverflow.com/q/23716084
tags question: http://stackoverflow.com/q/23629665
tags question: http://stackoverflow.com/q/23756645
tags question: http://stackoverflow.com/q/23672689
tags question: http://stackoverflow.com/q/23680750
tags question: http://stackoverflow.com/q/23645355
tags question: http://stackoverflow.com/q/23724960
tags question: http://stackoverflow.com/q/23766423
tags question: http://stackoverflow.com/q/23762621
tags question: http://stackoverflow.com/q/23674828
tags question: http://stackoverflow.com/q/23627476
tags question: http://stackoverflow.com/q/23757967
tags question: http://stackoverflow.com/q/23768553
tags question: http://stackoverflow.com/q/23750834
tags question: http://stackoverflow.com/q/23776145
tags question: http://stackoverflow.com/q/23688213
tags question: http://stackoverflow.com/q/23684790
tags question: http://stackoverflow.com/q/23733263
tags question: http://stackoverflow.com/q/23626951
tags question: http://stackoverflow.com/q/23639141
tags question: http://stackoverflow.com/q/23620485
tags question: http://stackoverflow.com/q/23771066
tags question: http://stackoverflow.com/q/23676422
tags question: http://stackoverflow.com/q/23700826
tags question: http://stackoverflow.com/q/23754456
tags question: http://stackoverflow.com/q/23626781
tags question: http://stackoverflow.com/q/23680881
tags question: http://stackoverflow.com/q/23709796
tags question: http://stackoverflow.com/q/23725832
tags question: http://stackoverflow.com/q/23685597
tags question: http://stackoverflow.com/q/23647819
tags question: http://stackoverflow.com/q/23763297
tag name: jdbc
tags question: http://stackoverflow.com/q/23714752
tags question: http://stackoverflow.com/q/23649187
tags question: http://stackoverflow.com/q/23648039
tags question: http://stackoverflow.com/q/23672933
tags question: http://stackoverflow.com/q/23628217
tags question: http://stackoverflow.com/q/23771539
tags question: http://stackoverflow.com/q/23699899
tags question: http://stackoverflow.com/q/23636059
tags question: http://stackoverflow.com/q/23628840

http://stackoverflow.com/q/23703440
answer count: 1
has title: Processing 2.2 not Running Program Properly
tagged with: processing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23706107
has comment: http://stackoverflow.com/comment/36427475
tagged with: java
has comment: http://stackoverflow.com/comment/36425438
has comment: http://stackoverflow.com/comment/36425603
type: Question
has body: I am writing a 3D game in Processing that starts using a menu. Once you press "Play", the camera is moved to another position for the actual game play. Since upgrading from Processing 2.1.1 to 2.2, I am having an issue with the code responsible for moving the camera. When running the program with Processing 2.1.1, the board looks as it should (see first screenshot). After upgrading to Processing 2.2 and using the same exact code, the resulting switch from menu to gameplay has been messed up (see second screenshot). What happens in Processing 2.2 is that whenever you press the "Play" button the proper camera position, seen in screenshot 1, flashes quickly, and the camera then moves up as seen in screenshot 2. Since this issue appears to be happening since upgrading the version of Processing I am using, I am attributing this change to a bug in Processing. Does anyone have any ideas as to what is going on here? I have been able to determine that the camera does not actually move, but rather the game board itself, which I have removed from these screenshots so you cannot see the game, is actually either not loading or disappearing despite no changes in code from 2.1.1 to 2.2. I posted this question on the Processing forums on Wednesday but did not receive any response. Processing 2.1.1 - Good Processing 2.2 - Bad
score: 0
has answer: http://stackoverflow.com/a/23706107

http://stackoverflow.com/a/23761058
upvote count: 6
has body: How could this be possible because Java Docs also says all fields in interface are public, static and final. From Java Language Specification. Chapter 9. Interfaces. 9.3. Field (Constant) Declarations (emphasis mine): Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields. If two or more (distinct) field modifiers appear in a field declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for ConstantModifier. This means that every field in the interface will be considered as a public constant field. If you add public, static and final or some of these modifiers or none of them, the compiler will add them for you. That's the meaning of implicitly. So, having this: interface Foo { String bar = "Hello World"; } Is similar to have interface Foo { public String bar = "Hello World"; } That is similar to interface Foo { static bar = "Hello World"; } The three interfaces will compile to the same bytecode. Also, make sure that your fields declaration in an interface follow the subnote. This means, you cannot narrow the visibility of a field in an interface. This is illegal: interface Foo { //compiler error! private String bar = "Hello World"; } Because bar won't be public and it defies the standar definition for fields in an interface.
has comment: http://stackoverflow.com/comment/36534715
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23760759
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23760759
score: 6
type: Answer

http://stackoverflow.com/comment/36779418
comment on: http://stackoverflow.com/a/23839405
type: AnswerComment
score: 0
has text: Padding should be made outside of the UV coordinates he use, not inside. If you have 32x32 sprite, padded 30px, but sample UVs 92x92px .. well, you will have neighbor sprites if those are not padded, which could be that case.
type: Comment

http://stackoverflow.com/comment/36332274
type: QuestionComment
comment on: http://stackoverflow.com/q/23653680
score: 0
has text: Thanks for the comment!!.I have added the start up log as well
type: Comment

http://stackoverflow.com/a/23684725
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23684386
has body: You can use Google gson . An excellent Java library to work with JSON. find it here: https://code.google.com/p/google-gson/ Using gson library classes you can do something like this: String myJson = "[{\"id\":4,\"quantity\":2,\"product\":{\"id\":2,\"productName\":\"Audi R8\",\"description\":\"The best of Audi\",\"cost\":1000000.0,\"rrp\":1500000.0,\"product_category\":[{\"id\":2,\"category\":{\"id\":1,\"categoryname\":\"Supercars\"}},{\"id\":3,\"category\":{\"id\":2,\"categoryname\":\"Sportscars\"}}]}}]"; JsonElement jsonElement = new JsonParser().parse(myJson); // This is because your json string is an array {} JsonArray myJsonAsArray = jsonElement.getAsJsonArray(); // Now inside the json array, you get an object, so get it first from '0' index JsonObject mainObject = myJsonAsArray.get(0).getAsJsonObject(); // Now you have a 'product' JsonObject inside the main object // You can directly get it by using String name JsonObject productObject = mainObject.getAsJsonObject("product"); // Once you have 'Product' object, you can get individual elements by following String productName = productObject.get("productName").getAsString(); // This will print out "Audi R8" System.out.println(productName); //You know how it works. Now get other individual elements of the product object by name I hope this helps.
type: Answer
has comment: http://stackoverflow.com/comment/36390933
score: 0
accepted answer of: http://stackoverflow.com/q/23684386

http://stackoverflow.com/comment/36284419
comment on: http://stackoverflow.com/a/23629269
type: Comment
type: AnswerComment
has text: From your example `cb.lineTo(PageSize.A4.width(), pos);` . I couldnt any method named `width()` ? Any suggestions ?
score: 0

http://stackoverflow.com/q/23667462
favorite count: 0
has comment: http://stackoverflow.com/comment/36356870
has answer: http://stackoverflow.com/a/23667516
tagged with: input
possible better answer: http://stackoverflow.com/a/44515971
answer count: 4
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36356854
has body: So i have to ask the user whether they are above 18 and they have to answer with a true or false. And keep looping until they enter the right input So far, i have this boolean b = false; do { try { System.out.print("Are you above 18?"); Scanner n = new Scanner(System.in); boolean bn = s.nextBoolean(); if (bn == true) { // do stuff } else if (bn == false) { // do stuff } } catch (InputMismatchException e) { System.out.println("Invalid input!"); } } while (!b); HOWEVER, it wont work as the loop keeps going and it wont read the input right and do my if statements. How do i fix this? Thanks!
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23667502
downvote count: 1
has comment: http://stackoverflow.com/comment/36356852
type: Question
accepted answer: http://stackoverflow.com/a/23667516
has comment: http://stackoverflow.com/comment/36356839
has answer: http://stackoverflow.com/a/23667558
has comment: http://stackoverflow.com/comment/36356862
has title: How to get boolean user input using scanner?
tagged with: boolean
has answer: http://stackoverflow.com/a/44515971

http://stackoverflow.com/q/23685035
has comment: http://stackoverflow.com/comment/36392842
tagged with: java
has answer: http://stackoverflow.com/a/23723003
tagged with: tdd
has title: Why/how does JUnit pass tests with compiler errors?
answer count: 2
tagged with: junit
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36404401
has comment: http://stackoverflow.com/comment/36390694
accepted answer: http://stackoverflow.com/a/23723003
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/23720670
upvote count: 3
has body: I've just started learning about TDD and am trying to write a simple project that way. I'm using Eclipse and JUnit, and every time I make a change I run all the tests in the relevant package. But then I'm very surprised to see in the package explorer that one of my test cases has a big red cross indicating a compiler problem... Annoyed I figured that I got my eclipse shortcuts mixed up and haven't been running all the tests, as they are all passing. But when I start fiddling about, I realise that it seems Eclipse + JUnit will run and pass tests even if there are compiler errors... The JUnit test case: import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class ATestCase { private Command command; private Invoker invoker; @Before public void setUp() throws Exception { command = new Command() { public void methodA(){}; //haven't implemented methodB() }; invoker = new Invoker(command); } @Test public void test(){ invoker.invoke(); } } interface Command{ void methodA(); void methodB(); } The Invoker class: class Invoker{ private Command command; public Invoker(Command command) { this.command = command; //if I invoke methodB() I get UnresolvedCompilationError } public void invoke(){ command.methodA(); //only if I call methodB here //do I get Unresolved compilation problem // command.methodB(); } } The command object I create in setUp in the test case only implements one of the interface's methods. This of course causes a compilation error warning in Eclipse. However unless I actually call that method in the test case, the test passes. If I do call the method, then the test fails with 'unresolved compilation error'. Can anyone explain to me what exactly is going on? ******EDIT****** I'm not sure why this was closed as a duplicate. Apparently I'm supposed to edit this question to make the difference clear: Well the question I'm supposed to be duplicating asks in the first line: What are the possible causes of a "java.lang.Error: Unresolve…
has answer: http://stackoverflow.com/a/23720670
linked to: http://stackoverflow.com/q/1124788
type: Question
has comment: http://stackoverflow.com/comment/36413288

http://stackoverflow.com/q/23654757
answer count: 1
has comment: http://stackoverflow.com/comment/36331746
score: 0
has comment: http://stackoverflow.com/comment/36332001
type: UnansweredQuestion
has body: I am using GWT and would like to call the Popup.Hide() method in the Library class MenuBar but it is private and the Object is private too... so what is the best way to get the method: If I create a complete new class which inherits from MenuBar, will not work I have to create 10 other classes which depend on the MenuBar, for example MenuItem, since MenuItems also hold private static variables, which seems too involved. unzip the .jar and change the method to public. another way?
has title: Java handle Private Method/Object in a Library
tagged with: gwt
has comment: http://stackoverflow.com/comment/36332140
has comment: http://stackoverflow.com/comment/36332169
has comment: http://stackoverflow.com/comment/36333208
tagged with: java
tagged with: overriding
has answer: http://stackoverflow.com/a/23666602
type: Question
has comment: http://stackoverflow.com/comment/36333066

http://stackoverflow.com/q/23704675
accepted answer: http://stackoverflow.com/a/23704705
has body: I'm trying to pass a subclass as a parameter and then create an instance of it, but I'm getting the error message on the line where I instantiate the transformation class (incompatible types). If I try to instantiate using transClass trans = new transClass(), it complains that transClass is unknown. Here's the code I'm using. abstract class Transformation { abstract public Object transform(Object obj); } class MyTransformation extends Transformation { public Object transform(Object obj){ // do stuff to obj return obj; } } class AnotherClass { public doSomething(Object obj, Class&lt;Transformation&gt; transClass){ // do more stuff to obj Transformation trans = new transClass(); // fails with "Incompatible Types", referring to 'Transformation' and 'transClass' // transClass trans = new transClass(); // alternate attempt, also fails with "Unknown Type" on 'transClass' return trans.transform(obj); } }
has answer: http://stackoverflow.com/a/23704705
type: AnsweredQuestion
has title: How to call method of class passed as parameter
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36427525
answer count: 1
has comment: http://stackoverflow.com/comment/36427486
score: 0

http://stackoverflow.com/q/23731084
tagged with: java
tagged with: javafx
type: Question
has title: Getting Errors parsing FXML file into a javafx program
score: -1
has body: Im Getting These Errors when trying to parse this FXML file into my Java Program.The code for when i load in the FXML file and where i get the errors are bellow package mediarealm; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.stage.StageStyle; public class MediaRealm extends Application { @Override public void start(Stage primaryStage) { Parent root = null; primaryStage.initStyle(StageStyle.UNDECORATED); try { root = FXMLLoader.load(getClass().getResource("/rsrc /UIManagmentDefaultState.fxml")); } catch (IOException ex) { Logger.getLogger(MediaRealm.class.getName()).log(Level.SEVERE, null, ex); } root.setStyle("-fx-background-color: #000000;"); Scene scene = new Scene(root, 1280, 720); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } It could possibly because of the code Bellow but I don't think it is i'm trying to load in some of the elements from the fxml file into the rest of my code so that i can have full access to said elements with java. package mediarealm; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.scene.control.Button; public class Controller { @FXML private Button ExitButton; @FXML private static Button myVideos; public static void doshit() { myVideos.setText("Addison is gay!"); }
answer count: 1
downvote count: 1
favorite count: 0
upvote count: 0
tagged with: fxml
has answer: http://stackoverflow.com/a/23731126
type: UnansweredQuestion

http://stackoverflow.com/q/23761204
tagged with: libgdx
answer count: 1
tagged with: tiled
score: 0
type: UnansweredQuestion
tagged with: android
has title: libGDX - How to copy tiles in a camera viewport instead of by layer?
tagged with: java
has answer: http://stackoverflow.com/a/23764762
type: Question
has body: I am trying to copy a set of tiles(Using Tiled and libGDX) that are within the camera's viewport. Right now I have a copy and paste code: package com.divergent.tapdown; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.maps.tiled.TiledMapTile; import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell; public abstract class TileMapCopier { public static TiledMapTile[][] copyRegion(TiledMapTileLayer layer, int x, int y, int width, int height) { TiledMapTile[][] region = new TiledMapTile[width][height]; for (int ix = x; ix &lt; x + width; ix++) for (int iy = y; iy &lt; y + height; iy++) { Cell cell = layer.getCell(ix, iy); if (cell == null) continue; region[ix - x][iy - y] = cell.getTile(); } return region; } public static void pasteRegion(TiledMapTileLayer layer, TiledMapTile[][] region, int x, int y) { for (int ix = x; ix &lt; x + region.length; ix++) for (int iy = y; iy &lt; y + region[ix].length; iy++) { Cell cell = layer.getCell(ix, iy); if (cell == null) { Gdx.app.debug(TileMapCopier.class.getSimpleName(), "pasteRegion: skipped [" + ix + ";" + iy + "]"); continue; } cell.setTile(region[ix - x][iy - y]); } } } This takes all the cells on the layer, and pastes it to the screen when I want it to: public void show() { final TiledMapTileLayer layer = ((TiledMapTileLayer) map.getLayers().get(0)); camera.position.x = layer.getWidth() * layer.getTileWidth() / 2; camera.position.y = layer.getHeight() * layer.getTileHeight() / 2; camera.zoom = 3; Gdx.input.setInputProcessor(new InputAdapter() { TiledMapTile[][] clipboard; @Override public boolean keyDown(int keycode) { if(keycode == Keys.C) // copy clipboard = TileMapCopier.copyRegion(layer, 0, 0, layer.getWidth(), layer.getHeight() / 2); if(keycode == Keys.P) // paste TileMapCopier.pasteRegion(layer, clipboard, 0, layer.getHeight() / 2); return true; } }); } This is great, but its not what I want. Instead of copying the whole layer I only want to copy what is inside…

http://stackoverflow.com/comment/36393077
has text: Have you tried something to add or delete data from your `JTable` ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23686431

http://stackoverflow.com/comment/36472509
comment on: http://stackoverflow.com/a/23727693
type: Comment
score: 1
has text: This is solution tightly couples the various components which would make it difficult to expand in the future which would be better served through the use of some kind of model/observer pattern as demonstrated in one of the [answers presented to the duplicate of this question](http://stackoverflow.com/questions/23713392/how-to-transfer-a-value-from-one-jlabel-to-another/23718319#23718319) which would indicate that the OP is simply after a copy-n-paste solution and not truley interested in learning to solve there own problems...
type: AnswerComment

http://stackoverflow.com/a/23732453
answers question: http://stackoverflow.com/q/23732360
type: AcceptedAnswer
downvote count: 0
score: 1
has body: every time you are rewriting new file. try as below, second argument (true) indicates to uses existing file. PrintWriter out = new PrintWriter(new FileWriter("test.txt",true)); Above answer is wrong..updated answer below... Edited code: May be user270349 is correct. below code works for me. public class ClientCounter { static int count = 0; static String input = ""; public static void main(String args[]){ addClient(); } public static int addClient() { try { BufferedReader in = new BufferedReader(new FileReader("test.txt")); input = in.readLine(); if (input != null) count = Integer.parseInt(input); System.out.println("Client count is: " + count); count++; in.close(); System.out.println("After increment, count is: " + count); PrintWriter out = new PrintWriter(new FileWriter("test.txt")); String output = Integer.toString(count); System.out.println("Output is " + output); out.println(output); out.flush();out.close(); } catch(FileNotFoundException e) { System.out.println("FNFE!"); System.exit(1); } catch(IOException e) { System.out.println("IOE!"); System.exit(1); } return count; } }
has comment: http://stackoverflow.com/comment/36483712
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23732360

http://stackoverflow.com/comment/36441924
type: QuestionComment
comment on: http://stackoverflow.com/q/23712410
has text: If you're only referring to the value once then there is no difference -- they will generate essentially the same bytecode and perform equally fast. If you will need to refer to the value a second time then the first is technically "better", but sometimes the code is clearer with something like the second (or sometimes the first is clearer). You have to exercise judgment, I'm afraid.
score: 0
type: Comment

http://stackoverflow.com/comment/36556881
has text: Yes the tabbed pane seems like a nice feature to have in the editor so I may revert to something like that!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23770431

http://stackoverflow.com/comment/36548152
comment on: http://stackoverflow.com/q/23765257
type: Comment
type: QuestionComment
has text: @Ben75 I think it may even be a little more convoluted than that, as there seems to be a lot of hidden magic here. `text` needn't necessarily be a `java.lang.String`, and who knows how a RDF concept (a graph? a node from the graph?) is being converted to a plain string. We're being asked to assess the efficiency (run-time complexity? memory complexity? readability? feasibility?) of an algorithm that is completely hidden within a black box. Semantic concept literally means "not the lexification of this text, but what it means", so ambiguity is everywhere.
score: 2

http://stackoverflow.com/comment/36399901
type: AnswerComment
type: Comment
has text: @ColinD "If you're only hashing this thing in one place, it really doesn't matter at all if you have a Funnel or not." this is where I disagree ;) Have a look [here](https://github.com/parboiled1/grappa/tree/master/src/main/java/com/github/parboiled1/grappa/transform) for instance. This is the kind of thing I love to debate :p Sorry ;)
comment on: http://stackoverflow.com/a/23670880
score: 0

http://stackoverflow.com/q/23727659
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36472413
has answer: http://stackoverflow.com/a/23728001
tagged with: joptionpane
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36472050
score: 1
accepted answer: http://stackoverflow.com/a/23728026
tagged with: java
possible better answer: http://stackoverflow.com/a/23728001
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36472012
type: Question
has title: JOption call method from String text?
has comment: http://stackoverflow.com/comment/36472130
has body: I'm not too sure how to ask this question but here it is. Please look at my code (which I abbreviated for your convenience, and don't worry about the "Sam" its temporary) public class JeopardyGUI_Main11 extends javax.swing.JFrame { /** * Creates new form JeopardyGUI_Main */ public JeopardyGUI_Main11() { initComponents(); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } public void info(){ String[] am = new String[25]; String[] sp = new String[25]; String[] mu = new String[25]; String[] spe = new String[25]; String[] tv = new String[25]; String[] mo = new String[25]; String[] ama = new String[25]; String[] spa = new String[25]; String[] mua = new String[25]; String[] spea = new String[25]; String[] tva = new String[25]; String[] moa = new String[25]; am[0] = "Sam";ama[0] = "Sam"; am[1] = "Sam";ama[1] = "Sam"; ... am[23] = "Sam";ama[23] = "Sam"; am[24] = "Sam";ama[24] = "Sam"; mu[0] = "Sam";mua[0] = "Sam"; mu[1] = "Sam";mua[1] = "Sam"; ... mu[23] = "Sam";mua[23] = "Sam"; mu[24] = "Sam";mua[24] = "Sam"; spe[0] = "Sam";spea[0] = "Sam"; spe[1] = "Sam";spea[1] = "Sam"; ... spe[23] = "Sam";spea[23] = "Sam"; spe[24] = "Sam";spea[24] = "Sam"; tv[0] = "Sam";tva[0] = "Sam"; tv[1] = "Sam";tva[1] = "Sam"; ... tv[23] = "Sam";tva[23] = "Sam"; tv[24] = "Sam";tva[24] = "Sam"; sp[0] = "Sam";spa[0] = "Sam"; sp[1] = "Sam";spa[1] = "Sam"; ... sp[23] = "Sam";spa[23] = "Sam"; sp[24] = "Sam";spa[24] = "Sam"; mo[0] = "Sam";moa[0] = "Sam"; mo[1] = "Sam";moa[1] = "Sam"; ... mo[23] = "Sam";moa[23] = "Sam"; mo[24] = "Sam";moa[24] = "Sam"; int random_int = (int) (Math.random() * ( 0 - 24 )); String am_qu = am[random_int]; String am_an = ama[random_int]; String sp_qu = sp[random_int]; String sp_an = spa[random_int]; String mu_qu = mu[random_int]; String mu_an = mua[random_int]; String spe_qu = sp[random_int]; String spe_an = spa[random_int]; String tv_qu = tv[random_int]; String tv_an = tva[random_int]; String mo_qu = mo[random_int]; String mo_an = moa[random_int]; } pack(); setLocationRelativ…
answer count: 2
has comment: http://stackoverflow.com/comment/36471965
has comment: http://stackoverflow.com/comment/36472467
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/23728026

http://stackoverflow.com/comment/36451880
type: AnswerComment
has text: hey, I looked at it again and got confused.It looks like it'll only match when \1 comes before \2, is that right?If so, that will be wrong in some cases, the order shouldn't matter at all
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23716834

http://stackoverflow.com/q/23700297
tagged with: mysql
type: Question
tagged with: blob
has body: I have to show a picture stored in a mysql database (in a blob field) in a JLabel or anything else to show it. after writing this line, what should I do? Blob b = rs.getBlob ("image"); please explain in detail, I have searched all over the site but have not managed to finish anything. thanks in advance to all. PS: I ask the administrators to not put off topic immediately because otherwise I can not replicate, thank you :) . stack trace: java.lang.NullPointerException Finger was removed from fingerprint reader at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source) at AppMain.ExtractDB(AppMain.java:294) at AppMain.initDB(AppMain.java:271) at AppMain.initialize(AppMain.java:245) at AppMain.&lt;init&gt;(AppMain.java:68) at MainForm.identify(MainForm.java:356) at MainForm.extract(MainForm.java:257) at MainForm.onImageAcquired(MainForm.java:213) at com.griaule.grfingerjava.GrFingerJavaNative.callbackImage(GrFingerJavaNative.java:157)
tagged with: database
score: -1
tagged with: image
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: Display an image from a blob field - Java
has answer: http://stackoverflow.com/a/23700517
upvote count: 0
tagged with: java

http://stackoverflow.com/comment/36336410
type: Comment
score: 0
type: AnswerComment
has text: You're getting the warning "Dereferencing possible null pointer" because there is a possibility that your variable "directory" is null. If "directory" is null, then calling the function getDate() would cause the error. I am not sure if that helps. Try stepping through the program in debug and make sure your variables "f", "metadata", and "directory" are being properly declared.
comment on: http://stackoverflow.com/a/23656510

http://stackoverflow.com/q/23751072
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/36518662
type: Question
tagged with: removing-whitespace
has comment: http://stackoverflow.com/comment/36555323
has body: Well it appears I have been stumped by one of the simplest ListView implementations out there. For a few days I have found it impossible to properly reallocate a JavaFX ListView. I am working on making an EntityView completely dynamic, being able to remove elements whenever needed through a ContextMenu. So I have a ListView that is populated by an ArrayList, which we will refer to as "renderable". When you select "Remove" in the context menu, it removes the Entity from the renderable list, which also happens to be the "value" of the List Cell on whom I right clicked. Afterwards, I wish to refresh the ListView and remove now the nonexistent cell. So by creating a new ObservableList with the new renderable list (which removes the correct entity and that works fine), I set the items in the ListView, which does jack shit. I can set the list to null in this case, which removes all the elements. But I cannot reset the list with the new array and it remove the now missing entity. Somebody point me in the right direction please! When I use the method I stated above, it removes it from the list, but not visually. There becomes an unusable cell at the bottom of the list, which has its name. public void createContextMenu(final Entity curr, MouseEvent me){ MenuItem[] items = {new MenuItem("EDIT TYPE"), new MenuItem("REMOVE")}; ContextMenu menu = new ContextMenu(items); menu.show(list, me.getScreenX(), me.getScreenY()); items[1].setOnAction(new EventHandler&lt;ActionEvent&gt;(){ public void handle(ActionEvent arg0) { CanvasTab tab = (CanvasTab) core.canvasTabbedPane.getSelectionModel().getSelectedItem(); Kanvas k = tab.canvas; k.renderable.remove(curr); System.out.println(k.renderable); k.redraw(); EntityView.this.list.getItems().remove(curr); ObservableList&lt;Entity&gt; temp = FXCollections.observableList(k.renderable); EntityView.this.list.setItems(temp); } }); } This is the context menu:
tagged with: listview
has comment: http://stackoverflow.com/comment/36671540
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/23180428
has comment: http://stackoverflow.com/comment/36555398
has title: JavaFX - Cannot Refresh/Update ListView

http://stackoverflow.com/a/23637444
has comment: http://stackoverflow.com/comment/36517365
has comment: http://stackoverflow.com/comment/36523669
type: Answer
has comment: http://stackoverflow.com/comment/36513028
has body: You have this: ActivityFour aFour = new ActivityFour(); Intent aFive = new Intent (afour, ActivityFive.class) aFour.startActivity(aFive); You absolutely positively cannot create an instance of an Activity using new! Only the Android framework can create instances of Android components (activity, service, broadcast receiver, content provider). This is due to the way that these components require the Android framework to set up the correct Context during the instantiation. If you just want to start an Activity from MainClass, you will need to pass a Context instance to MainClass either when you create the instance of MainClass or sometime later with a set...() method before you need to use it. Then, when you want to start an Activity, you can do this: Intent aFive = new Intent (afour, ActivityFive.class) context.startActivity(aFive); The Context can either be an Activity (which inherits from Context) or it can be the global application context which you can get in an Activity using getApplicationContext().
answers question: http://stackoverflow.com/q/23635055
score: 0

http://stackoverflow.com/comment/36281725
score: 0
type: Comment
has text: Tomas: that's a weird approach. if you re-work to radiobuttons, which is the obvious solution, you'll only need to do it once. the "write a lot of code" part might return each time you add one, or update the page, and it gives a lot more chance on the build to break. why running the risk?
type: QuestionComment
comment on: http://stackoverflow.com/q/23629181

http://stackoverflow.com/comment/36501762
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23743755
has text: `if(this.httpMethod.equals("POST"))`. use .equals to compare strigns

http://stackoverflow.com/q/23736576
has answer: http://stackoverflow.com/a/23736629
accepted answer: http://stackoverflow.com/a/23736606
favorite count: 0
has title: Accessing Elements of a Vector
type: Question
has answer: http://stackoverflow.com/a/23736711
tagged with: initialization
score: -1
has comment: http://stackoverflow.com/comment/36488053
has comment: http://stackoverflow.com/comment/36488145
has comment: http://stackoverflow.com/comment/36488031
downvote count: 1
has answer: http://stackoverflow.com/a/23736606
has answer: http://stackoverflow.com/a/23736651
tagged with: java
has comment: http://stackoverflow.com/comment/36488050
has body: I want to put some integers into a Vector and to access them after that. My code in Java Eclipse scrapbook looks like this: java.util.Vector&lt;&gt; dp; dp = new java.util.Vector(5); dp.insertElementAt(new Integer(1)); dp.insertElementAt(new Integer(3)); for(int i =0; i&lt; dp.size(); i++) { int lastint = ((Number) dp.lastElement()).intValue(); System.out.println("Element" + lastint); } I get this error : "Incorrect number of arguments for type Vector; it cannot be parameterized with arguments &lt;>" but I did it like in the tutorial so I do not know why I get this.
answer count: 4
possible better answer: http://stackoverflow.com/a/23736629
type: AnsweredQuestion
tagged with: vector
upvote count: 0

http://stackoverflow.com/comment/82838955
type: AnswerComment
has text: For example? You let the answer unfinished.
comment on: http://stackoverflow.com/a/47934615
type: Comment
score: 0

http://stackoverflow.com/q/23697869
score: 0
has answer: http://stackoverflow.com/a/23697932
has answer: http://stackoverflow.com/a/23697951
has comment: http://stackoverflow.com/comment/36414403
favorite count: 0
has comment: http://stackoverflow.com/comment/36413811
has comment: http://stackoverflow.com/comment/36413931
tagged with: abstract-class
possible better answer: http://stackoverflow.com/a/23697951
has answer: http://stackoverflow.com/a/23698066
tagged with: interface
has comment: http://stackoverflow.com/comment/36414460
has comment: http://stackoverflow.com/comment/36413752
has body: The graphic below shows a compilation error involving my if-else conditional when attempting to implement the compareTo() method located in my Tool class. I am uncertain of the issue, as it would appear that the method is public and within my Tool class (from which the two objects being compared are constructed). public interface Product { public abstract String getName(); public abstract double getCost(); } public abstract class Vehicle implements Product { private String name; private double cost; public Vehicle(String name, double cost) { this.name = name; this.cost = cost; } public String getName() { return name; } public double getCost() { return cost; } } public class Car extends Vehicle { public Car(String s, double d) { super(s, d); } } public class Truck extends Vehicle { public Truck(String s, double d) { super(s, d); } } public class Tool implements Product, Comparable&lt;Product&gt; { private String name; private double cost; public Tool(String name, double cost) { this.name = name; this.cost = cost; } public String getName() { return name; } public double getCost() { return cost; } public int compareTo(Product obj) { if (getCost() &lt; obj.getCost()) { return -1; } else if (getCost() == obj.getCost()) { return 0; } else { return 1; } } } import java.util.*; public class InventoryDemo { public static void main(String [] args) { ArrayList&lt;Product&gt; list = new ArrayList&lt;Product&gt;(); list.add(new Car("Jagur", 1000000)); list.add(new Car("Neon", 17000)); list.add(new Tool("JigSaw", 149.18)); list.add(new Car("Jaguar", 110000)); list.add(new Car("Neon", 17500)); list.add(new Car("Neon", 17875.32)); list.add(new Truck("RAM", 35700)); list.add(new Tool("CircularSaw", 200)); list.add(new Tool("CircularSaw", 150)); list.add(new Tool("saw1", 200)); list.add(new Tool("saw2", 150)); if(list.get(9).compareTo(list.get(10)) == 0) { System.out.println("\nThey are the same size using compareTo()."); } else { System.out.println("\nThey are not the same size usin…
has comment: http://stackoverflow.com/comment/36413991
answer count: 4
accepted answer: http://stackoverflow.com/a/23697932
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36414271
upvote count: 2
has title: Issue implementing the java Comparable<T> class
has comment: http://stackoverflow.com/comment/36414565
downvote count: 2
has comment: http://stackoverflow.com/comment/36414034
type: Question
has comment: http://stackoverflow.com/comment/36414326
has comment: http://stackoverflow.com/comment/36414228
has answer: http://stackoverflow.com/a/23697954
tagged with: java
has comment: http://stackoverflow.com/comment/36413760
tagged with: comparable
has comment: http://stackoverflow.com/comment/36414636
tagged with: class

http://stackoverflow.com/q/23756363
upvote count: 2
has answer: http://stackoverflow.com/a/23756496
answer count: 5
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: hibernate
has title: org.hibernate.hql.ast.QuerySyntaxException: table not mapped
has answer: http://stackoverflow.com/a/35625719
type: Question
has answer: http://stackoverflow.com/a/35695704
downvote count: 0
has answer: http://stackoverflow.com/a/23756437
has answer: http://stackoverflow.com/a/37962058
favorite count: 0
tagged with: restlet-2.0
has body: I know many people have asked this question but I just started Java so I couldn't figure out still. So here is my problem: I am writing RESTful webservices using Javarestlet. Here is the snippet of my DAO file. try { session.beginTransaction(); String query = "select number from blockedcli"; @SuppressWarnings("rawtypes") List list = session.createQuery(query).list(); //.setString("sId", businessId) logger.error("*******************list*****************************************"); logger.error(list); logger.error("*******************listend*****************************************"); @SuppressWarnings("rawtypes") Iterator iterator = list.iterator(); while (iterator.hasNext()) { blockedcli = (BlockedCli) iterator.next(); } session.getTransaction().commit(); } Correspondingly my entity class looks like . @Entity @Table(name = "blockedcli") public class BlockedCli implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="idBlockedCLI", nullable = false, unique=true) private Integer idBlockedCLI; @Column(name = "number",nullable = false, length=45) private String number; @Column(name = "type", nullable = false) private Integer type; . I have placed a BlackListedN.hbm.xml file in my config directory with following text . &lt;?xml version="1.0"?&gt; &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; &lt;hibernate-mapping&gt; &lt;class name="tecd.persistence.entity.BlockedCli" table="blockedcli"&gt; &lt;id name="idBlockedCLI" type="long" unsaved-value="null"&gt; &lt;column name="idBlockedCLI" not-null="true"/&gt; &lt;generator class="identity"/&gt; &lt;/id&gt; &lt;property name="number"&gt; &lt;column name="number" not-null="true" /&gt; &lt;/property&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; As I want to display only number . And Here is the DB table . +--------------+--------------+--------+-----…

http://stackoverflow.com/comment/36440854
comment on: http://stackoverflow.com/q/23711667
has text: If I change the password I get `Keystore was tampered with, or password was incorrect: Password verification failed`. With the right password, BUILD SUCCESSFUL, but it doesn't work
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23712352
answer count: 1
downvote count: 1
has body: I have the following code that gets the a href tags urls from an XML which is working correctly: Pattern p = Pattern.compile("<a[^>]+href\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>"); Matcher m = p.matcher(xmlString); while (m.find()) imagesURLs.add(m.group(1)); I have the following: some text The top code gets me in m.group(0) and http://... in m.group(1). I also want to get the full some text. How can achieve this by modifying the regex?
has title: Get a href tag out of HTML
accepted answer: http://stackoverflow.com/a/23716966
tagged with: java
has comment: http://stackoverflow.com/comment/37157764
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36441881
favorite count: 0
linked to: http://stackoverflow.com/q/4231382
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/36443505
type: Question
has answer: http://stackoverflow.com/a/23716966
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36441525
tagged with: regex
has comment: http://stackoverflow.com/comment/36442910
score: 0
has comment: http://stackoverflow.com/comment/36441509
upvote count: 1
has comment: http://stackoverflow.com/comment/36441492

http://stackoverflow.com/q/23651085
tagged with: ajax4jsf
has answer: http://stackoverflow.com/a/23672209
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: jsf
tagged with: java
has title: Show or Hide Jsf Richfaces modal panel from java bean
answer count: 1
downvote count: 0
favorite count: 0
has body: In JSF Richfaces, I need to show or hide modalpanel and GIF image from bean according to certain functions. For example, after I have entered all values and click submit means, processing GIF image will be displayed. At the time of completion it gets hidden by using onclick="#{rich:component('wait1')}.show()", oncomplete="#{rich:component('wait1')}.hide()" wait1 is an image file name I have used. At the time of submitting, I have been validating the required fields. If its empty, I want to hide the process image and show the modalpanel to get value from user. How to hide the processing image and display the modal panel to get input from user, from java back bean? Thanks in advance
tagged with: panel
tagged with: richfaces

amazon-s3
tags question: http://stackoverflow.com/q/23711071
tags question: http://stackoverflow.com/q/23654135
type: Tag
tag name: amazon-s3

http://stackoverflow.com/comment/36494985
type: AnswerComment
score: 0
type: Comment
has text: if the number is greater than Long?
comment on: http://stackoverflow.com/a/23740210

http://stackoverflow.com/comment/36451312
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23714853
has text: Indeed: `shared_ptr` relies heavily on C++'s object construction/destruction semantics, which are not available in Java. The `try-with-resources` statement is the nearest local equivalent, and requires a different way of thinking about the problem, but can be used to implement a neat and safe solution to this kind of problem.
score: 0

http://stackoverflow.com/comment/36579949
score: 0
has text: @Holger thanks for the feedback, I've updated the values as final, which makes sense. There was a discussion about whether `AtomicBoolean` was necessary on the answer I link to above, perhaps you'd care to weigh in there? I initially did not think `AtomicBoolean` was necessary either.
type: AnswerComment
comment on: http://stackoverflow.com/a/23767905
type: Comment

http://stackoverflow.com/q/23718100
favorite count: 0
has comment: http://stackoverflow.com/comment/36453004
tagged with: android
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23718191
type: Question
tagged with: android-contentprovider
has comment: http://stackoverflow.com/comment/36452963
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36452865
has body: First up: I have sifted through many of the questions on the topic on SO and have still failed to come up with a correct answer. Here is a, (way simplified), version of my code: private static UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final int HOMEWORK_TABLE_REQUEST = 1, CLASS_TABLE_REQUEST = 2, SETTINGS_TABLE_REQUEST = 3, HOMEWORK_ITEM_REQUEST = 4, CLASS_ITEM_REQUEST = 5, SETTINGS_ITEM_REQUEST = 6; static { uriMatcher.addURI("org.dvc.homeworkReminder.homeworkProvider", "homework", HOMEWORK_TABLE_REQUEST); uriMatcher.addURI("org.dvc.homeworkreminder.homeworkProvider", "homework/#", HOMEWORK_ITEM_REQUEST); uriMatcher.addURI("org.dvc.homeworkReminder.homeworkProvider", "class", CLASS_TABLE_REQUEST); uriMatcher.addURI("org.dvc.homeworkreminder.homeworkProvider", "class/#", CLASS_ITEM_REQUEST); uriMatcher.addURI("org.dvc.homeworkReminder.homeworkProvider", "settings", SETTINGS_TABLE_REQUEST); uriMatcher.addURI("org.dvc.homeworkreminder.homeworkProvider", "settings/#", SETTINGS_ITEM_REQUEST); } And here is my query method: @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor cursor = null; Log.i("dfg", "Query method called"); Log.i("dfg", "Uri = " + uri.toString()); Log.i("dfg", "Match: " + uriMatcher.match(uri)); switch(uriMatcher.match(uri)) { case HOMEWORK_ITEM_REQUEST: Log.i("dfg", "HOMEWORK_ITEM_REQUEST"); cursor = database.readCursorById(Integer.parseInt(uri.getLastPathSegment())); break; case HOMEWORK_TABLE_REQUEST: Log.i("dfg", "HOMEWORK_TABLE_REQUEST"); cursor = database.readAllHomework(); break; case CLASS_ITEM_REQUEST: case CLASS_TABLE_REQUEST: case SETTINGS_ITEM_REQUEST: case SETTINGS_TABLE_REQUEST: cursor = null; break; default: cursor = null; break; } return cursor; } I have no implementation for my class requests or settings requests so that's why I'm just defaulting to return null. What's happening is my switch statement is falling all the way th…
has title: UriMatcher doesn't match correctly
has comment: http://stackoverflow.com/comment/36452878
accepted answer: http://stackoverflow.com/a/23718191
tagged with: uri
answer count: 1
has comment: http://stackoverflow.com/comment/36452844
downvote count: 0
has comment: http://stackoverflow.com/comment/36452856
has comment: http://stackoverflow.com/comment/36452983

http://stackoverflow.com/a/23717752
answers question: http://stackoverflow.com/q/23717733
has body: The getMessage method contains a message describing the exception : try { // ... } catch (Exception e) { System.out.println(e.getMessage()); } Output could be : Divided by zero in the case of an ArithmeticException You can also try : try { // ... } catch (Exception e) { e.printStackTrace(); } Output could be : java.lang.ArithmeticException: Divided by zero at javaapplication27.Test1.test(Test1.java:27) at javaapplication27.Test1.main(Test1.java:19) e.getMessage() will be more suitable to show to an end user, while e.printStackTrace() will be more suitable for a developer, or to put in a log file.
has comment: http://stackoverflow.com/comment/36452295
score: 3
has comment: http://stackoverflow.com/comment/36452248
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36452163
has comment: http://stackoverflow.com/comment/36452250
type: Answer
has comment: http://stackoverflow.com/comment/36452203

http://stackoverflow.com/q/23678906
downvote count: 0
possible better answer: http://stackoverflow.com/a/53597689
accepted answer: http://stackoverflow.com/a/23777302
favorite count: 0
has answer: http://stackoverflow.com/a/53597689
has answer: http://stackoverflow.com/a/49656017
answer count: 4
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: wildfly
type: Question
tagged with: wildfly-8
has title: Can a deployment stop itself?
tagged with: jboss
has answer: http://stackoverflow.com/a/23777302
has answer: http://stackoverflow.com/a/23680670
has body: I'm currently searching for a way to stop a deployment on wildfly programmatically. Background: The application does some health checks in its startup phase using an MBean. If the app determines that the environment is not valid because some resources are missing, it needs to stop its own deployment. The way it was: The application was formerly running on JBoss 4 and simply stopped the whole app server calling the shutdown command using JMX. In case this command failed, it simply terminated the whole JVM using System.exit(1). Current problems: Calling shutdown() via JMX does not work on wildfly since the whole server hangs when trying to stop it from within a deployed application. System.exit() will also not work since wildly must be catching the command in any way. So does anyone know how to stop the server from within the deployment or stop the deployment process or undeploy the app? Thanks a lot!

http://stackoverflow.com/comment/36582226
comment on: http://stackoverflow.com/a/23763468
type: Comment
has text: @KurtissBolam check here: [java command line options](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html)
score: 0
type: AnswerComment

http://stackoverflow.com/a/23680868
type: Answer
answers question: http://stackoverflow.com/q/23680503
score: 0
has body: lets say you have your interface pizza public interface Pizza { \*some methods *\} and implementations such as public class CheesePizza implements Pizza {} you could create enum PizzaType enum PizzaType { Cheese(CheesePizza.class); Class&lt;?&gt; type; PizzaType(Class&lt;?&gt; type) { this.type = type; } Pizza create() { try { return (Pizza) type.newInstance(); } catch (Exception e) { return null; } } } now to create new fresh pizza all what you need to do is Pizza pizza = PizzaType.Cheese.create();

http://stackoverflow.com/q/23705179
tagged with: regex
has comment: http://stackoverflow.com/comment/36428384
favorite count: 0
has title: Using regex to extract specific pattern
upvote count: 1
has body: I'm having a hard time using regular expressions in Java even after reading numerous tutorials online. I'm trying to extract parts of a String received to be used later in my application. Here are examples of the possible String received: 53248 &lt;CERCLE&gt; 321 211 55 &lt;/CERCLE&gt; 57346 &lt;RECTANGLE&gt; 272 99 289 186 &lt;/RECTANGLE&gt; The first number is to be extracted as a sequence number. The word between &lt;> is to be extracted as well. Then, the sequence of numbers in between as well. Here is my pattern: "(\\d+)\\s*&lt;(\\w+)&gt;\\s*((\\d+\\s*)+)\\s*&lt;/\\w*&gt;.*" Here is the code for my method so far: public decompose(String s) throws IllegalArgumentException { Pattern pattern = Pattern.compile(PATTERN); Matcher matcher = pattern.matcher(s); noSeq = Integer.parseInt(matcher.group(1)); type = typesFormes.valueOf(matcher.group(2)); strCoords = matcher.group(3).split(" "); } Problem is that when I run the code, all my matcher groups are at -1 for some reason (not found I guess). I've been banging my head on this for a while and any suggestion is welcome :) Thanks.
has answer: http://stackoverflow.com/a/23705435
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23657575
has answer: http://stackoverflow.com/a/23705283
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36428579
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/23705435
possible better answer: http://stackoverflow.com/a/23705222
answer count: 3
has answer: http://stackoverflow.com/a/23705222

http://stackoverflow.com/a/24359687
type: Answer
answers question: http://stackoverflow.com/q/23685384
has body: I had same problem, finally solved it. Hibernate 4 can work without two dependencies of annotation and common-annotation. So if you have any dependency of annotation in your pom then remove it and make sure they are not part of it. My work pom is as <spring.version>4.0.5.RELEASE</spring.version> <junit.version>4.11</junit.version> <jdk.version>1.6</jdk.version> junit junit 3.8.1 test org.springframework spring-core ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-orm ${spring.version} javax.servlet servlet-api 3.0-alpha-1 jstl jstl 1.2 commons-fileupload commons-fileupload 1.2.2 commons-io commons-io 1.3.2 mysql mysql-connector-java 5.1.6 org.hibernate hibernate-core 4.3.5.Final org.slf4j slf4j-api 1.5.6 org.slf4j slf4j-log4j12 1.5.6 c3p0 c3p0 0.9.1.2 org.javassist javassist 3.18.1-GA
score: 0

http://stackoverflow.com/comment/36356997
comment on: http://stackoverflow.com/a/23667516
has text: Just formatted it. Indentations were little off. :) Not sure if that's what was your question?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23687926
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/23683876
downvote count: 0
has body: Well, actually on your console you should see something like this: Exception in thread "main" org.aspectj.lang.NoAspectBoundException: Exception while initializing de.scrum_master.aspect.TotoAspect: org.aspectj.lang.NoAspectBoundException: de.scrum_master.aspect.TotoAspect at de.scrum_master.aspect.TotoAspect.aspectOf(TotoAspect.java:1) at de.scrum_master.app.ABC.&lt;init&gt;(ABC.java:4) at de.scrum_master.app.ABC.main(ABC.java:10) Caused by: org.aspectj.lang.NoAspectBoundException: de.scrum_master.aspect.TotoAspect at de.scrum_master.aspect.TotoAspect.aspectOf(TotoAspect.java:1) at de.scrum_master.aspect.TotoAspect.&lt;init&gt;(TotoAspect.java:10) at de.scrum_master.aspect.TotoAspect.ajc$postClinit(TotoAspect.java:1) at de.scrum_master.aspect.TotoAspect.&lt;clinit&gt;(TotoAspect.java:1) ... 2 more This is because your advice is targetting all constructors, even its own aspect's one. You need to exclude it. Here is a compileable code sample: Exception class: This is to demonstrate that your pointcut also matches the exception's constructor. package de.scrum_master.app; public class AuditReactiveException extends Exception { public AuditReactiveException(String message) { super(message); } } Sample driver class with main method: package de.scrum_master.app; public class ABC { public ABC() throws AuditReactiveException { System.err.println("Creating ABC object"); throw new AuditReactiveException("Something went wrong"); } public static void main(String[] args) throws AuditReactiveException { new ABC(); } } Aspect with modified pointcut: package de.scrum_master.aspect; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import de.scrum_master.app.AuditReactiveException; @Aspect public class TotoAspect { @Before("initialization(*.new(..)) &amp;&amp; !within(TotoAspect)") public void test(JoinPoint thisJoinPoint) throws AuditReactiveException { System.err.println(thisJoinPoint); } } Sample output: initi…
score: 10

http://stackoverflow.com/q/23623643
answer count: 1
has answer: http://stackoverflow.com/a/23623668
has title: How add a QR bar code in pdfjet?
score: 0
tagged with: google-app-engine
tagged with: http://stackoverflow.com/tag/pdf
tagged with: pdf-generation
has body: I don´t know how add a QR code on my PDF, i use java and PDFjet, some one can help me????? I use PDFJet because I can´t use Jreports on GAE. I try this but return error: QRCode qr = new QRCode("123456", 1); qr.setPosition(0, 0); qr.drawOn(page);
accepted answer: http://stackoverflow.com/a/23623668
type: AnsweredQuestion
tagged with: java
tagged with: qr-code
type: Question

http://stackoverflow.com/comment/36385077
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23682165
score: 2
has text: Your question belies a deep misunderstanding of how sockets work. Once a connection is established, the communication occurs (at both ends) by reading and writing the connected socket. ServerSocket isn't involved. A "new request" on a persistent connection is just a new command sent over the existing connected socket. The identification of which socket the request happened on is done at the OS/network level.

http://stackoverflow.com/q/23652017
has comment: http://stackoverflow.com/comment/36326170
type: UnansweredQuestion
downvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/23652292
tagged with: swing
has body: I have a Thread launched when a Jboutton listener event . The thread code is huge and I wish when The user close the Jframe the thread continue to run until finishing (even the Jframe is closed ). What Can I do ?
type: Question
has comment: http://stackoverflow.com/comment/36326153
tagged with: java
linked to: http://stackoverflow.com/q/9554636
upvote count: 0
answer count: 1
favorite count: 0
has title: Thread _ Jframe Java
has comment: http://stackoverflow.com/comment/36326344
score: -2
has comment: http://stackoverflow.com/comment/36326711

http://stackoverflow.com/comment/36581538
type: QuestionComment
comment on: http://stackoverflow.com/q/23777914
score: 0
type: Comment
has text: user3659013, please change the title of your question. The way it is now, it will not be helpful to other users, or even just distract them. It is expected from you on this site that you try to ask good questions which will not only help you but allow others to benefit from the answers.

http://stackoverflow.com/comment/36529606
score: 0
has text: Isn't it right that jvm bytecode can be decompiled to java? That's how it decompiles to java.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23757785

http://stackoverflow.com/q/23753698
favorite count: 0
type: Question
tagged with: swt
upvote count: 1
tagged with: java
has title: SWT Browser not setting http header properly - Accept-Language
answer count: 0
downvote count: 0
type: UnansweredQuestion
has body: By the way sorry for my english. Im trying to load in swt the contains of a http request to our report server. I did some research and finally have something like this. final String[] header = new String[] { "Content-Type: application/x-www-form-urlencoded; charset=UTF-8", "Cache-Control: no-cache", "Accept: */*", "Referer: http://&lt;my_own_server&gt;/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable", "Accept-Encoding: gzip,deflate,sdch", "Accept-Language: es-ES,es;q=0.8", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" }; String url = "http://axprerps/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable&amp;rc:Parameters=False"; String filters = "pCentroCompra=1&amp;pCampana=16"; Browser myBrowser = new Browser(main, SWT.NONE); myBrowser.setUrl(url, filters, header); Its working pretty good but in some computers just fails because Locale. If i put some kind of sniffer on my machine i can see which headers it sends: Referer: http://axprerps/ReportServer/Pages/ReportViewer.aspx?%2fInformesLogistica%2fDistribucion%2fAETOrdenDevolucionReclamable\r\n Accept-Language: es\r\n User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; .NET4.0C; InfoPath.2; .NET4.0E)\r\n Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n Cache-Control: no-cache\r\n Accept: */*\r\n Accept-Encoding: gzip, deflate\r\n Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n Host: axprerps\r\n Content-Length: 8047\r\n Connection: Keep-Alive\r\n My SO is windows XP SP3 but behavior is reproducible in Windows 2003 Server SP 2 also. I haven't tested it in any other SO. So header for Accept-Language is just being ignored. Is this a normal behavior? Cheers.
score: 1

timer
tag name: timer
tags question: http://stackoverflow.com/q/23658799
tags question: http://stackoverflow.com/q/23723567
tags question: http://stackoverflow.com/q/23758314
tags question: http://stackoverflow.com/q/23695123
type: Tag
tags question: http://stackoverflow.com/q/23734795
tags question: http://stackoverflow.com/q/23736123
tags question: http://stackoverflow.com/q/23755630
tags question: http://stackoverflow.com/q/23707748
tags question: http://stackoverflow.com/q/23768368
tags question: http://stackoverflow.com/q/23627414
tags question: http://stackoverflow.com/q/23712539
tags question: http://stackoverflow.com/q/23758637
tags question: http://stackoverflow.com/q/23633156
tags question: http://stackoverflow.com/q/23769632

http://stackoverflow.com/comment/36389073
score: 0
has text: It's not unreasonable to imagine that different languages have different syntax. In c++, `->` dereferences a pointer + accesses a property, where `.` just accesses a property.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23684400

bluetooth
tags question: http://stackoverflow.com/q/23674668
tag name: bluetooth
type: Tag
tags question: http://stackoverflow.com/q/23618984
tags question: http://stackoverflow.com/q/23735935

http://stackoverflow.com/a/23935668
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23742906
has body: So Webi, Crystal etc. implement the ISchedulable interface. This means that your non-instance InfoObject WILL return an ISchedulingInfo, regardless of whether or not it has been scheduled. If an object is scheduled, an instance is created with SI_SCHEDULE_STATUS = 9 (ISchedulingInfo.ScheduleStatus.PENDING) The job then runs (SI_SCHEDULE_STATUS = 0), and either completes (SI_SCHEDULE_STATUS=1) or fails (SI_SCHEDULE_STATUS = 3). It can also be paused (SI_SCHEDULE_STATUS = 8) So to find all instances that are scheduled, you need a query like: select * from ci_infoObjects where si_instance=1 and si_schedule_status not in (1,3) This will get you anything that isn't a success or a failure
score: 3
type: Answer

http://stackoverflow.com/q/23666897
has comment: http://stackoverflow.com/comment/36368629
score: 0
has comment: http://stackoverflow.com/comment/36356010
upvote count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I am creating tictactoe game and I wanted to create a loop(below). Player can be human or computer. Now I would like to make code wait until a statement inside method player.move() will UNLOCK. How to achieve that? while(!finished){ Player player = fetchNextPlayer(); player.move();//MOVE suppose to encourage human player to click on a certain JButton LOCK;//until there is a line in move() saying to unlock. } The deal is that move() in case of Player should just encourage player to click on a button and if fetchNextPlayer() returns instance of ComputerPlayer extends Player it suppose to automatically click a certain button. If there will be no lock the ComputerPlayer will not wait until human player clicks the button.
has comment: http://stackoverflow.com/comment/36355873
has comment: http://stackoverflow.com/comment/36356072
answer count: 0
tagged with: java
has title: Is there possibility to put a lock after a method?
type: Question
has comment: http://stackoverflow.com/comment/36356234
has comment: http://stackoverflow.com/comment/36356004

http://stackoverflow.com/comment/36607390
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23730454
has text: @WIllJBD Have you tried to use a new adapter like I also suggested in my answer?

http://stackoverflow.com/q/23642449
has comment: http://stackoverflow.com/comment/36308736
score: 8
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23642493
accepted answer: http://stackoverflow.com/a/23642493
has title: How to use No Layout or Absolute Layout like Eclipse?
tagged with: layout
tagged with: intellij-idea
tagged with: user-interface
answer count: 1
downvote count: 0
has body: Title says all I would like to use no layout or the absolute layout from Eclipse. Is there a way of doing this?
favorite count: 0
upvote count: 8

http://stackoverflow.com/comment/36382153
type: QuestionComment
has text: Looks like db2jcct2.dll DLL is corrupted or cannot be found or something related to this dll. For these problems, it is better to ask guidance to IBM itself. @JasonSec it is not **that** obvious.
comment on: http://stackoverflow.com/q/23680750
score: 0
type: Comment

http://stackoverflow.com/q/23665959
has answer: http://stackoverflow.com/a/23672649
tagged with: abstract-class
has title: How can I get an instance of a subclass of abstract class from a static method of another class?
has comment: http://stackoverflow.com/comment/36353989
answer count: 3
has comment: http://stackoverflow.com/comment/36354518
tagged with: instance-variables
favorite count: 0
has answer: http://stackoverflow.com/a/23666055
tagged with: static
has comment: http://stackoverflow.com/comment/36354029
has answer: http://stackoverflow.com/a/23666835
type: UnansweredQuestion
tagged with: subclass
has comment: http://stackoverflow.com/comment/36355041
score: 5
has comment: http://stackoverflow.com/comment/36354021
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36355013
upvote count: 7
has body: I have the following class structure: DataStore classes: Parent class: PStore: public abstract class PStore ... 2 child classes extending it: CStore1 and CStore2 Each of the child classes is a N-glton (sorry, not sure what Java term for that is) - it can have only N instances, numbered 1..NMax. Each child class has the following methods for accessing that instance: CStore1.getInstance(Id) and CStore2.getInstance(Id) Worker classes: Parent class: public abstract class PWork... 2 child classes extending it: CWork1 and CWork2 Current situation: Class CWork1 implemented an inner class with the following code accessing the Store: protected class fListener implements ActionListener { public void actionPerformed(ActionEvent ae) { CStore1.getInstance(Id).someMethod(); # NOTE: someMethod() is implemented in CStore2 as well } } I need to implement the same fListener class in CWork2 Being a good little software developer, instead of simply copy/pasting fListener from CWork1 to CWork2 class and then changing CStore1 to CStore2 in its code, I decided like an idiot to migrate it to a parent class. What I tried to do: Create an abstract method in PStore called getStoreInstance(int Id): public abstract PStore getStoreInstance(int Id); Implement that method in CStore1 as public PStore getStoreInstance(int Id) { return CStore1.getInstance(Id); } So far, so good. It compiled all 3 Store classes. Copy the fListener code from PWork to CWork1 class Obviously, the compiler complained that it does not know anything about CStore1 class and its method getStoreInstance() Now, I decided to simply call the newly created getStoreInstance(): Old code: CStore1.getInstance(Id).someMethod(); New code: PStore.getStoreInstance(Id).someMethod(); Compiler complaint: "Cannot make a static reference to the non-static method getStoreInstance(Id) from the type PStore". The only "fix" proposed by Eclipse was to make getStoreInstance() method static, but THAT didn't work either: When I added a static modifier…
type: Question
has comment: http://stackoverflow.com/comment/36354771
has comment: http://stackoverflow.com/comment/36355211
has comment: http://stackoverflow.com/comment/36355004
has comment: http://stackoverflow.com/comment/36354914

http://stackoverflow.com/q/23653961
has answer: http://stackoverflow.com/a/24507811
tagged with: java
tagged with: javascript
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36875183
tagged with: plugins
has body: I've created a cordova plugin (3.3.0), which launch an activity and waits for a result. But the callback (simple alert) isn't call until a lauch the plugin a second time. Here is the code : public boolean execute(String action, final JSONArray args, final CallbackContext cbc) throws JSONException { this.callbackContext = cbc; try { Intent i = new Intent(cordova.getActivity(), ActivityCamera.class); this.cordova.setActivityResultCallback(PhotoMokoPlugin.this); this.cordova.startActivityForResult(PhotoMokoPlugin.this, i, 0); PluginResult pr = new PluginResult(PluginResult.Status.NO_RESULT); pr.setKeepCallback(true); callbackContext.sendPluginResult(pr); return true; } catch (JSONException e) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); return false; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); try { callbackContext.success(json.toString()); // Doesn't matter if success or error } catch (JSONException e) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR)); } } The ActivityCamera only setResult with a new Intent avec finish(); For example : If I click on a button which call the plugin, nothing happens. I click a second time, the alert message is displayed and nothing more (normally another alert)... Do you have any idea ? Tell me if more code is needed. EDIT : Updating Cordova didn't solved the problem. EDIT 2 : The problem seems to come from this code : @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } If I remove it, the callback is called the first…
has comment: http://stackoverflow.com/comment/36871089
tagged with: cordova
has answer: http://stackoverflow.com/a/24623196
has title: Cordova plugin callback received after second plugin call
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28013867
type: Question

http://stackoverflow.com/q/23699452
downvote count: 2
has answer: http://stackoverflow.com/a/23699579
has answer: http://stackoverflow.com/a/23699646
has comment: http://stackoverflow.com/comment/36416851
has answer: http://stackoverflow.com/a/23699597
has answer: http://stackoverflow.com/a/23699709
tagged with: java
has comment: http://stackoverflow.com/comment/36420327
has body: ArrayList&lt;String&gt; strings = new ArrayList&lt;String&gt;(){{ add("a"); add("b"); add("c"); add("d"); }}; int size = strings.size(); This is the part that I want to know which one to use and why. for(int i = 0; i &lt; size; i++){ String temp_string = strings.get(i); someMethod(temp_string); } or for(int i = 0; i &lt; size; i++){ someMethod(strings.get(i)); } Does it make any performance difference? Does the temp_string points to the String saved in the arraylist part of memory or does it allocate another space in memory in each loop to save the temp_string?
type: Question
has comment: http://stackoverflow.com/comment/36416910
tagged with: algorithm
has comment: http://stackoverflow.com/comment/36416908
score: 0
has title: For performance, does it make any performance difference to have a String temporarily in a loop or call it directly?
answer count: 4
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36416761
type: UnansweredQuestion

http://stackoverflow.com/a/23717604
score: 1
answers question: http://stackoverflow.com/q/23715268
has body: GWT (and thus the gwt-maven-plugin) doesn't generate the HTML host page; that's something you have to provide. What you're experiencing is the expected behavior.
accepted answer of: http://stackoverflow.com/q/23715268
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/23774205
has comment: http://stackoverflow.com/comment/36560205
type: Question
score: 0
tagged with: exception
answer count: 1
has body: I want to catch an exception, print the place the exception occured and continue running the loop. I have this example code: public class justcheckin { static String[] l = {"a","a","b","a","a"}; public class notAexception extends Exception{ private static final long serialVersionUID = 1L; notAexception (){ super(); } notAexception(String message){ super(message); } } private void loop () throws notAexception { notAexception b = new notAexception("not an a"); for (int i = 0; i&lt; l.length; i++){ if (! l[i].equals("a")){ throw b; } } } public static void main (String[] args) throws notAexception{ justcheckin a = new justcheckin(); a.loop(); } } I want to write a warning message, say "index 2 is not a", and continue running the loop. How can I do it? Thanks!
tagged with: throw
has comment: http://stackoverflow.com/comment/36560173
has title: java catching exception and continue execution
has comment: http://stackoverflow.com/comment/36560700
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23774308
accepted answer: http://stackoverflow.com/a/23774308
tagged with: java
tagged with: loops

nullpointerexception
tags question: http://stackoverflow.com/q/23776314
tags question: http://stackoverflow.com/q/23717634
tags question: http://stackoverflow.com/q/23743922
tags question: http://stackoverflow.com/q/23648841
tags question: http://stackoverflow.com/q/23652334
tags question: http://stackoverflow.com/q/23729250
tags question: http://stackoverflow.com/q/23711776
tags question: http://stackoverflow.com/q/23772832
tags question: http://stackoverflow.com/q/23650317
tags question: http://stackoverflow.com/q/23697944
tags question: http://stackoverflow.com/q/23748338
tags question: http://stackoverflow.com/q/23656365
tags question: http://stackoverflow.com/q/23673447
tags question: http://stackoverflow.com/q/23616037
tags question: http://stackoverflow.com/q/23674236
tags question: http://stackoverflow.com/q/23650709
type: Tag
tags question: http://stackoverflow.com/q/23670848
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/23743747
tags question: http://stackoverflow.com/q/23677571
tags question: http://stackoverflow.com/q/23652644
tags question: http://stackoverflow.com/q/23672430
tags question: http://stackoverflow.com/q/23713081
tags question: http://stackoverflow.com/q/23628217
tags question: http://stackoverflow.com/q/23744064
tags question: http://stackoverflow.com/q/23658916
tags question: http://stackoverflow.com/q/23618641
tags question: http://stackoverflow.com/q/23705140
tags question: http://stackoverflow.com/q/23719240
tags question: http://stackoverflow.com/q/23653778
tags question: http://stackoverflow.com/q/23662201
tags question: http://stackoverflow.com/q/23621342
tags question: http://stackoverflow.com/q/23755280
tags question: http://stackoverflow.com/q/23636058
tags question: http://stackoverflow.com/q/23679963
tags question: http://stackoverflow.com/q/23735509
tags question: http://stackoverflow.com/q/23667389
tags question: http://stackoverflow.com/q/23695243
tags question: http://stackoverflow.com/q/23777229
tags question: http://stackoverflow.com/q/23672769
tags question: http://stackoverflow.com/q/23678555

http://stackoverflow.com/a/23757334
score: 0
type: Answer
has body: // [] is how you match regex patterns by OR if(str.matches("[(*str1 here*)(*str2 here*)(*etc*)]") // best to separate AND into a separate regex &amp;&amp; str.matches("regex here")) { // do whatever } If I've understood you correctly. If not, then just encase your Java OR statements (||, ||, ||) in brackets: if((str.contains(str1) || str.contains(str2) &amp;&amp; (str.contains(str3)) { // do whatever }
has comment: http://stackoverflow.com/comment/36529415
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23757219

http://stackoverflow.com/comment/36375978
type: AnswerComment
score: 0
type: Comment
has text: No. The ArreyList is used to store objects without a relation to other objects while a HashMap stores pairs of Object to Object relations. The ArreyList is like a real world written down list. On word a line. The HashMap is a dictionary: a topic(key) and its explanation(value)
comment on: http://stackoverflow.com/a/23676964

http://stackoverflow.com/a/23735751
has body: Insted of sending image in form of string send it as byte array. ie. While sending convet Bitmap image to byte array and send and while receiving get the byte array and convert it to Bitmap image.
score: 0
answers question: http://stackoverflow.com/q/23735458
type: Answer

http://stackoverflow.com/comment/36652216
has text: Can you please be more clear on this? Are you talking about a loop inside a loop?? Please share some code snippets to understand the question
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23757764

http://stackoverflow.com/q/23734105
tagged with: java
has answer: http://stackoverflow.com/a/25792714
tagged with: datasource
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36592126
type: Question
has comment: http://stackoverflow.com/comment/36488766
has title: EndToEndMetrics on pooled db connections: isolated or not?
accepted answer: http://stackoverflow.com/a/25792714
has body: A dba in my office proposed the following to audit db access (oracle): Put the current logged in user in my application as a property on the db connection (java.sql.Connection). public class ClientInfoProvider { void enrichConnection(Connection connection, String userName) throws SQLException { OracleConnection oConn = (OracleConnection) connection; String[] metrics = new String[OracleConnection.END_TO_END_STATE_INDEX_MAX]; metrics[OracleConnection.END_TO_END_CLIENTID_INDEX] = userName; oConn.setEndToEndMetrics(metrics, (short) 0); } } public class AuditableDataSource implements DataSource { ... @Override public Connection getConnection() throws SQLException { Connection connection = dataSource.getConnection(); clientInfoProvider.enrichConnection(connection, loggedInUserString); return connection; } ... } My main concern is that connections are pooled. Wil users not end up using the same connection? The last user which changes the properties of the connection might influence the other users that are already using this connection. Is this a correct assumption?
tagged with: database-connection
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36525076

http://stackoverflow.com/comment/36468160
score: 0
type: Comment
type: QuestionComment
has text: A rolling file appender would take care of that for you, though; all you need to provide is the filename, and it will adjust the date. Admittedly though, your for-instance has both days staying the same, which is a bit concerning.
comment on: http://stackoverflow.com/q/23725600

http://stackoverflow.com/comment/136135150
type: AnswerComment
has text: it doesn't work since spring boot 3. Can ony one tried with spring boot 3 please?
type: Comment
comment on: http://stackoverflow.com/a/33337838
score: 0

http://stackoverflow.com/q/23765336
type: UnansweredQuestion
has title: How to delete auto start apps in BlackBerry?
tagged with: blackberry
type: Question
has body: Hello i had this bug in one of my apps. I can't uninstall it if its marked as an auto start app in Blackberry descriptor. When i turn off this option i can delete it. Someone has experimented this kind of problem? i have tried going to apps administrator but the option isn't showing there either. NOTE: i installed this application through eclipse as DEV. I found someone having the same problem as me here : https://supportforums.blackberry.com/t5/Java-Development/Deleting-an-autostart-app/td-p/1436287
tagged with: java
has comment: http://stackoverflow.com/comment/36570819
score: 0
answer count: 1
tagged with: eclipse-plugin
tagged with: blackberry-eclipse-plugin
has answer: http://stackoverflow.com/a/23780148
tagged with: blackberry-jde

http://stackoverflow.com/q/23653876
tagged with: maven
has title: Android maven misses my classes from the jar
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
has body: I'm compiling my Android app using mvn clean install When I look into the generated jar my application classes are missing, so my junit tests in another test project will not compile. Any idea what I need to do to add all my *.class files into the .m2\repository\com\twenty71\jenkinsApp3\1.0.0-SNAPSHOTjar\jenkinsApp3-1.0.0-SNAPSHOT.jar? The mvn built app runs fine, so it's just the jar that's a problem. This is my pom.xml file: http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.twenty71 jenkinsApp3 1.0.0-SNAPSHOT apk jenkinsApp3 android.support compatibility-v7-appcompat 19.1.0 apklib android.support compatibility-v7-appcompat 19.1.0 jar com.google.android support-v4 r7 com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.9.0-rc.1 19 <deleteConflictingFiles>true</deleteConflictingFiles> true true maven-compiler-plugin 3.1 1.6 1.6
favorite count: 0
has answer: http://stackoverflow.com/a/27619856
tagged with: android
answer count: 1
tagged with: pom.xml
type: UnansweredQuestion

http://stackoverflow.com/a/23710119
has comment: http://stackoverflow.com/comment/36454850
accepted answer of: http://stackoverflow.com/q/23710037
answers question: http://stackoverflow.com/q/23710037
has comment: http://stackoverflow.com/comment/36454933
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36452397
has comment: http://stackoverflow.com/comment/36454553
has body: Try with this code. You will get the answer of your question. It's an List with 2 items. StringBuilder builder = new StringBuilder(); BufferedReader reader = new BufferedReader(new FileReader(new File("resources/json1.txt"))); String line = null; while ((line = reader.readLine()) != null) { builder.append(line); } reader.close(); Gson gson = new Gson(); Type listType = new TypeToken&lt;ArrayList&lt;MyJSON&gt;&gt;() { }.getType(); List&lt;MyJSON&gt; list = gson.fromJson(builder.toString(), listType); // you can try this form as well // MyJSON[] list = gson.fromJson(builder.toString(), MyJSON[].class); for (MyJSON json : list) { System.out.println(json.toString()); } ... class MyJSON { String item_name; String item_type; String item; String item_min_lvl; Enchantment enchantment; @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("\nitem_name:").append(item_name); builder.append("\nitem_type:").append(item_type); builder.append("\nitem:").append(item); builder.append("\nitem_min_lvl:").append(item_min_lvl); builder.append("\n\nEnchantment Details:"); builder.append("\nhealth:").append(enchantment.health); builder.append("\ndam:").append(enchantment.dam); builder.append("\nlife:").append(enchantment.life); builder.append("\nxp:").append(enchantment.xp); builder.append("\nloot:").append(enchantment.loot); return builder.toString(); } } class Enchantment { String health; String dam; String life; String xp; String loot; } output: item_name:Adame item_type:Special item:Chestplate item_min_lvl:50 Enchantment Details: health:0.3 dam:24% life:0.1 xp:24% loot:22% item_name:Sticks' item_type:Unique item:Stick item_min_lvl:4 Enchantment Details: health:0.6 dam:12% life:0.3 xp:17% loot:17% EDIT The structure of each entry is not same hence you can't use POJO for this type of JSON. Simply use ArrayList&lt;Map&lt;String, Object&gt;&gt; and access the value based on key from the map. Gson gson = new Gson(); Type listType = new TypeToken&l…
score: 0
has comment: http://stackoverflow.com/comment/36437585
type: Answer
has comment: http://stackoverflow.com/comment/36452540
has comment: http://stackoverflow.com/comment/36442393
has comment: http://stackoverflow.com/comment/36454838
has comment: http://stackoverflow.com/comment/36442534
has comment: http://stackoverflow.com/comment/36438260
has comment: http://stackoverflow.com/comment/36454941
has comment: http://stackoverflow.com/comment/36443250
has comment: http://stackoverflow.com/comment/36453011
has comment: http://stackoverflow.com/comment/36443308

http://stackoverflow.com/a/35361703
has body: I had same problem. I worked with simply spinnerModel then I tried your program and it works too. There is one thing to do - re-set your model. If you want the spinner to appear you have to set new spinner model again. for example i typed this code: public void method() { jPanel2.setLocation(0, 96); jPanel2.setSize(getWidth(), getHeight() - 96); jPanel2.getHeight() - jButton1.getHeight() - 50); jSpinner1.setModel(new SpinnerNumberModel(2,1,10,1)); //&lt;- this is line you need to type jSpinner1.setSize(60, 25); jSpinner1.setLocation(0,0); }
type: Answer
answers question: http://stackoverflow.com/q/23619727
score: 0

http://stackoverflow.com/a/23624362
has body: You don't need to have a ServletContext as instance member of ServletContextImpl class. Whenever you need it just access it from ServletContextEvent as you are doing it already in below code: context = contextEvent.getServletContext(); In the application you can ccess the ServletContext by the HttpSession#getServletContext(). ServletContext context = request.getSession().getServletContext(); For more info have a look at How to get the Servlet Context from ServletRequest in Servlet 2.5? Second, when I run the application I receive the message "Context Created" however I do not receive the message "Context Destroyed" when I close the application (I do this by simply closing the browser). Simply closing the browser doesn't destroy the context. Application context is used application wide not only for each client. You can use HTTP session one for each client. Method contextDestroyed() will be called when server is stopped gracefully in the standard way. For more info have a look at below post Debug ServletContextListener.contextDestroyed() by setting the breaking point in eclipse How can I destroy the context? Ideally, the ServletContext gets destroyed when the App server (Tomcat or JBoss) is shut down or sometimes even restarted. Please have a look at below links: When ServletContext is initialized When is a servletcontext destroyed?
has comment: http://stackoverflow.com/comment/36308437
type: Answer
has comment: http://stackoverflow.com/comment/36308590
answers question: http://stackoverflow.com/q/23620580
has comment: http://stackoverflow.com/comment/36308483
has comment: http://stackoverflow.com/comment/36308863
score: 0
has comment: http://stackoverflow.com/comment/36308883
has comment: http://stackoverflow.com/comment/36308664
has comment: http://stackoverflow.com/comment/36309142
has comment: http://stackoverflow.com/comment/36308536
has comment: http://stackoverflow.com/comment/36308826

http://stackoverflow.com/comment/36534919
has text: Actually I want the logic without using any inbuilt function
comment on: http://stackoverflow.com/a/23761216
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37157764
has text: [Oh yes you can parse HTML with Patterns](http://stackoverflow.com/a/4234491/471272).
comment on: http://stackoverflow.com/q/23712352
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23691760
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23691814
accepted answer: http://stackoverflow.com/a/23691814
tagged with: java
possible better answer: http://stackoverflow.com/a/23691857
tagged with: thread-safety
has title: I don't understand why immutable objects in java are inherrently always threadsafe
tagged with: java.util.concurrent
type: Question
upvote count: 2
favorite count: 0
has body: I'm reading the Effective Java book and on the chapter on minimizing mutability Item 15. Maybe I'm having trouble understanding the concept of thread-safety since I'm not experienced much in concurrency. Could I get an example that illustrates how an immutable object is always thread-safe? Thank you in advance!
has answer: http://stackoverflow.com/a/23691884
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/23692124
has answer: http://stackoverflow.com/a/23691857
score: 2

http://stackoverflow.com/comment/36297339
has text: @GáborBakos that is a very good point.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23637233

http://stackoverflow.com/q/23742707
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24024512
accepted answer: http://stackoverflow.com/a/24024512
has comment: http://stackoverflow.com/comment/36502184
tagged with: hadoop
score: 0
answer count: 1
has title: How can Fill In Mapper?
has body: public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); int left = line.indexOf("{"); int right = line.indexOf("}"); String subMyString = line.substring(left+1, right); for (String myWord : subMyString.split("\\W+")) { if (myWord.length() &gt; 0) context.write(new Text(myWord), new IntWritable(1)); } } In my mapper.class And my input file: ... ...bla..bla..{asd assda sddsaasd asd} ...bla..bla..{asd assda sddsaasd asd} ...bla..bla..{asd assda sddsaasd asd} ... Naturally: line= ...bla..bla..{asd assda sddsaasd asd} In All line are includes "{" and "}" characters. I want fill in contex in between these characters. But I am getting java.lang.StringIndexOutOfBoundsException during compilation. How should I change my code? Why am I getting error? Thanks.
tagged with: mapper
has comment: http://stackoverflow.com/comment/36503801

http://stackoverflow.com/q/23747940
favorite count: 0
tagged with: ogg
has body: I am using Ogg Vorbis SPI as a means of decoding .ogg files. The code snippet I use for loading .ogg files and converting to PCM is not too dissimilar from the suggested one in the documentation: // The streams are valid at this point. try (InputStream bin = new BufferedInputStream(file.getInputStream(entry) ); AudioInputStream in = AudioSystem.getAudioInputStream(bin) ) { AudioFormat baseFormat = in.getFormat(); // At this point the format is valid: // VORBISENC 44100.0 Hz, unknown bits per sample, mono, 1 bytes/frame, 12000.0 frames/second, // I can't make a Clip directly from this or it will be all buzzy, so I convert to PCM // Decoding to PCM AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); // This is where the issues appear... AudioInputStream decodedInputStream = AudioSystem.getAudioInputStream(decodedFormat, in); Clip clip = AudioSystem.getClip(); clip.open(decodedInputStream); // entry.getName is basically the filename. Any files with '0' frame length didn't get converted properly. System.out.println("Clip " + entry.getName() + " loaded at " + clip.getFrameLength() + " frame length"); return clip; } catch { ... } What is happening is that I am loading several small sound files, in the range of low of 5K to high of 32K (in ogg format). A few files, however, will not convert properly to PCM. I noticed that they all have something in common; they range in size from 5K - 6K. The sound files seem to start being converted properly at around 7K. I tested this by taking an 11K sound and cutting it down until it no longer converted (~6K) I figure that one way around it would be to add some inaudible noise to fill the size, but I would prefer just properly converting the sound file regardless of size. Being completely new to the concepts of sound representation in addition to the API itself, I don't know where to start…
type: AnsweredQuestion
score: 4
has answer: http://stackoverflow.com/a/32477419
type: Question
tagged with: audio
has comment: http://stackoverflow.com/comment/36511386
tagged with: java
accepted answer: http://stackoverflow.com/a/32477419
upvote count: 4
has comment: http://stackoverflow.com/comment/36511018
has title: Using Ogg Vorbis SPI for decoding .ogg files fails for small file sizes
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36488953
type: Comment
has text: @maloney seems you need to implement logic for selection direction(up/down), also see suggestion of MadProgrammer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23735473

http://stackoverflow.com/q/23745527
has title: How to create database with Liquibase
downvote count: 0
answer count: 1
has body: I am trying to use Liquibase to create database that does not exists. I have downloaded MySQL and not made any change in it My maven plugin code looks like org.liquibase liquibase-maven-plugin 3.1.1 src/main/resources/changelog.xml com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/myApp?createDatabaseIfNotExist=true process-resources update When I run mvn clean install, I see error as Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:update (default) on project database_seed: Error setting up or running Liquibase: liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'myApp' -> [Help 1] How do I fix it?
has comment: http://stackoverflow.com/comment/128995103
has answer: http://stackoverflow.com/a/23745594
favorite count: 0
score: 9
tagged with: maven
has comment: http://stackoverflow.com/comment/36505145
type: AnsweredQuestion
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/23745594
tagged with: liquibase
type: Question
upvote count: 9

http://stackoverflow.com/a/23771269
has comment: http://stackoverflow.com/comment/36576192
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36573801
has comment: http://stackoverflow.com/comment/36578260
has comment: http://stackoverflow.com/comment/36566584
type: Answer
has comment: http://stackoverflow.com/comment/36555161
answers question: http://stackoverflow.com/q/23771091
has body: The usual approach in such a case is to compute the difference between the current and the previous position. This difference is then "the movement", that is added to the position of the dragged object. (BTW: You seem to not use the prev... values in your computation at all!) Inside a MouseMotionListener, this could roughly look as follows: class MouseDraggingControl implements MouseMotionListener { private Point previousPoint = new Point(); @Override public void mouseMoved(MouseEvent e) { previousPoint = e.getPoint(); } @Override public void mouseDragged(MouseEvent e) { int movementX = e.getX() - previousPoint.x; int movementY = e.getY() - previousPoint.y; doMovement(movementX, movementY); previousPoint = e.getPoint(); } } In your case, the doMovement method might be implemented like this: private void doMovement(int movementX, int movementY) { int oldX = theFrame.getX(); int oldY = theFrame.getY(); int newX = oldX + movementX; int newY = oldY + movementY; theFrame.setLocation(newX, newY); } (or similar, using the getBounds/setBounds calls) EDIT If the mouse motion listener is attached directly to the component that should be dragged, you might have to use the "location on screen" instead: class MouseDraggingControl implements MouseMotionListener { private Point previousPoint = new Point(); @Override public void mouseMoved(MouseEvent e) { previousPoint = e.getLocationOnScreen(); } @Override public void mouseDragged(MouseEvent e) { Point p = e.getLocationOnScreen(); int movementX = p.x - previousPoint.x; int movementY = p.y - previousPoint.y; doMovement(movementX, movementY); previousPoint = e.getLocationOnScreen(); } } If this does not solve your issue, I'd like to emphasize the comment from MadProgrammer: An example that demonstrates your actual problem would help here.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23771091
has comment: http://stackoverflow.com/comment/36578463
score: 3

http://stackoverflow.com/q/23683292
has title: changeListener not working for JSlider
has answer: http://stackoverflow.com/a/23683353
tagged with: swing
has body: How to print the JLabel at the top? import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class SampleFrame extends JFrame { private JPanel contentPane; private JPanel q; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SampleFrame frame = new SampleFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public SampleFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel p = new JPanel(); q = new JPanel(); JSlider pine = new JSlider(); contentPane.add(p, BorderLayout.CENTER); p.add(pine); contentPane.add(q, BorderLayout.NORTH); pine.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { JSlider sl = (JSlider)arg0.getSource(); String a = ((Integer)sl.getValue()).toString(); q.add(new JLabel(a)); } }); } }
type: AnsweredQuestion
tagged with: jslider
has answer: http://stackoverflow.com/a/23683514
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23683558
score: 0
accepted answer: http://stackoverflow.com/a/23683353
answer count: 3
possible better answer: http://stackoverflow.com/a/23683514

http://stackoverflow.com/q/23720859
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
tagged with: trayicon
score: 2
tagged with: system-tray
tagged with: java
tagged with: sleep
type: Question
has comment: http://stackoverflow.com/comment/36458520
downvote count: 0
has body: I have a class that does the following, though with a more constructive message: class myClass extends Thread{ TrayIcon icon = new TrayIcon(SomeImage); public myClass(){ SystemTray tray = SystemTray.getSystemTray(); tray.add(icon); } public run(){ final int seconds = 1000; try{ while(true){ icon.displayMessage("Some Title", "Some content", TrayIcon.MessageType.INFO); sleep(1800*seconds); } } catch(InterruptedException e){ this.run(); e.printStackTrace(); } } The class works and does what it is supposed to, showing some message to the user at a given interval. My problem appears when the computer goes into sleep-mode. After it has been in sleep-mode for some time, say 3 hours, TrayIcon.displayMessage() stops working properly. Messages that "should have" been displayed during sleep come sporadically and any new messages that are to be displayed will not be. The only solution I have found is to log off and back on to Windows, but I'd like to know if there's a less bothersome one.
has title: Java TrayIcon.displayMessage does not work after computer sleeps

http://stackoverflow.com/q/23716830
tagged with: tcp
type: AnsweredQuestion
has title: Spring Integration - Reliable TCP for high volume application
tagged with: spring-integration
tagged with: java
tagged with: nio
has comment: http://stackoverflow.com/comment/36455832
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36454189
downvote count: 0
has body: I'm using Spring Integration for TCP server which keeps connections to a few thousand clients. I need the server to throttle clients in case of excessive load and not to lose messages. My server configuration: &lt;task:executor id="myTaskExecutor" pool-size="4-8" queue-capacity="0" rejection-policy="CALLER_RUNS" /&gt; &lt;int-ip:tcp-connection-factory id="serverTcpConFact" type="server" port="60000" using-nio="true" single-use="false" so-timeout="300000" task-executor="myTaskExecutor" /&gt; &lt;int-ip:tcp-inbound-channel-adapter id="tcpInboundAdapter" channel="tcpInbound" connection-factory="serverTcpConFact" /&gt; &lt;channel id="tcpInbound" /&gt; &lt;service-activator input-channel="tcpInbound" ref="myService" method="test" /&gt; &lt;beans:bean id="myService" class="org.test.tcpserver.MyService" /&gt; Since the default task executor for the connection factory is unbounded, I use a pooled task executor to prevent out of memory errors. A simple client for load testing: public class TCPClientTest { static Socket socket; static List&lt;Socket&gt; sl = new ArrayList&lt;&gt;(); static DataOutputStream out; public static void main(String[] args) throws Exception { for (int i = 0; i &lt; 10000; i++) { socket = new Socket("localhost", 60000); sl.add(socket); out = new DataOutputStream(socket.getOutputStream()); out.writeBytes("connection " + i + "\r\n"); System.out.println("Using connection #" + i); } System.in.read(); } } When I run it, the server only receives about 10-20 messages and then the client gets the "Connection refused: connect" exception. After that the server can't accept any new connections anymore, even after the connection timeout. Increasing the pool size only helps to get a little bit more messages. EDIT I'm using Spring Integration 3.0.2.RELEASE. For production I'm using 8-40 threads, but it only makes this test to fail later, after several hundred connections. MyService.test() doesn't do much... public class MyService { public void test(byte[] input) {…
has answer: http://stackoverflow.com/a/23888758
favorite count: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/23723556
possible better answer: http://stackoverflow.com/a/23888758
score: 2
accepted answer: http://stackoverflow.com/a/23723556
upvote count: 2

http://stackoverflow.com/q/23716227
tagged with: java
has comment: http://stackoverflow.com/comment/36449093
accepted answer: http://stackoverflow.com/a/23716262
has comment: http://stackoverflow.com/comment/36449164
has comment: http://stackoverflow.com/comment/36449184
type: Question
upvote count: 2
has title: Java char representations for function keys?
answer count: 1
has answer: http://stackoverflow.com/a/23716262
tagged with: unicode
tagged with: char
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36449201
has comment: http://stackoverflow.com/comment/36449116
has comment: http://stackoverflow.com/comment/36449140
has body: I am trying to have a java application press a function key. I have been searching and I cannot find the unicodes for the F1-F12 function keys on a PC. What are they?
has comment: http://stackoverflow.com/comment/36449221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36449196
score: 1

http://stackoverflow.com/q/23716064
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: python
has comment: http://stackoverflow.com/comment/36448781
has comment: http://stackoverflow.com/comment/36448892
tagged with: c++
has comment: http://stackoverflow.com/comment/51525748
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36448920
has comment: http://stackoverflow.com/comment/36448978
has answer: http://stackoverflow.com/a/31828819
has title: JAVA_HOME "bug"
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36448862
type: Question
has comment: http://stackoverflow.com/comment/36448889
has comment: http://stackoverflow.com/comment/36448837
has body: so I trying to build project for cocos2d-x. I'm currently at cmd and when I type python android-build.py -p 19 cpp-tests it start making project but then I get error that build failed. Problem is bescause it can't find javac compiler. "Perhaps JAVA_HOME does not point to the JDk. It is currently set to "c:/Program Files/Java/jre7" Problem is bescause in system variables I made new variable called JAVA_HOME and it is pointed to C:\android\Java\jdk1.8.0_05\bin but still I getting that error. What to do guys?

http://stackoverflow.com/comment/36309259
has text: You are not showing all of them at once, right? Use a `ListView`. Also check this out https://github.com/JakeWharton/butterknife
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23642961
score: 0

http://stackoverflow.com/a/23627046
answers question: http://stackoverflow.com/q/23626686
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23626686
type: Answer
has body: Is it good approach? Locking resources in multi-threaded environments is always good, but marking as volatile and synchronizing on the resource is redundant as far as I know since both accomplish almost the same thing in the posted scenario. When I use synchronized blocks I prefer to lock on the class like this: synchronized(MyClass.class) { ... } Why i do this: both static and non-static methods will be blocked. no other external object will be able to lock on your object and possibly create subtle bugs. Still using synchronized blocks like you did is OK too in most scenarios (kinda like the same as what I prefer to do), but if you encounter problems (Performance, things you can't accomplish, starvation), I recommend using a structure like ReentrantLock. It offers more flexibility and may offer some bonus performance. Also it can accomplish things a synchronized block can not. Also something like ReadWriteLock or ReentrantReadWriteLock could serve you well in some scenarios so they are worth reading about too. Should lock be volatile? As far as I know there is no reason to. The locking objects are implied to be volatile like.
upvote count: 1

http://stackoverflow.com/q/23774563
score: 0
answer count: 1
has body: I am working on a project where it would be desirable to capture a signature from the user once they have read over our policy documents. The way that I have went about it is to use the GestureOverlayView class. MainActivity.java package com.jtryon.signaturecap.app; import android.gesture.GestureOverlayView; import android.graphics.Bitmap; import android.os.Environment; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import java.io.File; import java.io.FileOutputStream; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void saveSig(View view) { try { GestureOverlayView gestureView = (GestureOverlayView) findViewById(R.id.signaturePad); gestureView.setDrawingCacheEnabled(true); Bitmap bm = Bitmap.createBitmap(gestureView.getDrawingCache()); File f = new File(Environment.getExternalStorageDirectory() + File.separator + "signature.png"); f.createNewFile(); FileOutputStream os = new FileOutputStream(f); os = new FileOutputStream(f); //compress to specified format (PNG), quality - which is ignored for PNG, and out stream bm.compress(Bitmap.CompressFormat.PNG, 100, os); os.close(); } catch (Exception e) { Log.v("Gestures", e.getMessage()); e.printStackTrace(); } } } activity_main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context="com.jtryon.signaturecap.app.MainActivity"&gt; &lt;and…
has title: What is an effective way to capture a signature from a user?
tagged with: android
has comment: http://stackoverflow.com/comment/36561131
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23774633

http://stackoverflow.com/comment/36354657
comment on: http://stackoverflow.com/q/23666168
type: Comment
type: QuestionComment
score: 0
has text: Do you have two different Java installations on your system? Maybe one in `Program Files (x86)` and one in `Program Files`?

http://stackoverflow.com/comment/36366563
type: Comment
type: QuestionComment
has text: The `name` attribute of `<s:textfield>` must match the corresponding property in the model - `TestBean`. Are you sure?
comment on: http://stackoverflow.com/q/23670842
score: 0

http://stackoverflow.com/q/23770108
has body: When I try to build the app on Eclipse, I get the following error: 05-20 15:04:51.202: E/AndroidRuntime(1543): FATAL EXCEPTION: main 05-20 15:04:51.202: E/AndroidRuntime(1543): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.devyanlab.testapp/com.devyanlab.testapp.activities.IntroActivity}: java.lang.ClassNotFoundException: Didn't find class "com.devyanlab.testapp.activities.IntroActivity" on path: DexPathList[[zip file "/data/app/com.devyanlab.testapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.devyanlab.testapp-1, /system/lib]] 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.app.ActivityThread.access$600(ActivityThread.java:141) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.os.Handler.dispatchMessage(Handler.java:99) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.os.Looper.loop(Looper.java:137) 05-20 15:04:51.202: E/AndroidRuntime(1543): at android.app.ActivityThread.main(ActivityThread.java:5103) 05-20 15:04:51.202: E/AndroidRuntime(1543): at java.lang.reflect.Method.invokeNative(Native Method) 05-20 15:04:51.202: E/AndroidRuntime(1543): at java.lang.reflect.Method.invoke(Method.java:525) 05-20 15:04:51.202: E/AndroidRuntime(1543): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 05-20 15:04:51.202: E/AndroidRuntime(1543): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 05-20 15:04:51.202: E/AndroidRuntime(1543): at dalvik.system.NativeStart.main(Native Method) 05-20 15:04:51.202: E/AndroidRuntime(1543): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.devyanlab.testapp.activities.In…
type: Question
upvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24969891
has title: Error "Unable to instantiate activity ... Didn't find class on path: DexPathList"
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/36309982
type: Comment
type: QuestionComment
has text: Unless you have an extremely long date string, you really shouldn't care about creating a new `String` object from the `StringBuilder`.
score: 0
comment on: http://stackoverflow.com/q/23643243

http://stackoverflow.com/q/23695900
tagged with: java
has body: I'm trying to print an html file directly to the default printer without showing print dialog to the user. I just got the below code from some online tutorials and it worked well for the PNG file. import javax.print.*; import javax.print.attribute.*; import java.io.*; public class Printing { public static void main(String args[]) throws Exception { String filename = args[0]; PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG; PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras); PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); PrintService service = ServiceUI.printDialog(null, 200, 200, printService, defaultService, flavor, pras); if (service != null) { DocPrintJob job = service.createPrintJob(); FileInputStream fis = new FileInputStream(filename); DocAttributeSet das = new HashDocAttributeSet(); Doc doc = new SimpleDoc(fis, flavor, das); job.print(doc, pras); Thread.sleep(10000); } System.exit(0); } } I would like to change DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG; to DocFlavor flavor = DocFlavor.INPUT_STREAM.&lt;some html format&gt;; Please suggest which format would be appropriate to use here ? and please suggest how to avoid print dialog pop up while running this code. ? Thanks in Advance Sandy
type: Question
tagged with: printing
has answer: http://stackoverflow.com/a/23696144
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23696144
has title: Printing an html file using java without showing print dialog to the user
upvote count: 1
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/36452070
has text: Also, looking at the documentation, json-simple can produce an object output with a similar API to Android's JSON parser, but you can control the type of the `Map` it uses to store the values: `LinkedHashMap` can be used to preserve the order the items are added. This may be the simplest solution, as your code would not need to change very much to use this.
type: AnswerComment
comment on: http://stackoverflow.com/a/23717649
score: 0
type: Comment

tdd
tags question: http://stackoverflow.com/q/23752048
type: Tag
tags question: http://stackoverflow.com/q/23685035
tags question: http://stackoverflow.com/q/23751500
tag name: tdd
tags question: http://stackoverflow.com/q/23656135

http://stackoverflow.com/q/23617569
answer count: 1
favorite count: 0
has body: I'm getting this error on GCM and sometime I receive the message but no notification was generated. Could anyone help me to identify what's the problem? Here's my code (some business logic code was removed for simplicity): GcmBroadcastReceiver: public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } } GcmIntentService: public class GcmIntentService extends GCMBaseIntentService { private static final String TAG = "GCMIntentService"; public GcmIntentService() { super(ConstantManager.SENDER_ID); } /** * Method called on device registered **/ @Override protected void onRegistered(Context context, String registrationId) { Log.i(TAG, "Device registered: regId = " + registrationId); } /** * Method called on device un registred * */ @Override protected void onUnregistered(Context context, String registrationId) { Log.i(TAG, "Device unregistered"); } /** * Method called on Receiving a new message * */ @Override protected void onMessage(Context context, Intent intent) { Log.i(TAG, "Received message"); String message = intent.getExtras().getString("message"); String type = intent.getExtras().getString("type"); int eventId = 0; generateNotification(context, message,2,eventId); } /** * Method called on receiving a deleted message * */ @Override protected void onDeletedMessages(Context context, int total) { Log.i(TAG, "Received deleted messages notification"); // notifies user generateNotification(context, "Deleted Message",0,0); } /** * Method called on Error * */ @Override public void onError(Context context, String errorId) { Log.i(TAG, "Received error: " + errorId); } @O…
has title: GCMBaseIntentService - Wakelock reference is null
tagged with: android
has answer: http://stackoverflow.com/a/32646159
downvote count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23787007
type: Answer
has body: Thanks for the help (especially Thomas). The guide i used for my project stated log4j and slf4j would be necessary as external references in the pom.xml. I simply removed it and it is working now. This has taught me however, that it really makes life simpler by not combining server and client dependencies.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23742185
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23742185

http://stackoverflow.com/q/23715958
tagged with: selenium
type: Question
has body: I am trying to automate initial configuration(of my server) through webpage. After hitting my server ip https:/localhost:4443 and entering my credentials ,i get a window to change password(overlay/popup window). Problem:- if i browse the same ip from another m/c or from another browser , i get a window over window i.e one more window over change password window(Please click the link to see the screenshot). What i tried is to get the handle of the window but its not working, its providing one handle only. **Its not frame also. HTML code -- https://dl.dropboxusercontent.com/u/91420517/Html_Code.JPG Here's my code WebDriver driver=new FirefoxDriver(); driver.get("https://localhost:4443/ControlPoint/"); driver.findElement(By.xpath("//*[@id='name']")).sendKeys("xxxxxx"); driver.findElement(By.xpath("//*[@id='pass']")).sendKeys("xxxxxx"); driver.findElement(By.xpath("//*[@id='loginForm123']/div[6]/div[1]/div")).click(); Set&lt;String&gt; winIds = driver.getWindowHandles(); System.out.println("Total Windows --- " + winIds.size()); // its resulting the size as 1 which is not correct. Iterator&lt;String&gt; it = winIds.iterator(); String mainWin=it.next(); String changeWin=it.next(); String shareWin =it.next(); driver.switchTo().window(shareWin); String warning = driver.findElement(By.xpath("html/body/div[4234]/div[1]/span")).getText(); // to get the text on 3 window System.out.println(warning); How to resolve this issue .Please help. Any other way to click on buttons on window 3.
has title: How to handle overlay/popup window using selenium webdriver
accepted answer: http://stackoverflow.com/a/23722042
score: 0
has comment: http://stackoverflow.com/comment/36455289
answer count: 1
has comment: http://stackoverflow.com/comment/36449105
has answer: http://stackoverflow.com/a/23722042
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36449181
tagged with: java
has comment: http://stackoverflow.com/comment/36449252

http://stackoverflow.com/q/23705032
answer count: 2
has comment: http://stackoverflow.com/comment/36428352
has title: When you develop a library in Java, how does it become a "standard" library?
accepted answer: http://stackoverflow.com/a/23705157
has comment: http://stackoverflow.com/comment/36428433
favorite count: 0
has comment: http://stackoverflow.com/comment/36428105
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36428490
has body: Suppose that I developed a library and published it as a project. What makes my library a "standard" library for Java and be in next JDK version?
has comment: http://stackoverflow.com/comment/36428391
tagged with: java
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23705157
type: Question
possible better answer: http://stackoverflow.com/a/23705217
has answer: http://stackoverflow.com/a/23705217
tagged with: standards
score: -1

http://stackoverflow.com/q/23616540
tagged with: java
tagged with: image
tagged with: servlets
has body: Following is the snippet from a servlet that attempts to fetch image from the URL. I have fetched the bytes. Now how do I display the image on the webpage ? response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { URL url = new URL("https://abc/zhdhaG1z_bigger.jpeg"); InputStream stream = new BufferedInputStream(url.openStream()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte buf[] = new byte[1024]; int n = 0; while(-1 != (n = stream.read(buf)) ) { bos.write(buf, 0, n); } byte res[] = bos.toByteArray(); } finally { out.close(); }
has title: How to display image on a web-page from a url
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: web-applications
type: Question
has answer: http://stackoverflow.com/a/23616907

http://stackoverflow.com/comment/36467969
score: 0
type: Comment
type: QuestionComment
has text: ImageEditorDeluxe.java:185, what does that line have ?
comment on: http://stackoverflow.com/q/23725835

http://stackoverflow.com/a/23745545
has comment: http://stackoverflow.com/comment/36512228
has comment: http://stackoverflow.com/comment/36509240
has comment: http://stackoverflow.com/comment/66714939
downvote count: 0
type: Answer
has body: If you have a cache layer between the controller and the database, you shouldn't worry about the "If-Modified-Since" header. As long as the resource is not modified, you'll get it really quickly from the cache; After the resource is modified, it will be retrieved from the DB and added to the cache layer. Checking the modified data, might be slower than getting the resource from the cache, as it hits the database.
score: 1
answers question: http://stackoverflow.com/q/23745437
upvote count: 1

http://stackoverflow.com/comment/36280553
has text: where i can put the method ??
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23628388
type: AnswerComment

http://stackoverflow.com/comment/36447957
type: QuestionComment
has text: @BarbiePylon, please wrap your comment as an answer and post it, so after acceptance this question can be closed, and others may learn from it.
score: 0
comment on: http://stackoverflow.com/q/23701361
type: Comment

http://stackoverflow.com/comment/36291870
comment on: http://stackoverflow.com/q/23634492
score: 0
type: Comment
type: QuestionComment
has text: Maybe you are shadowing your instance variables in your constructor...

http://stackoverflow.com/comment/36522142
type: Comment
comment on: http://stackoverflow.com/a/23752409
score: 0
type: AnswerComment
has text: You can shorten it by setting `rowLayout.marginHeight = 0` and `rowLayout.marginWidth = 0`.

http://stackoverflow.com/comment/36370238
type: AnswerComment
comment on: http://stackoverflow.com/a/23674173
score: 0
type: Comment
has text: @user3580294 For instance, Java has an interesting take on lookbehinds, without quite supporting infinite-width lookbehinds. It also supports \Q\E syntax, like PCRE. Every engine is different. For my own use, I don't develop in regex101, I use RegexBuddy because it's an amazing product, I love regex and I can affort the forty bucks. :) There's a free trial somewhere.

http://stackoverflow.com/q/23756984
downvote count: 0
tagged with: .net
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23966335
tagged with: php
type: AnsweredQuestion
tagged with: cookies
upvote count: 3
accepted answer: http://stackoverflow.com/a/23966335
has title: Do individual cookie settings take precedence over those in the web.config?
type: Question
score: 3
has body: Suppose I have the following in my web.config in the appriopriate place: &lt;httpCookies requireSSL="true" /&gt; This sets all httpCookies as Secure by default. If I then have the following cookie: var cookie = new HttpCookie("ResultsPerPage", "50"); cookie.Secure = false; Response.Cookies.Add(cookie); Will this cookie have Secure set to True or to False? Does this also apply if we try to set HttpOnly this way? Does it work the other way around too (requireSSL = "false" and cookie.Secure=true)? The above method is for .NET, but you can also set cookies in PHP and Java. If I use the comparable methods (web.xml/inline or php.ini/in the script) for Java and PHP, is the result the same as in .NET?
tagged with: java

http://stackoverflow.com/q/23627361
has title: Change DropDownChoice to ListView in Wicket
has body: I need to change in CustomPagingPanel DropDownChoice where I collect information about paging like [1-50], [51-100], to ListView.So I have a code: // Ajax DropDownChoice used as Page navigator pagingDropDownChoice = new DropDownChoice("pagesDropDown", new PropertyModel(this, "currentPage"), new PropertyModel(this, "pages"), new ChoiceRenderer("period", "pageNum")); pagingDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { criteria.setPageNum((int)currentPage.getPageNum()); updatePagingList(target); setLinkVisibility(); target.add(pagingSizeLabel); target.add(pagingDropDownChoice); target.add(nextLink); target.add(previousLink); } }); add(pagingDropDownChoice.setOutputMarkupId(true)); The problem is DropDownChoice in Wicket generates &lt;select&gt; tags, I need &lt;ul&gt;&lt;li&gt; tags in HTML markups.
tagged with: dropdownchoice
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36284271
has answer: http://stackoverflow.com/a/23692225
tagged with: java
tagged with: listview
accepted answer: http://stackoverflow.com/a/23654208
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36312619
has answer: http://stackoverflow.com/a/23654208
score: 0
possible better answer: http://stackoverflow.com/a/23692225
tagged with: wicket

http://stackoverflow.com/comment/36553353
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23770301
has text: So how would I create a factory manager for internal frames? I have no idea how I would go about writing this.

http://stackoverflow.com/comment/36453378
comment on: http://stackoverflow.com/a/23699826
score: 0
type: AnswerComment
has text: I've seen it happen the other esy where the server tried to send to the client and got a socket error. The server listens on a socket for client requests, then typically spawns a dedicated thread to handle the client on a dedicated socket, while the well known port is freed up to accept more client reqs. Regardless, the first step is to check the classpath.
type: Comment

http://stackoverflow.com/comment/36469313
type: QuestionComment
comment on: http://stackoverflow.com/q/23726474
score: 0
has text: Different threads aren't going to help as swing uses a single thread for updating the EDT, so you'd only end up creating more issues. The paint manager may repaint a component for any number reasons, many of which are out side of your direct control. I'd be more concerned about why the chart is taking so long to repaint as it shouldn't need to do a complete repaint unless the underlying model or component has changed in some way
type: Comment

http://stackoverflow.com/a/23994954
answers question: http://stackoverflow.com/q/23674157
score: 0
has body: You can first try to figure out where the actual problem is occurring. - First you can check if the data is actually being retrieved from database. In servlet doGet method you iterate over country list and print its data using system.out.println - If you are able to retrieve data then on the client side see that proper Json data is coming. You can check response on client side using firebug. - In the jQuery code use console.log to check whether the data is coming or not. You can put log statement before and after the if(responseJson!=null) to check if data is actually null or not. - If data is not null then there must be some issue with the format in which data is coming or how you are iterating over the data.
type: Answer

http://stackoverflow.com/comment/36444145
type: AnswerComment
has text: @BheshGurung I believe the *minor modification* is what OP's second question was about. And "With minor modifications, you could get it to throw a `ClassCastException` on a line that **doesn't contain an explicit cast**."
type: Comment
comment on: http://stackoverflow.com/a/23713453
score: 1

http://stackoverflow.com/a/23645799
has body: You can add ImageView and EditText to FrameLayout, then EditText will overlay your image. To drag view you should set OnTouchListner: mEditText.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final int action = event.getAction(); mLastTouchX = event.getRawX(); mLastTouchY = event.getRawY(); switch (action) { case MotionEvent.ACTION_DOWN: { RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) getLayoutParams(); mDeltaX = mLastTouchX - lParams.leftMargin; mDeltaY = mLastTouchY - lParams.topMargin; break; } case MotionEvent.ACTION_MOVE: { mLastTouchX = event.getRawX(); mLastTouchY = event.getRawY(); final RelativeLayout.LayoutParams params = (LayoutParams) getLayoutParams(); params.leftMargin = (int) (mLastTouchX - mDeltaX); params.topMargin = (int) (mLastTouchY - mDeltaY); setLayoutParams(params); break; } } invalidate(); return true; } }); To create final image you can draw on canvas your original image and text. UPDATED: You can add view with addView: final EditText et = new EditText(getContext()); et.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); mFramLayout.addView(et); Also it's possible to adjust position with margins.
answers question: http://stackoverflow.com/q/23645260
type: Answer
has comment: http://stackoverflow.com/comment/36314430
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36315700
downvote count: 0

http://stackoverflow.com/a/23628764
has comment: http://stackoverflow.com/comment/36324894
has comment: http://stackoverflow.com/comment/36281723
answers question: http://stackoverflow.com/q/23628501
score: 0
has comment: http://stackoverflow.com/comment/36281074
type: Answer
has body: Depends on your database structure and application. You can use an object relational mapping library like ormlite and refresh objects loaded from database at the background with threads. With ormlite you may also use LazyForeignCollection to load only required data in your application.
has comment: http://stackoverflow.com/comment/36291112

arrays
tags question: http://stackoverflow.com/q/23759219
tags question: http://stackoverflow.com/q/23648302
tags question: http://stackoverflow.com/q/23741627
tags question: http://stackoverflow.com/q/23754325
tags question: http://stackoverflow.com/q/23772738
tags question: http://stackoverflow.com/q/23667217
tags question: http://stackoverflow.com/q/23725681
tags question: http://stackoverflow.com/q/23690995
tags question: http://stackoverflow.com/q/23641872
tags question: http://stackoverflow.com/q/23726373
type: Tag
tags question: http://stackoverflow.com/q/23729460
tags question: http://stackoverflow.com/q/23717653
tags question: http://stackoverflow.com/q/23688337
tags question: http://stackoverflow.com/q/23737505
tags question: http://stackoverflow.com/q/23705765
tags question: http://stackoverflow.com/q/23676296
tags question: http://stackoverflow.com/q/23749962
tags question: http://stackoverflow.com/q/23739966
tags question: http://stackoverflow.com/q/23702038
tags question: http://stackoverflow.com/q/23712531
tags question: http://stackoverflow.com/q/23648841
tags question: http://stackoverflow.com/q/23642787
tags question: http://stackoverflow.com/q/23756862
tags question: http://stackoverflow.com/q/23710086
tags question: http://stackoverflow.com/q/23658550
tags question: http://stackoverflow.com/q/23730092
tags question: http://stackoverflow.com/q/23644529
tags question: http://stackoverflow.com/q/23758904
tags question: http://stackoverflow.com/q/23755919
tags question: http://stackoverflow.com/q/23628239
tags question: http://stackoverflow.com/q/23673317
tags question: http://stackoverflow.com/q/23713262
tags question: http://stackoverflow.com/q/23636272
tags question: http://stackoverflow.com/q/23650317
tags question: http://stackoverflow.com/q/23740998
tags question: http://stackoverflow.com/q/23720738
tags question: http://stackoverflow.com/q/23728525
tags question: http://stackoverflow.com/q/23721222
tags question: http://stackoverflow.com/q/23718058
tags question: http://stackoverflow.com/q/23729029
tags question: http://stackoverflow.com/q/23642694
tags question: http://stackoverflow.com/q/23644881
tags question: http://stackoverflow.com/q/23675010
tags question: http://stackoverflow.com/q/23775355
tags question: http://stackoverflow.com/q/23750542
tags question: http://stackoverflow.com/q/23632227
tags question: http://stackoverflow.com/q/23724401
tags question: http://stackoverflow.com/q/23718798
tags question: http://stackoverflow.com/q/23663613
tags question: http://stackoverflow.com/q/23723045
tags question: http://stackoverflow.com/q/23627732
tags question: http://stackoverflow.com/q/23624177
tags question: http://stackoverflow.com/q/23678902
tags question: http://stackoverflow.com/q/23709229
tags question: http://stackoverflow.com/q/23621245
tags question: http://stackoverflow.com/q/23764029
tags question: http://stackoverflow.com/q/23726323
tags question: http://stackoverflow.com/q/23663138
tags question: http://stackoverflow.com/q/23750807
tags question: http://stackoverflow.com/q/23761984
tags question: http://stackoverflow.com/q/23727346
tags question: http://stackoverflow.com/q/23643876
tags question: http://stackoverflow.com/q/23661537
tags question: http://stackoverflow.com/q/23713350
tags question: http://stackoverflow.com/q/23689743
tags question: http://stackoverflow.com/q/23666145
tag name: arrays
tags question: http://stackoverflow.com/q/23716399
tags question: http://stackoverflow.com/q/23716929
tags question: http://stackoverflow.com/q/23761524
tags question: http://stackoverflow.com/q/23701593
tags question: http://stackoverflow.com/q/23635211
tags question: http://stackoverflow.com/q/23677571
tags question: http://stackoverflow.com/q/23722067
tags question: http://stackoverflow.com/q/23718497
tags question: http://stackoverflow.com/q/23659430
tags question: http://stackoverflow.com/q/23630951
tags question: http://stackoverflow.com/q/23617235
tags question: http://stackoverflow.com/q/23777556

http://stackoverflow.com/a/23615926
upvote count: 2
has body: In the current code you are using the try-with-resources statement, so your ZipFile docsZip is closed as soon as the try is completed. When you put the declaration of docsZip within the try it will not be closed (note that this should then be done somewhere after out.close().
has comment: http://stackoverflow.com/comment/36256523
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23615768
answers question: http://stackoverflow.com/q/23615768
has comment: http://stackoverflow.com/comment/36257187
type: Answer
has comment: http://stackoverflow.com/comment/36256741
score: 2

http://stackoverflow.com/comment/107730640
comment on: http://stackoverflow.com/a/45837486
type: AnswerComment
has text: @LoBo Probably not. This is just an idea, which will work for simple cases. Users can extend it for thread safety/parallelism.
type: Comment
score: 1

http://stackoverflow.com/q/23699279
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/36416712
has title: Sending Arabic SMS using JSMPP
has comment: http://stackoverflow.com/comment/36416495
tagged with: jsmpp
type: AnsweredQuestion
favorite count: 0
score: -1
type: Question
has answer: http://stackoverflow.com/a/23709397
answer count: 1
has body: I have created an application which retrieves SMS from database and send it over SMPP using JSMPP. When I run it from IDE (Intellij Idea) it delivers the SMS correctly to cell phone but when I create Jar of it and than run it as a window service than the SMS is not correctly encoded. My question is, are there any certain JVM parameters that I should pass to while creating Jar ?
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/36416670
accepted answer: http://stackoverflow.com/a/23709397
tagged with: encoding
upvote count: 0

http://stackoverflow.com/comment/93626413
type: QuestionComment
type: Comment
has text: All the Dropbox links are dead...
comment on: http://stackoverflow.com/q/23737169
score: 0

http://stackoverflow.com/q/23728514
score: 1
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/49750038
type: Question
upvote count: 2
answer count: 2
has title: Trying out Geb in the Groovy Console
has answer: http://stackoverflow.com/a/30895320
linked to: http://stackoverflow.com/q/12588082
tagged with: groovy
tagged with: geb
has answer: http://stackoverflow.com/a/23737989
downvote count: 1
has comment: http://stackoverflow.com/comment/49774263
favorite count: 0
type: UnansweredQuestion
has body: I am trying to do some really simple bare bones inline coding with Geb in the Groovy Console. I installed Groovy, downloaded the Geb jar and have Selenium downloaded. I have opened the console and pasted in the very simple :- @Grapes([ @Grab("org.codehaus.geb:geb-core:0.7.2"), @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.28.0"), @Grab("org.seleniumhq.selenium:selenium-support:2.28.0") ]) import geb.Browser Browser.drive { go "http://google.com/" assert title == "Google" } When I run this, Firefox opens and hangs on a blank page for ages before the console responds with a spam of errors that is too long to post here. So I put it on PasteBucket Link -> http://www.pastebucket.com/40187 I am really struglging to just get started with Geb. I had no problems taking off with Selenium Webdriver and doing automation via Java scripts, but after a few hours of struggling through vague or overly complex guides I am still unable to make even the simplest Geb script run. Any assistance would be greatly appreciated. I feel like I have missed some important steps.

http://stackoverflow.com/comment/36545770
score: 2
comment on: http://stackoverflow.com/q/23766615
has text: By the time your main thread gets to execute `t.interrupt()`, your `sleeper` thread has already finished executing!
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36439511
type: AnswerComment
has text: I already had those in AndroidManifest. I have another banner ad in the main activity which works. This interstitial ad is not in the main activity.
type: Comment
comment on: http://stackoverflow.com/a/23710578
score: 0

http://stackoverflow.com/q/23676373
possible better answer: http://stackoverflow.com/a/23676423
has body: I have a gigantic XML file, like this: <?xml version="1.0"?> Gambardella, Matthew XML Developer's Guide Ralls, Kim Midnight Rain [... one gazillion more entries ...] I want to iterate over this file in a streaming fashion, so that I never have to load the whole thing into memory, something like: InputStream stream = new FileInputStream("gigantic-book-list.xml"); String nodeName = "book"; Iterator it = new StreamingXmlIterator(stream, nodeName); Document bk101 = it.next(); Document bk102 = it.next(); Also, I'd like this to work with different XML input files, without having to create specific objects (e.g. Book.java). @McDowell has a promising approach that use XMLStreamReader and StreamFilter at https://stackoverflow.com/a/16799693/13365, but that only extracts a single node. Also, Camel's .tokenizeXML does exactly what I want, so I guess I should look into the source code.
has answer: http://stackoverflow.com/a/23676423
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/23682065
accepted answer: http://stackoverflow.com/a/23725795
tagged with: stream
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: How do I iterate over nodes in a huge XML in a streaming fashion?
type: Question
tagged with: iterator
downvote count: 0
has answer: http://stackoverflow.com/a/23725795
linked to: http://stackoverflow.com/q/16796418
has answer: http://stackoverflow.com/a/34868690

http://stackoverflow.com/q/23654018
has answer: http://stackoverflow.com/a/23654122
has answer: http://stackoverflow.com/a/23654102
accepted answer: http://stackoverflow.com/a/23654122
has comment: http://stackoverflow.com/comment/36330028
answer count: 4
has comment: http://stackoverflow.com/comment/36330083
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23654137
type: Question
has title: Returning from submethod from super
has body: I have something like this: class SuperClass { public void onClick(){ if(disabled) return; } } class SubClass extends SuperClass { public void onClick(){ super.onClick(); System.out.println("Clicked"); } } This outputs "Clicked" every time I click the button. I want the SubClass onClick() to not work if disabled is true and don't want to add an extra line in every SubClass. How can I do that?
has answer: http://stackoverflow.com/a/23654114
tagged with: super
possible better answer: http://stackoverflow.com/a/23654102
score: 0
tagged with: java

http://stackoverflow.com/comment/36260649
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23617188
has text: https://sourceforge.net/projects/flawedjavaframeworkgame1/files/latest/download
type: Comment

http://stackoverflow.com/a/29813898
has body: I am currently renaming .aar file as .zip and then extracting it. After that I rename the classes.jar to jar file name I want. A bit tedious but this is how I am currently using .aars file in eclipse.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/58067310
downvote count: 0
answers question: http://stackoverflow.com/q/23697621
upvote count: 2

http://stackoverflow.com/q/23774414
has comment: http://stackoverflow.com/comment/36561204
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/23775078
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/36560776
has title: Values not binding properly to Select Option in jsp using enhanced for loop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36561073
tagged with: foreach
has body: The select option value are dynamically bind in jsp page but the if the first value is Views all other option value are becoming Views like wise, if the value is Edit then all become Edit can't able to fix the problem, in this plevel is the arrayList it has either Edit or Views value, help me to find the solution.... <% for (Object level : plevel) { if (level.equals("Views")) { %> <%=level%> Edit <%} else if (level.equals("Edit")) {%> <%=level%> Views <% } %> } This is my output image
has comment: http://stackoverflow.com/comment/36560612
has comment: http://stackoverflow.com/comment/36561357
tagged with: java
has answer: http://stackoverflow.com/a/23774652
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36560839
tagged with: jsp

http://stackoverflow.com/comment/36285557
type: Comment
comment on: http://stackoverflow.com/a/23631023
has text: I agree with you, but it's the closest analog to PHP function
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36448135
has text: what's exactly your question?
comment on: http://stackoverflow.com/q/23715593
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36580241
has text: Do u want to change jar at runtime ? and dont want to restart JVM ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23739356

http://stackoverflow.com/q/23689765
has body: The default path of my app is localhost:8080/myapp . If I click something on the page which is supposed to redirect me to localhost:8080/myapp/page1 I get 404 back (The requested resource is not available.) because the actual request made is localhost:8080/page1 . Fair enough, my RequestMapping is "/page1". The question is how do I enforce the contextpath as a prefix to all requests ? What is the best way to deal with this ? P.S. I don't want to rename my app to Root
type: UnansweredQuestion
upvote count: 1
tagged with: tomcat7
tagged with: web-services
has comment: http://stackoverflow.com/comment/36400719
tagged with: spring-mvc
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23691887
tagged with: tomcat
favorite count: 0
has title: How to add Context Path to request URI?

http://stackoverflow.com/comment/36552862
type: Comment
has text: I'm so fricking greatful man, been looking at this for an hour, made the byte arrays global not local. Dumb me :|
type: AnswerComment
comment on: http://stackoverflow.com/a/23769991
score: 0

bukkit
tags question: http://stackoverflow.com/q/23743922
tag name: bukkit
tags question: http://stackoverflow.com/q/23769553
tags question: http://stackoverflow.com/q/23758710
tags question: http://stackoverflow.com/q/23686778
tags question: http://stackoverflow.com/q/23715723
type: Tag
tags question: http://stackoverflow.com/q/23667883
tags question: http://stackoverflow.com/q/23721752
tags question: http://stackoverflow.com/q/23769444

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/23655271
tags question: http://stackoverflow.com/q/23730722
tags question: http://stackoverflow.com/q/23650824
tags question: http://stackoverflow.com/q/23766700
tags question: http://stackoverflow.com/q/23687640
tags question: http://stackoverflow.com/q/23649083
tags question: http://stackoverflow.com/q/23760472
tags question: http://stackoverflow.com/q/23623594
tags question: http://stackoverflow.com/q/23662341
tags question: http://stackoverflow.com/q/23641750
tags question: http://stackoverflow.com/q/23724079
tags question: http://stackoverflow.com/q/23682679
tags question: http://stackoverflow.com/q/23745131
tags question: http://stackoverflow.com/q/23671016
tags question: http://stackoverflow.com/q/23676719
tags question: http://stackoverflow.com/q/23658953
tags question: http://stackoverflow.com/q/23750837
tags question: http://stackoverflow.com/q/23686801
tags question: http://stackoverflow.com/q/23712510
type: Tag
tags question: http://stackoverflow.com/q/23742195
tags question: http://stackoverflow.com/q/23731110
tags question: http://stackoverflow.com/q/23764791
tags question: http://stackoverflow.com/q/23713329
tags question: http://stackoverflow.com/q/23714471
tags question: http://stackoverflow.com/q/23701420
tags question: http://stackoverflow.com/q/23693641
tags question: http://stackoverflow.com/q/23626105
tags question: http://stackoverflow.com/q/23621122
tags question: http://stackoverflow.com/q/23697172
tags question: http://stackoverflow.com/q/23712352
tags question: http://stackoverflow.com/q/23755741
tags question: http://stackoverflow.com/q/23636304
tags question: http://stackoverflow.com/q/23699784
tags question: http://stackoverflow.com/q/23764865
tags question: http://stackoverflow.com/q/23661317
tags question: http://stackoverflow.com/q/23751232
tags question: http://stackoverflow.com/q/23743425
tags question: http://stackoverflow.com/q/23737300
tags question: http://stackoverflow.com/q/23757183
tags question: http://stackoverflow.com/q/23702042
tags question: http://stackoverflow.com/q/23665665
tags question: http://stackoverflow.com/q/23640934
tags question: http://stackoverflow.com/q/23725753
tags question: http://stackoverflow.com/q/23683350
tag name: html
tags question: http://stackoverflow.com/q/23778094
tags question: http://stackoverflow.com/q/23646457
tags question: http://stackoverflow.com/q/23618666
tags question: http://stackoverflow.com/q/23709433
tags question: http://stackoverflow.com/q/23655503
tags question: http://stackoverflow.com/q/23673596
tags question: http://stackoverflow.com/q/23675662
tags question: http://stackoverflow.com/q/23724260

http://stackoverflow.com/a/23764970
answers question: http://stackoverflow.com/q/23764826
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23764826
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: The problem is the TCP slow-start. http://en.wikipedia.org/wiki/Slow-start Try to first transfer something like 10KBs, followed by the real measurement transfer. Make sure to use the same connection for both transfers.

recreate
type: Tag
tags question: http://stackoverflow.com/q/23672259
tag name: recreate

http://stackoverflow.com/a/44515971
score: 2
answers question: http://stackoverflow.com/q/23667462
upvote count: 2
downvote count: 0
has body: You need to re-check your Scanner statement and Initializing statement... Scanner n = new Scanner(System.in); boolean bn = s.nextBoolean(); It should be Scanner n = new Scanner(System.in); boolean bn = n.nextBoolean();
type: Answer

http://stackoverflow.com/comment/36298973
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23637320
has text: Check the id of your relative layout in your xml file..That should be replaced for the `relativelayout`..

http://stackoverflow.com/comment/36433415
score: 0
type: Comment
type: QuestionComment
has text: the for each loops indefinitely
comment on: http://stackoverflow.com/q/23707891

http://stackoverflow.com/comment/36373580
type: QuestionComment
score: 0
has text: Your assumption is wrong. You are again initializing copyFrom with another object, then how still will point to the previous object. Think with a common sense you will realize the situation.
comment on: http://stackoverflow.com/q/23676296
type: Comment

http://stackoverflow.com/q/23632493
tagged with: android
has comment: http://stackoverflow.com/comment/36329505
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36294522
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36295026
linked to: http://stackoverflow.com/q/23653778
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36287904
has comment: http://stackoverflow.com/comment/36291489
has title: Null pointer exception on button send
upvote count: 1
has comment: http://stackoverflow.com/comment/36294575
has body: Please find below the main class package com.example.myfirstapp; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; public void addListenerOnSpinnerItemSelection() { spinner = (Spinner) findViewById(R.id.spinner); spinner.setOnItemSelectedListener(new MyOnItemSelectedListener()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } Button buttonSend; EditText textTo; EditText textSubject; EditText textMessageContact; EditText textMessageEmail; EditText textMessageAmount; Spinner spinner; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSta…
linked to: http://stackoverflow.com/q/218384
favorite count: 0
possible better answer: http://stackoverflow.com/a/23633380
has answer: http://stackoverflow.com/a/23632637
accepted answer: http://stackoverflow.com/a/23632637
has answer: http://stackoverflow.com/a/23633380
downvote count: 5
has comment: http://stackoverflow.com/comment/36287735
has comment: http://stackoverflow.com/comment/36287762
score: -4

http://stackoverflow.com/q/23674558
tagged with: parse-platform
type: UnansweredQuestion
has title: connection with the db (Parse)
has comment: http://stackoverflow.com/comment/36370656
has comment: http://stackoverflow.com/comment/36373186
tagged with: java
type: Question
answer count: 2
has body: At the moment I am experiencing problems with Parse database connection (I think), the thing I want to do is retrieve the information from the database and get it on the page. So far me was told is that I don't require to edit the information on the xml page and only the Java page. public class Clothing extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_clothing);//database connection Parse.initialize &lt;removed this due that the password of the db is&gt; ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("Products"); query.getInBackground("5nVfgKvqkM", new GetCallback&lt;ParseObject&gt;() { public void done(ParseObject object, ParseException e) { if (e == null) { Toast.makeText(getBaseContext(), "succes", 5000); // object will be your game score } else { Toast.makeText(getBaseContext(), e.toString(), 5000); // something went wrong } } }); } } Error log: 05-15 10:50:12.123: E/AndroidRuntime(19371): FATAL EXCEPTION: main 05-15 10:50:12.123: E/AndroidRuntime(19371): Process: nl.creationinc.swopp2, PID: 19371 05-15 10:50:12.123: E/AndroidRuntime(19371): java.lang.RuntimeException: Unable to start activity ComponentInfo {nl.creationinc.swopp2/nl.creationinc.swopp2.Clothing}: android.os.NetworkOnMainThreadException 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.ActivityThread.access$800(ActivityThread.java:156) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.os.Handler.dispatchMessage(Handler.java:102) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.os.Looper.loop(Looper.java:157) …
has answer: http://stackoverflow.com/a/23676470
score: 0
has answer: http://stackoverflow.com/a/23677282
tagged with: android

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/23772602
tags question: http://stackoverflow.com/q/23632169
tags question: http://stackoverflow.com/q/23744373
tag name: android-actionbar
tags question: http://stackoverflow.com/q/23708507

http://stackoverflow.com/q/23650220
has comment: http://stackoverflow.com/comment/36324144
has answer: http://stackoverflow.com/a/23650348
accepted answer: http://stackoverflow.com/a/23650692
has title: Java - Stuck after instantiating an object
has body: I have a class, that needs to generate from time to time, a key and share it with a client and a server. Kdc Class: protected Kdc() { (do stuff) runKdc(); } private void runKdc(){ for(;;){ generateKey(); informClients(); informServers(); try { Thread.sleep(generationTime); } catch (InterruptedException e) { System.out.println("Sleep Interrupted"); } } } Main class: public static void main(String[] args) { Kdc kdc = new Kdc(); System.out.println("done"); //Doesn't reach the line } Now my problem is that i need to do something after starting the Kdc class and i can't! Because of the infinite loop, it just gets stuck in the Main class, after starting the Kdc class. Any ideas? Thank you.
possible better answer: http://stackoverflow.com/a/23650348
tagged with: instance
score: 1
tagged with: process
has comment: http://stackoverflow.com/comment/36322805
upvote count: 1
tagged with: loops
has comment: http://stackoverflow.com/comment/36322936
has comment: http://stackoverflow.com/comment/36322780
has comment: http://stackoverflow.com/comment/36322885
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23650399
has comment: http://stackoverflow.com/comment/36322851
has answer: http://stackoverflow.com/a/23650692
type: Question
has comment: http://stackoverflow.com/comment/36323190
has comment: http://stackoverflow.com/comment/36322809
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36471774
has text: Because resultPane doesn't have method called getResultText(), look about the brackets and level in your code. Now getResultText() is in calculatorpane class
comment on: http://stackoverflow.com/a/23727693
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23682009
answer count: 0
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/36387030
type: Question
tagged with: stored-procedures
has body: I am getting java.sql.SQLException: Missing IN or OUT parameter at index:: 2 error when trying to access a stored proc(created in oracle) which is having client name (varchar) as input param &amp; cursor as output param. The error is coming when i test it thru a JSP page but when I tested the stroed proc thru a Junit i am not getting the error. So I am quite confused. Please find below my stored proc &amp; also the DAOImpl class which is having the call. I can see that the JSP page is properly passing the name from a input text box to the name input param of stored proc. PROCEDURE sp_get_client_details_by_name ( p_client_name IN ncr.ncr_parties.full_legal_name%TYPE, p_result_set OUT SYS_REFCURSOR) AS BEGIN OPEN p_result_set FOR SELECT np.newedge_party_id AS client_id, np.full_legal_name AS client_name, np.city, nc.name residence_country_name, np.life_cycle_status AS status, ec_addr.addr2 AS client_address1, ec_addr.title_dist_compl AS client_address2, ec_addr.zip AS client_address3, ec_addr.state AS client_address4, ec_addr.title_compl AS client_address_tc, ec_addr.locality_compl AS client_address_lc, le.newedge_legal_entity_id AS legal_entity_id, le.full_legal_name AS legal_entity_name, le_addr.addr2 AS legal_entity_address1, le_addr.title_dist_compl AS legal_entity_address2, le_addr.zip AS legal_entity_address3, le_addr.state AS legal_entity_address4, le_addr.title_compl AS legal_entity_address_tc, le_addr.locality_compl AS legal_entity_address_lc FROM ncr.ncr_parties np JOIN ncr_legal_entities le ON np.legal_entity_key = le.legal_entity_key JOIN ncrglobalcountryview_vw nc ON nc.country_alias_key = np.residence_country_aliases_key JOIN ncr_cpty_addresses ec_addr ON ec_addr.cpty_key = np.party_key AND ec_addr.cpty_level = 'P' AND ec_addr.addr_type_key = 1 JOIN ncr_cpty_addresses le_addr ON le_addr.cpty_key = le.legal_entity_key AND le_addr.cpty_level = 'LE' AND le_addr.addr_type_key = 1 WHERE np.full_legal_name LIKE '%' || p_client_name || '%'; EXCEPTION WHEN OTHER…
has title: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/xhtml
has comment: http://stackoverflow.com/comment/36388868
tagged with: jsf-2
score: 0
has comment: http://stackoverflow.com/comment/36409940
type: UnansweredQuestion

http://stackoverflow.com/a/23724389
upvote count: 2
has body: Your configuration isn't shared between spring-security.xml and dispatcher-servlet.xml. This means that your declaration of &lt;context:component-scan&gt; in dispatcher-servlet.xml is not applied to beans declared in spring-security.xml, including your CustomUserDetailsService bean. Adding the following to the spring-security.xml should make the auto-wiring work: &lt;context:annotation-config/&gt; &lt;context:component-scan base-package="pl.javazaur" /&gt;
has comment: http://stackoverflow.com/comment/36467338
score: 2
has comment: http://stackoverflow.com/comment/36465892
accepted answer of: http://stackoverflow.com/q/23723469
has comment: http://stackoverflow.com/comment/36465201
has comment: http://stackoverflow.com/comment/36465674
answers question: http://stackoverflow.com/q/23723469
has comment: http://stackoverflow.com/comment/36467166
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36465483
has comment: http://stackoverflow.com/comment/36465932
type: Answer
has comment: http://stackoverflow.com/comment/36465609

http://stackoverflow.com/q/23702348
tagged with: extjs4.1
type: Question
tagged with: struts
has comment: http://stackoverflow.com/comment/36423212
score: 0
tagged with: file-upload
has comment: http://stackoverflow.com/comment/36442461
type: UnansweredQuestion
has body: i am trying to upload a file to server through extjs. I am using struts and java. The path from which i need to upload the file will be constant. so there will be no need for a file chooser. the code i have written is like this var file="c://folder/file.txt"; Ext.Ajax.request({ url: fileupload.action, params:{ fileName:file } }); Can anyone help me figure out what is wrong with this?
has comment: http://stackoverflow.com/comment/36469428
has title: Uploading a file using extjs
answer count: 0
tagged with: java

http://stackoverflow.com/q/23670062
tagged with: java
has comment: http://stackoverflow.com/comment/36361611
score: -1
has body: I am familiar with using parentheses, as in myMethod(myParameter), in Java and other programming languages, but what do the lesser than &lt; and greater than &gt; signs mean when they are used together in a array name? Is there a special name for them? Sorry if this is a duplicate, but I don't know how to search for this. Clarification: I wasn't referring to the role of any specific type inside the symbols, but rather the usage of the &lt;&gt; symbols themselves.
has comment: http://stackoverflow.com/comment/36361515
answer count: 1
has title: What do the paired "<" and ">" symbols mean in Java? (For example, ArrayList<String>)
has comment: http://stackoverflow.com/comment/36362289
has comment: http://stackoverflow.com/comment/36361653
accepted answer: http://stackoverflow.com/a/23670111
favorite count: 0
has comment: http://stackoverflow.com/comment/36361978
linked to: http://stackoverflow.com/q/3017253
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36361696
linked to: http://stackoverflow.com/q/490091
duplicate of: http://stackoverflow.com/q/3017253
upvote count: 2
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/23670111

http://stackoverflow.com/q/23622915
has body: I have a working Java SWING-based desktop application, and I'm being asked if it can be run on the Microsoft Surface Pro or Pro 2. As I understand it, these are using stock Windows 8/8.1 and will be able to run any Windows app normally, is this correct? Are there any caveats or special considerations when running my app on these devices? Edit: If it matters, the JRE would be distributed together with the application, so installing Java isnt an issue.
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: windows-8
has answer: http://stackoverflow.com/a/23625379
has title: Developing Java desktop applications on Microsoft Surface Pro/Pro 2
upvote count: 3

user-interface
tags question: http://stackoverflow.com/q/23720048
tags question: http://stackoverflow.com/q/23619700
tags question: http://stackoverflow.com/q/23698433
tags question: http://stackoverflow.com/q/23642449
tags question: http://stackoverflow.com/q/23686177
tags question: http://stackoverflow.com/q/23715048
tags question: http://stackoverflow.com/q/23696308
tags question: http://stackoverflow.com/q/23638291
tags question: http://stackoverflow.com/q/23727379
tags question: http://stackoverflow.com/q/23746085
tags question: http://stackoverflow.com/q/23770178
tags question: http://stackoverflow.com/q/23696210
tags question: http://stackoverflow.com/q/23766770
tags question: http://stackoverflow.com/q/23715241
tags question: http://stackoverflow.com/q/23723855
tags question: http://stackoverflow.com/q/23706779
type: Tag
tags question: http://stackoverflow.com/q/23768872
tags question: http://stackoverflow.com/q/23759936
tags question: http://stackoverflow.com/q/23627894
tags question: http://stackoverflow.com/q/23706492
tags question: http://stackoverflow.com/q/23673925
tags question: http://stackoverflow.com/q/23685900
tags question: http://stackoverflow.com/q/23739578
tags question: http://stackoverflow.com/q/23699936
tags question: http://stackoverflow.com/q/23765527
tags question: http://stackoverflow.com/q/23767763
tags question: http://stackoverflow.com/q/23721908
tags question: http://stackoverflow.com/q/23619552
tags question: http://stackoverflow.com/q/23711379
tags question: http://stackoverflow.com/q/23705654
tags question: http://stackoverflow.com/q/23712742
tags question: http://stackoverflow.com/q/23618560
tags question: http://stackoverflow.com/q/23751314
tags question: http://stackoverflow.com/q/23748821
tags question: http://stackoverflow.com/q/23725681
tags question: http://stackoverflow.com/q/23746424
tags question: http://stackoverflow.com/q/23728920
tags question: http://stackoverflow.com/q/23620985
tags question: http://stackoverflow.com/q/23619540
tags question: http://stackoverflow.com/q/23740515
tags question: http://stackoverflow.com/q/23699949
tags question: http://stackoverflow.com/q/23620548
tags question: http://stackoverflow.com/q/23695210
tags question: http://stackoverflow.com/q/23616037
tags question: http://stackoverflow.com/q/23727659
tags question: http://stackoverflow.com/q/23768368
tags question: http://stackoverflow.com/q/23721329
tags question: http://stackoverflow.com/q/23628320
tags question: http://stackoverflow.com/q/23714572
tags question: http://stackoverflow.com/q/23631228
tags question: http://stackoverflow.com/q/23692205
tags question: http://stackoverflow.com/q/23722040
tags question: http://stackoverflow.com/q/23690262
tags question: http://stackoverflow.com/q/23726935
tags question: http://stackoverflow.com/q/23745537
tags question: http://stackoverflow.com/q/23635598
tags question: http://stackoverflow.com/q/23725835
tags question: http://stackoverflow.com/q/23658104
tags question: http://stackoverflow.com/q/23619422
tags question: http://stackoverflow.com/q/23702274
tag name: user-interface
tags question: http://stackoverflow.com/q/23619744
tags question: http://stackoverflow.com/q/23763344
tags question: http://stackoverflow.com/q/23726416
tags question: http://stackoverflow.com/q/23764977
tags question: http://stackoverflow.com/q/23769632
tags question: http://stackoverflow.com/q/23652558
tags question: http://stackoverflow.com/q/23767136
tags question: http://stackoverflow.com/q/23674363
tags question: http://stackoverflow.com/q/23763637
tags question: http://stackoverflow.com/q/23713320

http://stackoverflow.com/a/23709328
type: Answer
accepted answer of: http://stackoverflow.com/q/23709303
has comment: http://stackoverflow.com/comment/36436441
has body: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.rssfeed.MyListFragment" on path: /data/app/com.example.com.example.android.rssfeed-1.apk Change this class="com.example.android.rssfeed.MyListFragment" to class="com.example.com.example.android.rssfeed.MyListFragment" cause the packagename is package com.example.com.example.android.rssfeed. Similarly class="com.example.com.example.android.rssfeed.DetailFragment" if the package name is the same Change this &lt;button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Press to Update"&gt; To &lt;Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Press to Update" /&gt;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36436423
has comment: http://stackoverflow.com/comment/36436336
score: 0
has comment: http://stackoverflow.com/comment/36436478
has comment: http://stackoverflow.com/comment/36436315
answers question: http://stackoverflow.com/q/23709303

http://stackoverflow.com/q/23764770
has comment: http://stackoverflow.com/comment/36541912
type: Question
has comment: http://stackoverflow.com/comment/36541944
has answer: http://stackoverflow.com/a/23764861
has body: The lines should go top right corner, where (a,0) is. I couldn't work it out. I'm using Eclipse 3.65. public class Ikibin extends JFrame{ int a = 400; int b = 600; public Ikibin() { setTitle("Tutorial"); setSize(a,b); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void paint(Graphics g) { g.setColor(Color.blue); g.drawLine(0, 0, 0, b); g.drawLine(a/4, 0, a/4, b); g.drawLine(a/2, 0, a/2, b); g.drawLine(3*a/4, 0, 3*a/4, b); g.drawLine(0, 0, a, 0); g.drawLine(0, b/4, a, 0); g.drawLine(0, b/2, a, 0); g.drawLine(0, 3*b/4, a, 0); } public static void main (String [] args) { Ikibin i = new Ikibin(); } }
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36543420
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12107163
has title: My lines don't go where they are supposed to go
upvote count: 1
tagged with: swing
tagged with: graphics
duplicate of: http://stackoverflow.com/q/12107163
tagged with: java

http://stackoverflow.com/q/23748857
has comment: http://stackoverflow.com/comment/36512365
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/383947
type: Question
linked to: http://stackoverflow.com/q/5495383
has comment: http://stackoverflow.com/comment/36512028
upvote count: 0
has title: Incompatability List <> using generic in java
has body: I have the following code in JAVA : List &lt;? extends Number &gt; l3=new List&lt;Number&gt;() ; // List not allowed ? why . and why arrayList is allowed here Integer i=new Integer(5); l3.add(i); // why we can not add i to l3 . //------------- another thing : List &lt;?&gt; variablex; variablex.add(new Integer(5) ); // error ? so why ? I am wondered why I have these errors at compile time ?
has answer: http://stackoverflow.com/a/23748884
answer count: 2
linked to: http://stackoverflow.com/q/6810691
tagged with: generics
has answer: http://stackoverflow.com/a/23748866
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: oop

http://stackoverflow.com/comment/36484325
has text: Of course, it's early morning and i still didn't have my coffee. Can't believe how long it took me thinking about that one.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23734538
type: AnswerComment

http://stackoverflow.com/a/23687291
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23678766
has body: If you have the time on your event-nodes, you can put them in a time tree, see here: In the Java API you can use legacy indexes for the nodes or relationships, indexing the timestamp as an numeric value and then use a lucene range query. It looks something like this: Index&lt;Node&gt; timeIndex = db.index().forNodes("time"); timeIndex.add(node,"timestamp",ValueContext.indexNumeric(node.getProperty("timestamp")); timeIndex.query(QueryContext.numericRange("timestamp",from,to)); See the QueryContext API

http://stackoverflow.com/a/23634901
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: It is pretty easy. do something like this, important is only to extend WebSecurityConfigurerAdapter @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/*").hasRole("ROLE_ANONYMOUS") } }
accepted answer of: http://stackoverflow.com/q/23634163
answers question: http://stackoverflow.com/q/23634163

http://stackoverflow.com/q/23630553
answer count: 1
has body: Is there a way Smooks could generate a CSV file based on a java instance? I am looking for something like: public static void main(String[] args){ Employee emp = new Employee(); emp.setName("abc"); emp.setSalary(12312); /* set other emp fields */ smooks.filterSource(.....); } CSV Output: "abc","12312", ............. Thanks!
has title: Java to CSV with Smooks
tagged with: java
has answer: http://stackoverflow.com/a/23630878
type: UnansweredQuestion
type: Question
tagged with: http://stackoverflow.com/tag/csv
tagged with: smooks
score: 0

http://stackoverflow.com/comment/36520279
has text: Try refering to it as ActivityName.this.alertDialogue.dismiss(); Once you have an object created, there is no reason(I think) for the Alert Dialog object to not to have cancel() or hide() accessible. The only reason I can think of is, may be you are refering to some other object. Make sure you are refering to the same object from onProviderEnabled() call back And from switchToGPSPreferences()
comment on: http://stackoverflow.com/q/23753298
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23633142
tagged with: parse-platform
type: UnansweredQuestion
type: Question
tagged with: java
has body: I am developing a social application using parse. I have following data models for parse.com User name (String) email (String) ... Post tittle (String) description (String) User (Pointer) Like (Pointer) Comment (Pointer) LikeCount (Number) Comment Count (Number) Like User (Pointer) Post (Pointer) Comments text (String) User (Pointer) Post (Pointer) Now when I fetch posts I also want to fetch additional information which is If current user liked this post? If current user commented on this post? I am wondering If I can get all these info in one network call. I don't want to perform multiple network calls for each post.
has title: Query Parse to get state of object
score: 0
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23633395

http://stackoverflow.com/comment/36499158
type: AnswerComment
type: Comment
has text: @user3580294 No version of `javac` that I am aware of performs the optimization above without an explicit `final` modifier on both variables. But I'm not aware of any restrictions that would prevent future versions from applying the same optimization to "effectively final" variables, nor do I know whether eclipse or other compilers perform such an optimization.
comment on: http://stackoverflow.com/a/23741728
score: 0

http://stackoverflow.com/q/23658550
has title: Sort and display array
favorite count: 0
has answer: http://stackoverflow.com/a/23658603
score: 0
downvote count: 1
duplicate of: http://stackoverflow.com/q/409784
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36339122
linked to: http://stackoverflow.com/q/7060016
type: Question
has answer: http://stackoverflow.com/a/23658582
accepted answer: http://stackoverflow.com/a/23658582
tagged with: java
linked to: http://stackoverflow.com/q/409784
has body: How many elements do you want in the array? 3 Enter an integer to store in the array 66 enter an integer to store in the array 33 enter an integer to store in the array 99 Here are the sorted values: [33,66,99] This should be the result. This is what I made: import java.util.Scanner; public class PracTe3Te { /** * @param args */ public static void main(String[] args) { int [] a; int size; int value; Scanner sc; sc = new Scanner(System.in); System.out.println("How many elements do you want in the array? "); size = sc.nextInt(); a = new int [size]; System.out.println("the size of array is " + a.length); for (int i = 0; i &lt; a.length; i++) { System.out.println("Enter an integer to store in the array"); value = sc.nextInt(); a[i] = value; int newNum = value; if (value &lt; a.length - 1) { //otherwise array is already full a[value] = value; newNum = newNum + 1; } } System.out.print(a); } } and get this result: How many elements do you want in the array? 3 the size of array is 3 Enter an integer to store in the array 4 Enter an integer to store in the array 3 Enter an integer to store in the array 5 [I@60072ffb How can I print the array list of entered items not like [I@60072ffb?
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36339341
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23658603

http://stackoverflow.com/comment/36325352
has text: I already can save you a bunch of time I know a good java source code that does this and it's as simple as possible too. I'll post it as a answer. It's 5 Java files.
score: 0
comment on: http://stackoverflow.com/q/23651074
type: Comment
type: QuestionComment

http://stackoverflow.com/a/62311521
answers question: http://stackoverflow.com/q/23650854
score: 0
has body: The program is not able to compile because there are undeclared exception, which is a FileNotFoundException. In order for the program to work without crashing, that exception must be caught or declared to be thrown.
type: Answer

http://stackoverflow.com/q/23666168
has comment: http://stackoverflow.com/comment/36365581
favorite count: 0
has comment: http://stackoverflow.com/comment/36354711
tagged with: python
has comment: http://stackoverflow.com/comment/36354404
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36354522
score: 1
tagged with: java
has title: How can I tell python to use 64bit java?
tagged with: 64-bit
upvote count: 1
has comment: http://stackoverflow.com/comment/36354614
has comment: http://stackoverflow.com/comment/36354712
has comment: http://stackoverflow.com/comment/36354880
type: Question
has comment: http://stackoverflow.com/comment/36354657
has answer: http://stackoverflow.com/a/23666535
has comment: http://stackoverflow.com/comment/36354457
accepted answer: http://stackoverflow.com/a/23666535
tagged with: 32-bit
has comment: http://stackoverflow.com/comment/36354580
has body: In windows command line, if I type java -version, I get java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) and python -v #snip Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 In python if use call("java -version") I get java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b17) Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing) Is there a way I can force my python to use the 64bit JVM?
has comment: http://stackoverflow.com/comment/36354759
has comment: http://stackoverflow.com/comment/36354822
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36354816

http://stackoverflow.com/q/23752503
favorite count: 0
upvote count: 2
tagged with: authentication
downvote count: 1
type: AnsweredQuestion
has title: RuntimeException: Unable to instantiate activity componentInfo
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36518592
has answer: http://stackoverflow.com/a/23752813
type: Question
has comment: http://stackoverflow.com/comment/36518960
tagged with: runtimeexception
accepted answer: http://stackoverflow.com/a/23752813
has body: Good day! I'm trying to solve this problem for a week now that was not present before (That means to say that the program was working before). Problem: My Login form's GUI won't load anymore. Given: (LoginScreen Class-View) public class LoginScreen extends Activity implements JPacketListener { private EditText editTextUsername; private EditText editTextPassword; private Button btnSubmit; private boolean isReady = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_screen); loadUIReferences(); } @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(1,1,1,"Change IP Connection"); return super.onCreateOptionsMenu(menu); } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (item.getTitle() == "Change IP Connection") { Intent intent = new Intent(LoginScreen.this,ChangeIp.class); startActivity(intent); } return super.onMenuItemSelected(featureId, item); } private void loadUIReferences() { editTextUsername = (EditText) this.findViewById(R.id.editTextUsername); editTextPassword = (EditText) this.findViewById(R.id.editTextPassword); btnSubmit = (Button) this.findViewById(R.id.btnSubmit); btnSubmit.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!isReady) { return true; } Toast.makeText(LoginScreen.this, "Loading...",Toast.LENGTH_SHORT).show(); isReady = false; try { Builder tpol = new ThreadPolicy.Builder().permitAll(); StrictMode.setThreadPolicy(tpol.build()); Toast.makeText(LoginScreen.this, "Connecting To Server...",Toast.LENGTH_LONG).show(); JTCPConnectionClient client = new JTCPConnectionClient(Settings.IP, Settings.PORT); client.addListener(LoginScreen.this); client.send("Parameter too long, checkers, don't mind this"); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } }); } @Override…
has comment: http://stackoverflow.com/comment/36519144
has comment: http://stackoverflow.com/comment/36519691
tagged with: android
answer count: 1

http://stackoverflow.com/comment/36478492
has text: Its a local variable that will garbage collected automatically. How many maximum values can be selected? Is the number in millions?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23730666
type: AnswerComment

http://stackoverflow.com/a/23775634
has comment: http://stackoverflow.com/comment/36562929
score: 0
has body: Because there is no constructor of A that takes a String(also string name should be String name) as parameter. To correct it: public class A{ String name; public A(){ this("My Name"); } public A(String name){ this.name = name; } } Also, your program does not compile, public class A(){} is invalid.
type: Answer
answers question: http://stackoverflow.com/q/23775610

http://stackoverflow.com/q/23711607
has comment: http://stackoverflow.com/comment/36447652
has body: As I say in the question title, I'm trying to populate my Home Activity action bar spinner with items from my mysql database... I'm callyng my private GetFeeds Class (AsyncTask extended class) to get what I want from database in the onCreate method from the activity.. and I'm getting the results correctly, but then the app stops and closes, I can't even see the activity in the phone... my HomeActivity: public class HomeActivity extends ActionBarActivity implements ActionBar.OnNavigationListener { InternetConnectivityManager icm; ProgressDialog pDialog; BDFunctions bdfunctions; String[] feeds; /** * The serialization (saved instance state) Bundle key representing the * current dropdown position. */ private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // Set up the action bar to show a dropdown list. final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); icm = new InternetConnectivityManager(getApplicationContext()); new GetFeeds().execute(); // 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, feeds), this); } private class GetFeeds extends AsyncTask&lt;Void, Void, JSONObject&gt; { @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pDialog = new ProgressDialog(HomeActivity.this); pDialog.setMessage("A vrificar os grupos onde estas inserido..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } protected JSONObject doInBackground(Void... arg0) { bdfunctions = new BDFunctions(getApplicationContext()); J…
tagged with: java
has title: Android: Populate action bar spinner from Mysql
type: Question
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23717724
accepted answer: http://stackoverflow.com/a/23717724
has comment: http://stackoverflow.com/comment/36451001
type: AnsweredQuestion

http://stackoverflow.com/comment/36496321
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23740723
has text: My guess is that you are mixing the support and non-support versions of `ActionBar.Tab` and `FragmentTransaction`. Make sure that all your imports reference either the versions of these in the support library or the ones outside the support library.
score: 4

http://stackoverflow.com/comment/36308177
comment on: http://stackoverflow.com/q/23642248
has text: Yes, what @SotiriosDelimanolis said. You've shown a degenerate case where the type *could* be inferred. In any non-degenerate case, there'd be no way to infer the type.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36558065
comment on: http://stackoverflow.com/q/23750594
score: 0
type: Comment
type: QuestionComment
has text: I'm 100% sure that the problem is not file association since webstart already seem to be handling file association well, but okay I'll try that too.

http://stackoverflow.com/comment/36275909
comment on: http://stackoverflow.com/q/23625921
score: 0
type: Comment
type: QuestionComment
has text: where is the `resources` folder in your project?

list
type: Tag
tags question: http://stackoverflow.com/q/23621997
tags question: http://stackoverflow.com/q/23756862
tags question: http://stackoverflow.com/q/23708308
tags question: http://stackoverflow.com/q/23617190
tags question: http://stackoverflow.com/q/23696611
tags question: http://stackoverflow.com/q/23660702
tags question: http://stackoverflow.com/q/23750542
tags question: http://stackoverflow.com/q/23718798
tags question: http://stackoverflow.com/q/23641950
tags question: http://stackoverflow.com/q/23723613
tag name: list
tags question: http://stackoverflow.com/q/23662533
tags question: http://stackoverflow.com/q/23679642
tags question: http://stackoverflow.com/q/23630710
tags question: http://stackoverflow.com/q/23630495
tags question: http://stackoverflow.com/q/23622008
tags question: http://stackoverflow.com/q/23732542
tags question: http://stackoverflow.com/q/23681277
tags question: http://stackoverflow.com/q/23713350
tags question: http://stackoverflow.com/q/23719303
tags question: http://stackoverflow.com/q/23677301
tags question: http://stackoverflow.com/q/23724484
tags question: http://stackoverflow.com/q/23761524
tags question: http://stackoverflow.com/q/23728087
tags question: http://stackoverflow.com/q/23717480
tags question: http://stackoverflow.com/q/23722173
tags question: http://stackoverflow.com/q/23659645

http://stackoverflow.com/a/23693729
has comment: http://stackoverflow.com/comment/36452912
has comment: http://stackoverflow.com/comment/36453861
answers question: http://stackoverflow.com/q/23693653
type: Answer
score: 0
has body: Try with Widget#removeFromParent() that removes this widget from its parent widget, if one exists. Use AwardOverview.removeFromParent(); instead of rootPanel.remove(AwardOverview); OR try with Panel#clear() that removes all child widgets. RootPanel.get().clear();' OR try with RootPanel#clear(boolean) that clears the rootPanel. If clearDom is true, then also remove any DOM elements that are not widgets. Note: Respect Java Naming Convention.
has comment: http://stackoverflow.com/comment/36428056
has comment: http://stackoverflow.com/comment/36471622
has comment: http://stackoverflow.com/comment/36471784

http://stackoverflow.com/comment/101462080
type: QuestionComment
has text: Hi @Chrispie - unfortunately not. My suggestion, which @jason-alexander pretty much reiterated, seems to be the best approach. If you can manage your machines with good config management tools (puppet, ansible, etc) then you probably can get away with consistently/reliably setting ENV vars on the OS user or modifying the `setDomainEnv` file with the necessarily variables. Unfortunately it's not coupling the config with the weblogic config itself, which is what I was shooting for, but I could not find a better way.
comment on: http://stackoverflow.com/q/23620163
score: 0
type: Comment

http://stackoverflow.com/comment/36594983
score: 1
comment on: http://stackoverflow.com/q/23775266
has text: If you check the example in the answer, you will see that I use Color(int, boolean) which gives me a Color object, from here you can use Color#getRed/Green/Blue to get the individual color components
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23709385
accepted answer: http://stackoverflow.com/a/23709588
score: 0
tagged with: java
has title: Java Android - Dynamic load fragment (ViewPager)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23709588
has answer: http://stackoverflow.com/a/23709563
has body: In settngs existed checkbox, if it is checked, then a specific fragment must not be loaded. I have just 4 fragment and I use FragmentStatePagerAdapter to show them. public class TabPagerAdapter extends FragmentStatePagerAdapter { public TabPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { switch (i) { case 0: return new Fragment_One(); case 1: return new Fragment_Two(); case 2: return new Fragment_Three(); case 3: return new Fragment_Four(); } return null; } @Override public int getCount() { return 4; } } As show fragments, which are not only check in the settings? I get value (true of false (Check or Uncheck) fragment, but how do not show this fragment, i dont know.
type: Question
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/23709563
tagged with: android-fragments

http://stackoverflow.com/comment/36510512
type: QuestionComment
has text: @hexafraction I think that `"}"` is a typo, as if it really were a `String` I don't think that fragment would compile
comment on: http://stackoverflow.com/q/23748242
score: 0
type: Comment

dreamweaver
type: Tag
tag name: dreamweaver
tags question: http://stackoverflow.com/q/23626320

http://stackoverflow.com/a/48490088
answers question: http://stackoverflow.com/q/23744216
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/123446404
type: Answer
has body: Thanks, Miguel! Your example helped a lot. I didn't want to use the 'JSON-java' library. I prefer GSON. But it wasn't hard to translate the logic from JSON-java over to GSON's domain model. A single function can do the trick: /** * Wraps the object returned by the Snake YAML parser into a GSON JsonElement * representation. This is similar to the logic in the wrap() function of: * * https://github.com/stleary/JSON-java/blob/master/JSONObject.java */ public static JsonElement wrapSnakeObject(Object o) { //NULL =&gt; JsonNull if (o == null) return JsonNull.INSTANCE; // Collection =&gt; JsonArray if (o instanceof Collection) { JsonArray array = new JsonArray(); for (Object childObj : (Collection&lt;?&gt;)o) array.add(wrapSnakeObject(childObj)); return array; } // Array =&gt; JsonArray if (o.getClass().isArray()) { JsonArray array = new JsonArray(); int length = Array.getLength(array); for (int i=0; i&lt;length; i++) array.add(wrapSnakeObject(Array.get(array, i))); return array; } // Map =&gt; JsonObject if (o instanceof Map) { Map&lt;?, ?&gt; map = (Map&lt;?, ?&gt;)o; JsonObject jsonObject = new JsonObject(); for (final Map.Entry&lt;?, ?&gt; entry : map.entrySet()) { final String name = String.valueOf(entry.getKey()); final Object value = entry.getValue(); jsonObject.add(name, wrapSnakeObject(value)); } return jsonObject; } // everything else =&gt; JsonPrimitive if (o instanceof String) return new JsonPrimitive((String)o); if (o instanceof Number) return new JsonPrimitive((Number)o); if (o instanceof Character) return new JsonPrimitive((Character)o); if (o instanceof Boolean) return new JsonPrimitive((Boolean)o); // otherwise.. string is a good guess return new JsonPrimitive(String.valueOf(o)); } Then you can parse a JsonElement from a YAML String with: Yaml yaml = new Yaml(); Map&lt;String, Object&gt; yamlMap = yaml.load(yamlString); JsonElement jsonElem = wrapSnakeObject(yamlMap); and print it out with: Gson gson = new GsonBuilder().setPrettyPrinting().create(); Syste…

http://stackoverflow.com/q/23627600
linked to: http://stackoverflow.com/q/1008802
has answer: http://stackoverflow.com/a/23627750
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36703675
accepted answer: http://stackoverflow.com/a/23635321
linked to: http://stackoverflow.com/q/573184
tagged with: java
type: Question
has body: Is there any method in Spring Framework for converting a string to its URL representation? For example from Majstrovstvá v ľadovom hokeji to majstrovstva-v-ladovom-hokeji.
score: 0
answer count: 2
has title: Convert string to its URL representation in Spring Framework
has answer: http://stackoverflow.com/a/23635321
has comment: http://stackoverflow.com/comment/36278753
possible better answer: http://stackoverflow.com/a/23627750

http://stackoverflow.com/comment/36569856
type: AnswerComment
comment on: http://stackoverflow.com/a/23778098
type: Comment
score: 1
has text: @user3659013 When someone helps you, you can say "thank you" and mark his answer as the solution. That's the principle of this site.

http://stackoverflow.com/q/23628742
type: Question
tagged with: encode
tagged with: couchbase
tagged with: java
upvote count: 1
has body: I have 2 services: A service that writes to couchbase db using incr operation. A service that reads the written record. I'm writing the second one in java and would like to use a pre-made decoder called LongTranscoder (net.spy.memcached.transcoders.LongTranscoder): LongTranscoder lt = new LongTranscoder(); long result = couchbaseClient.get(myKey, lt); My app is a multithreaded app and I would like to know if LongTranscoder is thread safe (meaning I can use a single static instance for all of my queries) or should I create an instance for each db query? Looking at the implementation of LongTranscoder and TranscoderUtils it seems that there are no shared objects that can impose problems for multithreaded code, but I would like to be certain. I'll be glad to get an extra point of view.
tagged with: decode
answer count: 0
has title: Couchbase transcoders thread safe
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: transcode
favorite count: 0

http://stackoverflow.com/comment/36476630
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23730204
has text: http://viralpatel.net/blogs/hibernate-one-to-many-xml-mapping-tutorial/
type: Comment

http://stackoverflow.com/comment/36428606
type: Comment
has text: @ZouZou Updated problem with line reference.
type: QuestionComment
comment on: http://stackoverflow.com/q/23705106
score: 0

http://stackoverflow.com/comment/36397420
comment on: http://stackoverflow.com/q/23688362
score: 0
has text: In your request, is the parameter as part of the URL or part of the request body which is `application/x-www-form-url-encoded`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36549584
score: 0
type: Comment
has text: @user3580294 Yes, my issue was caused by a `static int[]` array.
type: QuestionComment
comment on: http://stackoverflow.com/q/23768270

http://stackoverflow.com/a/23709892
upvote count: 1
has body: I can try to answer item 1; The docs is a little unprecise, and I think the intention is to say that the image has IndexColorModel and no discrete alpha channel. I.e.: There's just a single channel with indices in the color map. That is not in contradiction to the fact that the colors in the IndexColorModel themselves may be (semi-) transparent. This explanation fits with my experience, but of course, I didn't write the API or the docs... ;-) Item 2 looks a little strange. The error is very small +/- 1, so it's probably no big deal in practice (invisible to most peoples eyes). Complete speculation, but I would guess that there's some kind of optimized loops being used, that sacrifices some accuracy for speed. Have you tried using setRGB()/getRGB() to see if that gives different results?
answers question: http://stackoverflow.com/q/23707736
downvote count: 0
has comment: http://stackoverflow.com/comment/36439741
type: Answer
score: 1

http://stackoverflow.com/comment/36502460
type: AnswerComment
has text: this is not working. I want the jar to include javadoc and sources of all the projects dependence.(not only of my code)
comment on: http://stackoverflow.com/a/23741701
type: Comment
score: 0

http://stackoverflow.com/q/23668508
linked to: http://stackoverflow.com/q/5621338
has body: I'm trying to add an Image button to my GUI but all I get is a blank screen. Can anyone show me whats wrong with my code? This is what I have so far. package fallingStars; import java.awt.*; import java.awt.event.*; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class GUI extends JFrame { private JLabel label; private JButton button; private JPanel buttonPanel; public static void startButton() { ImageIcon start = new ImageIcon("Start.png"); JButton play = new JButton(start); play.setBounds(150,100,100,50); } public static void main(String args[]) { GUI gui = new GUI(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(300, 500); gui.setVisible(true); gui.setResizable(false); gui.setTitle("Falling Stars"); JPanel panel = new JPanel(); startButton(); } }
has comment: http://stackoverflow.com/comment/36358978
has comment: http://stackoverflow.com/comment/36359562
tagged with: image
has answer: http://stackoverflow.com/a/23669629
answer count: 2
tagged with: imageicon
has comment: http://stackoverflow.com/comment/36358932
has title: Using Images as Buttons, getting a Blank Screen
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21142686
tagged with: swing
tagged with: jbutton
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/36359684
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23668823
type: Question

http://stackoverflow.com/q/23762630
type: Question
tagged with: bind
tagged with: unboundid-ldap-sdk
tagged with: active-directory
score: 0
answer count: 1
tagged with: ldap
type: UnansweredQuestion
has body: I have a JAVA application that uses UnboundID LDAP SDK to connect and to authenticate to a LDAP local server. The server is a Windows Server 2008 R2 with Active Directory and It's configured to NOT allow anonymous authentication. But if i try to perform an anonymous bind using my application, the BindResult is resulting success. I'm connecting using SimpleBindRequest() method like JAVADOC says. Here is my code: public boolean autenticarAnonimamente() throws AutenticacaoExcecao { GerenciadorConexaoLdap gerenciadorLdap = new GerenciadorConexaoLdap(); LDAPConnection connection; try { connection = gerenciadorLdap.conectarServidorLdap(ldap); SimpleBindRequest request = new SimpleBindRequest(); BindResult result = connection.bind(request); boolean retorno = result.getResultCode().equals(ResultCode.SUCCESS); connection.close(); return retorno; } catch (LDAPException | GeneralSecurityException ex) { throw new AutenticacaoExcecao(ex); } } I tried to test my server using Google Apps Directory Sync and it's denying any anonymous bind. If i configure my server to allow anonymous connection, the Google application results OK. Anyone know what can be?
has title: Anonymous Bind using UnboundID LDAP sdk
has answer: http://stackoverflow.com/a/23776662
tagged with: java

http://stackoverflow.com/comment/36445736
type: Comment
type: QuestionComment
score: 0
has text: The getBlob() method of PreparedStatement.
comment on: http://stackoverflow.com/q/23714579

http://stackoverflow.com/q/23648241
has title: Can't access managed bean method using JSF
has comment: http://stackoverflow.com/comment/36319038
has comment: http://stackoverflow.com/comment/36319404
upvote count: 2
tagged with: jsf-2
linked to: http://stackoverflow.com/q/799280
answer count: 1
favorite count: 0
has body: Hi I'm trying to access and call a method inside a managed bean in my JSF page. Here is the relevant part of the JSF page: &lt;ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns="http://www.w3.org/1999/xhtml" template="./template.xhtml"&gt; &lt;ui:define name="right"&gt; &lt;c:forEach items="#{tweetManager.getTweets}" var="item"&gt; &lt;h:link value="#{item.username}" /&gt;&amp;nbsp; Likes: &amp;nbsp;&amp;nbsp;&lt;h:outputText value="#{item.likes}" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;h:link id="" value="like" /&gt;&amp;nbsp;&lt;br /&gt; &lt;textarea&gt; &lt;h:outputText value="#{item.text}" /&gt; &lt;/textarea&gt; &lt;/c:forEach&gt; &lt;/ui:define&gt; Here is the managed bean. @ManagedBean @RequestScoped public class TweetManager { private Tweet TweetEntity; private List&lt;Tweet&gt; Tweets; @EJB private TweetService TweetService; @PostConstruct public void init(){ TweetEntity = new Tweet(); } public void setTweet(Tweet tweetEntity){ this.TweetEntity = tweetEntity; } public Tweet getTweet(){ return this.TweetEntity; } public void Save(){ TweetService.create(TweetEntity); } public List&lt;Tweet&gt; getTweets(){ Query query = TweetService.getEntityManager().createNativeQuery("SELECT * FROM tweet"); Tweets = query.getResultList(); return Tweets; } } I'm getting an error saying: ... .TweetManager' does not have the property 'getTweets'.
score: 2
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36319123
type: Question
has answer: http://stackoverflow.com/a/23648472
accepted answer: http://stackoverflow.com/a/23648472
tagged with: ejb

http://stackoverflow.com/comment/36358052
score: 0
comment on: http://stackoverflow.com/q/23668095
type: Comment
has text: @DavidWallace, I want to know how I can get this method to read a file in order to count the words within the existing file.
type: QuestionComment

http://stackoverflow.com/a/23691555
type: Answer
accepted answer of: http://stackoverflow.com/q/23691464
score: 30
has comment: http://stackoverflow.com/comment/100418374
has body: You want: ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
answers question: http://stackoverflow.com/q/23691464
type: AcceptedAnswer
downvote count: 0
upvote count: 30

http://stackoverflow.com/comment/36332938
type: AnswerComment
score: 0
type: Comment
has text: Thanks @helderdarocha that's also a valuable tip! It worked with <p:commandButton> using that property.
comment on: http://stackoverflow.com/a/23617029

http://stackoverflow.com/q/23769169
tagged with: java
score: -1
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/36551022
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36550963
favorite count: 0
has comment: http://stackoverflow.com/comment/36551086
tagged with: graph-algorithm
has body: I have given an assignment where I have to escape a labyrinth. The goal is to find the shortest way. I have done some research and there seem to be two strategies to solve the problem: the Depth-first search and Breadth-first search, where the first starts at the root (Starting point in maze) and explores as far as possible along each branch before backtracking and the second begins at a root node and inspects all the neighboring nodes. Then for each of those neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so on. I have implemented both algorithms (non-recursive implementations) that will go on until they find the end: /** * A non-recursive implementation of DFS * @param maze */ void solveUsingDepthFirst(IMaze maze) { Stack&lt;IMazePosition&gt; candidates = new Stack&lt;IMazePosition&gt;(); //insert start position candidates.push(maze.getStartPosition()); IMazePosition currentPosition; IMazePosition nextPosition; while (!candidates.empty()) { currentPosition = candidates.pop(); if (maze.isMazeSolved(currentPosition)) break; //mark the current position maze.markPosition(currentPosition, maze.getPathMark()); // maze.printMaze(); // Check for possible ways to go nextPosition = currentPosition.north(); if (maze.canMove(nextPosition)) candidates.push(nextPosition); nextPosition = currentPosition.east(); if (maze.canMove(nextPosition)) candidates.push(nextPosition); nextPosition = currentPosition.south(); if (maze.canMove(nextPosition)) candidates.push(nextPosition); nextPosition = currentPosition.west(); if (maze.canMove(nextPosition)) candidates.push(nextPosition); } System.out.println(!candidates.empty() ? "Done" : "Sorry, could not do it"); maze.printMaze(); } /** * A non-recursive implementation of BFS * @param maze */ void solveUsingBreadthFirst(IMaze maze) { LinkedList&lt;IMazePosition&gt; candidates = new LinkedList&lt;IMazePosition&gt;(); //insert start position candidates.add(maze.getStartPosition()); IMazePosition currentPosit…
has title: Escaping the prison - finding the shortest way
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36551512
has comment: http://stackoverflow.com/comment/36551150
has comment: http://stackoverflow.com/comment/36551027
downvote count: 1
has answer: http://stackoverflow.com/a/23770414
has answer: http://stackoverflow.com/a/23770273
tagged with: algorithm

http://stackoverflow.com/a/24076821
answers question: http://stackoverflow.com/q/23695439
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23695439
has body: I'm not sure whether this is the final solution but I learned a few things and want to share this here: it matters that I tried to run the code within my plugin the plugin is written for an eclipse based application therefore the plugin contains an SWT-dependency (I realized that it seemes to be a conflict between swt and swing/awt if people had similar problems) I found this article https://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html and this example code how to implement swing GUI by using the SWT/AWT Bridge http://www.java2s.com/Tutorial/Java/0280__SWT/EmbededSwingAWTcomponentstoSWT.htm the example runs within my plugin without any problems and I will try to adapt my source code to use the SWT/AWT Bridge I'll keep on reading about this :-) Any comment/correction is very welcome (as I'm still a newbie to all this...)

http://stackoverflow.com/a/23755342
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: Take a look at the first line of the stack trace: at ProiectDealerAuto.SwingInterface.Button4ActionPerformed(SwingInterface.java:231) I assume line 231 is: ResultSet result = statement.executeQuery("SELECT * FROM cars"); where statement is still null. you need to initialize it first: statement = connection.createStatement();
answers question: http://stackoverflow.com/q/23755280

http://stackoverflow.com/comment/36378178
type: AnswerComment
type: Comment
has text: @CiMat Start with https://www.google.com/search?q="getgraphics+returns+null" ;-) You might provoke it, e.g. by resizing your window while the application is running. But in any case: You should not do it, because it may cause arbitrary, hard-to-debug problems (a `NullPointerException` being by far the easiest one here - you immediately know what's wrong, although not necessarily how to solve it, regardless of the effort that this might cause when you have to do it later...)
comment on: http://stackoverflow.com/a/23678655
score: 1

http://stackoverflow.com/q/23691001
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23691076
has title: When I compile this is what I get: unreported exception java.lang.NoSuchFieldException; must be caught or declared to be thrown
type: Question
accepted answer: http://stackoverflow.com/a/23691164
tagged with: runtime-error
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23691073
tagged with: string
has answer: http://stackoverflow.com/a/23691073
has body: I'm trying to create a chess program on the using the GridWorld case study. You may or may not know what that is, but that is irrelevant to my problem. I've only been coding in java for about a year now in my AP computer science class, so I'm relatively new at this. What I am trying to to is convert a string to a color. I have looked it up online and in numerous places I have found this code: Field field = Color.class.getField("YELLOW"); Color chosen = (Color)field.get(null); I would also like to use a variable instead of "YELLOW", so this is the code that I would like to use. Field field = Color.class.getField("chosenColor"); Color chosen = (Color)field.get(null); But it does not work, and I don't know why. The message that I get is the title of this question. I have no idea what it means, and quite honestly I'm not all familiar with the field class, so that could be the root of my issue, but I'm just not sure. I will post my code, and I hoping that you can either help me with this error, or give me another way to convert strings to colors. Like I said, I'm relatively new, so it would be great if you could use smaller words that my limited coding knowledge can understand. package framework.info.gridworld; import info.gridworld.actor.ActorWorld; import info.gridworld.actor.*; import info.gridworld.grid.*; import java.awt.Color; import java.util.*; import java.lang.reflect.Field; /** * Play a game of chess! Simple, yet oh so complicated. * * @author M.A.Williams * Version one. Started: 5-15-2014 Finished: N/A */ public class ChessRunner { public static void main(String[]args) { Scanner in= new Scanner(System.in); System.out.println("Pick from one of these colors! \nBlue \nCyan\nGreen\nMagenta\nOrange\nPink\nRed\nWhite\nYellow"); System.out.println("Do not choose Black!!!"); String chosenColor=in.next(); chosenColor=chosenColor.toUpperCase(); while(chosenColor.equals("BLACK")) { System.out.println("I told you not to choose Black! Choose a different color!"); chosenCol…
tagged with: colors
tagged with: field
has answer: http://stackoverflow.com/a/23691164

http://stackoverflow.com/a/23624510
has body: Your Swing-Code is executed in a single Thread, so is your actionPerformed()-Method. Just start a new Thread or create a runnable and start it with SwingUtils.invokeLater(): Example: javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { //do something } });
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23620233
score: 1

http://stackoverflow.com/a/23776479
score: -1
has body: Removing from the iterator is not the same as removing from the list the iterator is derived from. Iterated objects are detached.
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/36564425
answers question: http://stackoverflow.com/q/23776259

http://stackoverflow.com/q/23716474
has title: AST eclipse, trying to create an InfixExpression
tagged with: eclipse-plugin
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23724497
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23724497
score: 0
tagged with: abstract-syntax-tree
has body: I am working on an Eclipse code formatting plugin using the AST. I am trying to create an InfixExpression using this code: public static InfixExpression makeInfixExpression(final AST t, final ASTRewrite r, final InfixExpression.Operator o, final Expression left, final Expression right) { final InfixExpression $ = t.newInfixExpression(); $.setOperator(o); $.setRightOperand(right.getParent() == null ? right : (Expression) r.createMoveTarget(right)); $.setLeftOperand(left.getParent() == null ? left : (Expression) r.createMoveTarget(left)); return $; } with this command: makeInfixExpression(t, r, InfixExpression.Operator.PLUS, asgnThen.getRightHandSide(), otherAsgn) Declarations: final Assignment asgnThen, final Expression otherAsgn; But the InfixExpression I am getting back from this function is 0+0 instead of 3 + 4 according to the parameters I sent. after some debugging I saw that it gets messed up in the createMoveTarget part but if i replace it with just right and left it throw an exception.... I also noticed that if I use t.newNumberLiteral to create 2 new lietrals and define the to be the value of what asgnThen.getRightHandSide and otherAsgn is the function returns a proper InfixExpression but the problem is it doesnt have to be a NumberLiteral so I cant count on that. when the plugin lets me see the preview is shows "3 + " and no 0+0.... wierd stuff going on. Any suggestions? Thanks!
answer count: 1

http://stackoverflow.com/comment/36307119
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23625284
has text: It's fine to use cancel(), you just need to make sure that your task will actually respond to being interrupted: in other words, that it essentially spends all of its time in calls to methods that are defined as throwing InterruptedException, or that it periodically checks Thread.interrupted() http://docs.oracle.com/javase/7/docs/api/java/lang/InterruptedException.html

http://stackoverflow.com/comment/36371767
comment on: http://stackoverflow.com/q/23675490
type: Comment
type: QuestionComment
has text: You should archive the class file with the appropriate folder strcture into a jar and put that on your classpath instead of the raw file.
score: 0

http://stackoverflow.com/comment/36566829
comment on: http://stackoverflow.com/a/23777534
score: 0
type: AnswerComment
type: Comment
has text: @LuiggiMendoza I can't agree with you more, that some subtle problems can perhaps only be spotted at the bytecode level. I am all for bytecode reading, but what I am saying is that I personally will not indulge in it's pleasures unless I really need to or unless I am done checking out all the other cool stuff around (which will never happen :))

http://stackoverflow.com/q/23620270
type: AnsweredQuestion
has body: this is my code <%@page import="java.util.logging.Logger"%> <%@page import="java.util.logging.Level"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page isThreadSafe="false"%> <%! int k = 0;%> Concurrency <% for (int i = 0; i < 10; i++) { out.print(k + "->" + i + " "); k++; try { Thread.sleep(1000); } catch (InterruptedException ex) { } } %> I cannot understand why when I see the outcome on Tomcat ,i starts from 10. my outcome 10->0 11->1 12->2 13->3 14->4 15->5 16->6 17->7 18->8 19->9 Does JSP follow some rules than Core Java rules? I do not get it, why k waits till i reaches 10 and after that it starts printing?
has comment: http://stackoverflow.com/comment/36264830
tagged with: java
type: Question
has title: Iteration in JSP
answer count: 2
has comment: http://stackoverflow.com/comment/36264853
accepted answer: http://stackoverflow.com/a/23621806
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23620323
has comment: http://stackoverflow.com/comment/36264921
has comment: http://stackoverflow.com/comment/36264783
score: 0
has answer: http://stackoverflow.com/a/23621806
tagged with: iteration
has comment: http://stackoverflow.com/comment/36264816
has comment: http://stackoverflow.com/comment/36264835
has comment: http://stackoverflow.com/comment/36264868
has answer: http://stackoverflow.com/a/23620323

http://stackoverflow.com/q/23689910
has title: How can I create a space between two components in a JPanel
has body: I am trying to create a space between an ImageIcon and a JButton, which are placed in the same JPanel side by side. This is what I have so far: allPanels.add(middlePanel); middlePanel.add(grassPanel); grassPanel.setLayout(new BoxLayout(grassPanel, BoxLayout.LINE_AXIS)); grassPanel.add(new JLabel(new ImageIcon("grass.jpg"))); buyGrass = new JButton("Buy Food"); grassPanel.add(buyGrass); Is there anyway to separate the image and the button, so that the image is more to the left and the button is more to the right?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23689977
tagged with: java
tagged with: jpanel
type: Question
tagged with: layout
accepted answer: http://stackoverflow.com/a/23689977
score: 0
answer count: 1

http://stackoverflow.com/comment/36538792
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23763084
has text: That's what I wanted you to infer. Now remove `static` modifier from `b`, otherwise it won't compile.
score: 0

http://stackoverflow.com/q/23715565
linked to: http://stackoverflow.com/q/1062113
type: Question
has body: I want to generate some data and write them into a file. The size of these data is larger than the capacity of memory. Which way should I use to write these data? Now I am using this way: BufferedWriter output = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(fileName), "utf-8" )); I don't know if it works when the data is very large, and if there is other way with better performance. Also, the encoding must be "utf-8".
has comment: http://stackoverflow.com/comment/36448761
possible better answer: http://stackoverflow.com/a/23715713
linked to: http://stackoverflow.com/q/4667483
has comment: http://stackoverflow.com/comment/36447722
answer count: 2
has answer: http://stackoverflow.com/a/23715713
downvote count: 0
has answer: http://stackoverflow.com/a/23715854
favorite count: 0
has comment: http://stackoverflow.com/comment/36447769
has title: How to write large result into a file in Java
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/23715854
tagged with: java
has comment: http://stackoverflow.com/comment/36447832
upvote count: 1

http://stackoverflow.com/comment/36296761
type: AnswerComment
type: Comment
has text: thanks...was thinking the solution would be swing Worker or something its amazing how you miss the little things.
score: 0
comment on: http://stackoverflow.com/a/23636916

http://stackoverflow.com/comment/36380929
type: Comment
comment on: http://stackoverflow.com/q/23679963
type: QuestionComment
has text: Well then simply do a resource lookup, no need to name the jar; or do you have files with the same path in different jars?
score: 0

http://stackoverflow.com/q/23696415
type: Question
possible better answer: http://stackoverflow.com/a/23696748
has answer: http://stackoverflow.com/a/23696748
has comment: http://stackoverflow.com/comment/36411285
has title: File.createTempFile check if file exists?
accepted answer: http://stackoverflow.com/a/23696590
answer count: 2
score: 3
downvote count: 0
favorite count: 0
has body: If I use this method, and by chance there is a temporary file with the same name, the file is overwritten? I'm talking about an application that will generate many temporary files, for a long time.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36411269
has answer: http://stackoverflow.com/a/23696590
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36411428

http://stackoverflow.com/a/23751970
score: 1
has comment: http://stackoverflow.com/comment/36542932
upvote count: 2
type: AcceptedAnswer
downvote count: 1
type: Answer
has body: I think your issue isn't the Java driver but the ReplSet itself. Fire up a mongo shell and do rs.status(). You'll likely see output almost exactly like the stuff the Java driver is giving you. It seems that your mongo1.test.com is either offline entirely or not starting up. SSH onto mongo1.test.com and see if you can mongo shell from there. My bet is "no". Tail the mongo server log to see what that tells you. Maybe stop the service and start it there to get the log to give you a fresh view of the issue. The good news is, I think your Java code is actually working, you just have a dorked mongod in the ReplSet configuration. Undork it, the ReplSet will heal itself, and you'll be on your way.
answers question: http://stackoverflow.com/q/23748868
accepted answer of: http://stackoverflow.com/q/23748868

http://stackoverflow.com/comment/36389748
score: 0
type: Comment
has text: Spellcheck? :) "appliaction/json" & "applicaction/json".
type: QuestionComment
comment on: http://stackoverflow.com/q/23683730

http://stackoverflow.com/comment/36452255
score: 0
has text: found it : int StepRef =-2; String SS = String.format("%08X",StepRef); String SS4 = SS.substring(SS.length() - 4);
comment on: http://stackoverflow.com/q/23717736
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23756987
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/15817909
answer count: 2
has answer: http://stackoverflow.com/a/23758427
accepted answer: http://stackoverflow.com/a/23758427
possible better answer: http://stackoverflow.com/a/23772778
downvote count: 0
has title: Spring @Transactional on one service method spanning over two Hibernate transaction managers
has answer: http://stackoverflow.com/a/23772778
has comment: http://stackoverflow.com/comment/36528253
favorite count: 0
has body: I was wondering if it is possible to use two transaction manager in one service methods. Because due to the limitation of client's mysql db configuration, we have got 2 different datasources within one database, i.e., one user/pwd/url per schema. Thats why i have to configured two transaction managers. Now I got problem when it comes to the service implementation. See the following code: public class DemoService{ ... @Transactional(value = "t1") public doOne(){ doTwo(); } @Transactional(value = "t2") public doTwo(){ } ... } if I using this code pattern, i always got the exception org.hibernate.HibernateException: No Session found for current thread If i run the two methods seperately, it workd fine. Did i miss something? Or there is other work around here? Any advice would be appreciated. btw: some of my configuration classpath*:sso.vo/*.hbm.xml true true ${dialect} <qualifier value="sso" /> <tx:annotation-driven transaction-manager="transactionManagerSso" />
has comment: http://stackoverflow.com/comment/36527621
upvote count: 2
has comment: http://stackoverflow.com/comment/36527770
tagged with: spring
has comment: http://stackoverflow.com/comment/36527720
score: 2

http://stackoverflow.com/a/23731101
has body: From the javadocs for Socket.getInputStream(): Closing the returned InputStream will close the associated socket. So the client's in and serverData streams should be closed outside the loop. Additional comments: There is no need to wrap the while (!name.equals("!")) in if(!name.equals("!")) Closing the DataInputStream will close the underlying InputStream Edit: There is also a bug in the server. It sends the file twice: dos.write(bytes, 0, bytes.length); // ... os.write(bytes, 0, bytes.length);
score: 1
answers question: http://stackoverflow.com/q/23730855
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36478685
type: Answer

http://stackoverflow.com/comment/36309012
type: QuestionComment
has text: I'm not asking how to decompile, i'm asking if the mysql connector for android application is safe or not due to java decompile thing.
comment on: http://stackoverflow.com/q/23642936
score: 0
type: Comment

http://stackoverflow.com/q/23758486
has answer: http://stackoverflow.com/a/23759407
accepted answer: http://stackoverflow.com/a/23758544
possible better answer: http://stackoverflow.com/a/23758805
score: 2
has answer: http://stackoverflow.com/a/23758805
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
has body: I have to write code that counts how many unique letters are in a string: e.g "aabbcdefff" This will return 6 as there are 6 different letters in the string. Currently I have the code: String letters = ("aabbcdefff"); char temp = ' '; for (int i = 0; i &lt; letters.length(); i++){ temp = inp.charAt(i); if (temp != ' ') { //doesnt count spaces as letters alphabetSize = alphabetSize+1; for (int j = 0; j &lt; inp.length(); j++){ tempInp = tempInp.replace(temp,' '); } } } The idea of this code is that it should when detecting a letter, replace all instances of it with a space. When i run this code however, it just gives me the length of the string. What am i doing wrong? Is there another more elegant way to do this? Thanks for your help.
has title: Counting the number of unique letters in a string
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/23758657
favorite count: 0
has comment: http://stackoverflow.com/comment/36529674
has answer: http://stackoverflow.com/a/23761691
has answer: http://stackoverflow.com/a/23758544
tagged with: letters
answer count: 5

http://stackoverflow.com/comment/36647896
has text: Actually, I want to mock the WebConnection object. If I remove the code, the connection is not mocked and the server must be started to run the test which is not fruitful.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23784639
type: Comment

http://stackoverflow.com/q/23746127
upvote count: 5
tagged with: interface
has body: Consider this interface public interface IDoSomething { void DoAAA(); void DoBBB(); void DoCCC(); } and these two implementations public class MyObject1 implements IDoSomething { public MyObject(int a, xObjx x) .. } public class MyObject2 implements IDoSomething { public MyObject(int a, xObjx x) .. } How can I not expose the implementation classes to other developers? Specifically how can I prevent the following? IDoSomething C = new MyObject2(); Is using a factory class the best practice? public class DoSomethingFactory { static IDoSomething getDoSomething(int a, xObjx x) { ... } } How can I extend this pattern to include implementations that have different constructors?
has comment: http://stackoverflow.com/comment/36541303
has comment: http://stackoverflow.com/comment/36506295
tagged with: constructor
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36506457
tagged with: factory
type: Question
has answer: http://stackoverflow.com/a/23746197
tagged with: java
has answer: http://stackoverflow.com/a/23746533
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/36540746
has title: How can I protect my class's implementation from other developers?
favorite count: 0

http://stackoverflow.com/q/23739334
downvote count: 0
has title: Compile time error: ambiguous on calling overloaded method. Why?
has comment: http://stackoverflow.com/comment/36493294
possible better answer: http://stackoverflow.com/a/23739476
has body: For the code below, why do I get this compile time error: The method overloadedMethod(IOException) is ambiguous for the type Test. public class Test { public static void main(String[] args) { Test test = new Test(); test.overloadedMethod(null); } void overloadedMethod(IOException e) { System.out.println("1"); } void overloadedMethod(FileNotFoundException e) { System.out.println("2"); } void overloadedMethod(Exception e) { System.out.println("3"); } void overloadedMethod(ArithmeticException e) { System.out.println("4"); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23739476
tagged with: java
has answer: http://stackoverflow.com/a/23739407
accepted answer: http://stackoverflow.com/a/23739407
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/36493344
favorite count: 0
score: 2

http://stackoverflow.com/a/23778976
has comment: http://stackoverflow.com/comment/36576972
has comment: http://stackoverflow.com/comment/36576920
has comment: http://stackoverflow.com/comment/36572650
downvote count: 0
has comment: http://stackoverflow.com/comment/36577471
has comment: http://stackoverflow.com/comment/36577426
has comment: http://stackoverflow.com/comment/36572321
has comment: http://stackoverflow.com/comment/36570445
has comment: http://stackoverflow.com/comment/36574438
type: Answer
has comment: http://stackoverflow.com/comment/36574191
has comment: http://stackoverflow.com/comment/36570396
score: 2
has body: The problem is that you are using the wrong annotations for Spring + EhCache integration. You need to use org.springframework.cache.annotation.Cacheable instead of com.googlecode.ehcache.annotations.Cacheable. Check out this and this for more information about how to use Spring's caching support (introduced with Spring 3.1) and EhCache as the caching provider
upvote count: 2
has comment: http://stackoverflow.com/comment/36570243
has comment: http://stackoverflow.com/comment/36571966
has comment: http://stackoverflow.com/comment/36572853
has comment: http://stackoverflow.com/comment/36569833
has comment: http://stackoverflow.com/comment/36573947
has comment: http://stackoverflow.com/comment/36570709
has comment: http://stackoverflow.com/comment/36572423
answers question: http://stackoverflow.com/q/23776736

http://stackoverflow.com/comment/36297359
comment on: http://stackoverflow.com/q/23637233
type: QuestionComment
type: Comment
score: 1
has text: @GáborBakos The stack trace would look very different if that were even possible.

http://stackoverflow.com/comment/36483121
type: AnswerComment
has text: @AndrewThompson True, I guess I could add screenshots, though it does diminish the awe the user expresses when they first run the code. :)
type: Comment
comment on: http://stackoverflow.com/a/23730099
score: 0

http://stackoverflow.com/a/23678536
has comment: http://stackoverflow.com/comment/36434088
type: Answer
score: 2
downvote count: 0
has body: Spring Security supports this out of the box. Can you migrate your authentication process to use Spring Security? See section 2.3.3 Concurrent Session Management below: http://docs.spring.io/spring-security/site/docs/3.0.x/reference/springsecurity-single.html
answers question: http://stackoverflow.com/q/23678176
upvote count: 2

http://stackoverflow.com/comment/36460707
has text: Still new here with few "reputation" not enough to Vote up but your help is really appreciated. Thank you once more sir
comment on: http://stackoverflow.com/a/23721889
score: 0
type: AnswerComment
type: Comment

antlr
tags question: http://stackoverflow.com/q/23762999
tags question: http://stackoverflow.com/q/23696269
tags question: http://stackoverflow.com/q/23746302
tags question: http://stackoverflow.com/q/23627098
tag name: antlr
type: Tag
tags question: http://stackoverflow.com/q/23617940
tags question: http://stackoverflow.com/q/23625154
tags question: http://stackoverflow.com/q/23653894
tags question: http://stackoverflow.com/q/23621660

http://stackoverflow.com/q/23693739
score: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23693890
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/23693801
has answer: http://stackoverflow.com/a/23693801
has comment: http://stackoverflow.com/comment/36407392
accepted answer: http://stackoverflow.com/a/23693890
tagged with: android
has body: How do I make this piece of code generate to numbers which adds up to a sum of between 1 to 10? At the moment the solution is always 10 because of this int randomint2 = (10 - randomint1);. int min = 1; int max = 10; Random randomint = new Random(); final int randomint1 = randomint.nextInt(max - min +1) + min; final int randomint2 = (10 - randomint1); final TextView displayrandomproblem = (TextView) findViewById(R.id.tvrandomproblem); displayrandomproblem.setText(randomint1 + " + " + randomint2 + " = ");
has title: How to make the solution of random math task become dynamic?

http://stackoverflow.com/comment/36316625
type: Comment
score: 2
has text: Check my comment. You are using the jackson1 class `MappingJacksonJsonView` but should use `MappingJackson2JsonView`.
type: QuestionComment
comment on: http://stackoverflow.com/q/23631868

http://stackoverflow.com/q/23655157
has answer: http://stackoverflow.com/a/23674684
tagged with: java
tagged with: andengine
type: Question
score: 0
has body: I'm wondering how I can do this? Because at the moment I use BitmapTextureAtlas.unload() but that doesn't remove/clear data from OpenGL context. I know it because after I unload every texture in game. Then pause and resume app, when OpenGL recreate Context it take some time. So my conclusion is that OpenGL Context still contain those data. My code @Override public synchronized void onPauseGame() { super.onPauseGame(); if (gameIsLoaded) { Log.i("textureManager",""+getTextureManager().getTexturesLoadedCount()); Log.i("textureManager",""+getTextureManager().getTextureMemoryUsed()); atlasNumbers.unload(); atlasIcon.unload(); atlasHexagonBackground.unload(); atlasCorner.unload(); atlasCloud.unload(); // there is a lot more of unload Log.i("textureManager",""+getTextureManager().getTexturesLoadedCount()); Log.i("textureManager",""+getTextureManager().getTextureMemoryUsed()); wasPaused = true; } } Output I/textureManager﹕ 130 I/textureManager﹕ 79834 I/textureManager﹕ 130 I/textureManager﹕ 79834 I found out that BitmapTextureAtlas.unload() only set flag and actual unload will be performed on next onUpdate tick. Is there any to unload texture and then performe application pause?
tagged with: android
answer count: 1
has title: AndEngine GLES 2 - Defenetly unload/remove BitmapTextureAtlas from OpenGL Context
tagged with: opengl-es
type: UnansweredQuestion

http://stackoverflow.com/q/23697244
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23697320
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36412539
has comment: http://stackoverflow.com/comment/36412614
favorite count: 0
has title: NullPointerException in java when trying to add a float and object to calculation method
type: Question
has comment: http://stackoverflow.com/comment/36412542
has comment: http://stackoverflow.com/comment/36413498
accepted answer: http://stackoverflow.com/a/23697320
score: -1
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36412881
has body: I get a NullPointerException in java when I try to add a float and object to my calculation method. Here is the class that calls the calculation method: public class Server extends Thread { FedExRate display = new FedExRate(); private ServerSocket serverSocket; private String clientAddress; private String portNumber; private String currentTimeStamp; //send to client private float flatRate; private float additionalRate; private float weight; //read from client private String countryName; private String type; private float boxWeight; //message to display on server side private String message1; private String message2; private String message3; private String message4; // the calculation part private float amount; private float surcharge; private float totalAmount; //create object for other class FedexSalesManagerDB database = new FedexSalesManagerDB(); ProvisionedBox box = new ProvisionedBox(); CompareAndGetRate passingInfo = new CompareAndGetRate(); DisplayServer callingGui = new DisplayServer(); Box passBoxTypeName = new Box(); ShipmentBox shipBox = new ShipmentBox(); Country passCountryName = new Country(); FedExBoxRate flatRatePlusArate; FedExSalesManager calculation; OutputCal clientValues; //boxno private int boxno; //courierBoxId private int CourierBoxId; //shipmentId private int shipmentId; //database data private DatabaseManager dbManager = new DatabaseManager(); private Connection conn; // Socket socket; // Get input stream to read from client DataInputStream in ; //setter and getter public float getWeight() { return weight; } public void setWeight(float weight) { this.weight = weight; } public float getFlatRate() { return flatRate; } public void setFlatRate(float flatRate) { this.flatRate = flatRate; } public float getAdditionalRate() { return additionalRate; } public void setAdditionalRate(float additionalRate) { this.additionalRate = additionalRate; } public float getTotalAmount() { return totalAmount; } public void setTotalAmount(float totalAmount) { this…

http://stackoverflow.com/a/23725730
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23725713
has comment: http://stackoverflow.com/comment/36467718
downvote count: 0
score: 1
has body: Basically you are trying to create a method named void which has a output type of main in it. This is simply not valid. Swap main with void. If you need more information about defining methods try the java tutorials. There is a thorough explanation of method signatures in them.

http://stackoverflow.com/comment/36497742
type: QuestionComment
score: 0
has text: Three String objects are created. It first creates a String object for "hellow", because it is not currently in the String pool. The same happens for "Hellow again". The + operator creates a new String object that is a concatenation of "hello" and "Hellow again".
comment on: http://stackoverflow.com/q/23741636
type: Comment

http://stackoverflow.com/comment/36267355
has text: Ok, then when the app is enabled, write that to a shared perference. Use the boot_complete receiver as I mentioned earlier. In the receiver, check the value of the setting. If its on, then start the activity. Otherwise don't.
comment on: http://stackoverflow.com/q/23621419
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23672797
tagged with: libgdx
has comment: http://stackoverflow.com/comment/36396797
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23676038
favorite count: 0
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/23676038
has body: I'm working in a game with some friends in which we have a large horizontal world and a OrthographicCamera that shows only 1/3 of it. This camera it's moved when the horizontal position of the player change so the camera only move to the left and to the right. Some of the objects showed in the game are near the player point-of-view but others are far away (for example, islands). With this in consideration, we cannot set fixed positions for elements and move only the camera. We need to achieve a parallax effect taking in consideration the distance of the elements. Here is a simple image to explain it better: The viewport to the left shows 3 objects of the game. The green one is near the player, the red ellipse is far and the yellow one is in the middle. In the viewport to the right the camera has been moved to the right so all the objects disappear to the left. The thing is that the relative movement of the green rectangle is greater than the movement of the yellow. In the same way, movement of yellow object is greater than red object movement. I created all my assets scaled taking in consideration how far they are but now, how can I simulate this perspective using libGDX? Is there any class to do it? If I have to set elements position in each iteration, how could I calculate the right position?
has title: Achieve parallax effect in libGDX game
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36396479
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/36407811
score: 0
type: Comment
has text: That is odd... SimpleTextExtractionStrategy doesn't reorder the text. I'll update my answer.
comment on: http://stackoverflow.com/a/23693920
type: AnswerComment

http://stackoverflow.com/q/23620985
tagged with: java
has comment: http://stackoverflow.com/comment/36267112
has answer: http://stackoverflow.com/a/23621306
upvote count: 0
tagged with: user-interface
answer count: 1
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
tagged with: jlist
score: -2
has title: Using JList with Ordered Array Lists
has comment: http://stackoverflow.com/comment/36266705
has comment: http://stackoverflow.com/comment/36267166
downvote count: 2
tagged with: swing
type: Question
has body: I'm having quite a bit of trouble getting the elements inside my list to get displayed onto my GUI's JList. I tried addElement and some other styles of JList methods that come with JDK and I couldn't get any to work the way I wanted. I'm trying to display input strings on the JList and then store them in my separate list to call upon. Is there a preferred methodology when working with JList and JFrame this way? import javax.swing.*; import java.awt.*; import java.awt.event.*; public class PlaylistMakerFinal extends JFrame implements ActionListener{ private static int SIZE = 1000; private static int WIDTH = 600; private static int HEIGHT = 600; OrderedArrayList&lt;String&gt; songList = new OrderedArrayList&lt;String&gt;(SIZE); { songList = new OrderedArrayList&lt;String&gt;(); } private JButton deleteButton; private JButton addButton; private JTextField addTextField; private JTextField searchTextField; private JButton searchButton; private JButton exitButton; private JList&lt;String&gt; songArea; public void displayText(){ this.getContentPane().add(songArea); } public PlaylistMakerFinal() { setTitle("Playlist Maker"); Container pane = getContentPane(); pane.setLayout(null); setSize(WIDTH, HEIGHT); songArea = new JList&lt;String&gt;(); addTextField = new JTextField(); searchTextField = new JTextField(); exitButton = new JButton("Exit"); exitButton.addActionListener(this); addButton = new JButton("Add"); addButton.addActionListener(this); deleteButton = new JButton("Delete"); deleteButton.addActionListener(this); searchButton = new JButton("Search"); searchButton.addActionListener(this); songArea.setSize(250, 400); addTextField.setSize(250, 30); searchTextField.setSize(250, 30); addButton.setSize(100, 40); deleteButton.setSize(100, 40); searchButton.setSize(100, 40); exitButton.setSize(100, 40); songArea.setLocation(10, 50); addTextField.setLocation(10,10); searchTextField.setLocation(10, 480); addButton.setLocation(300, 5); deleteButton.setLocation(420, 5); searchButt…

http://stackoverflow.com/comment/36381877
type: Comment
type: QuestionComment
has text: The String is this one:"2014-02-07 00:00:00"
comment on: http://stackoverflow.com/q/23680578
score: 0

http://stackoverflow.com/q/23665607
has title: My imageIcon is not working?
answer count: 2
upvote count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23665674
favorite count: 0
possible better answer: http://stackoverflow.com/a/23665956
has answer: http://stackoverflow.com/a/23665674
type: AnsweredQuestion
tagged with: jframe
has comment: http://stackoverflow.com/comment/36353428
tagged with: swing
has comment: http://stackoverflow.com/comment/36356164
has comment: http://stackoverflow.com/comment/36356713
type: Question
score: 1
has answer: http://stackoverflow.com/a/23665956
tagged with: java
has body: I am trying to set a JFrame imageIcon and for some reason it is not displaying in the JFrame. ImageIcon img = new ImageIcon("stop.jpg"); frame.setIconImage(img.getImage()); I create an ImageIcon variable and then uses that variable to getImage() and it does not work. Is there a reason that it does not work? Question: Why does the ImageIcon not work? Class: import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.ImageIcon; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.UIManager; import java.awt.Toolkit; public class TestMenu extends JFrame { private static final long serialVersionUID = 1L; private JPanel myPanel; private static void setLookFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } } public static void main(String[] args) { setLookFeel(); ImageIcon img = new ImageIcon("stop.jpg"); TestMenu frame = new TestMenu(); frame.setIconImage(img.getImage()); frame.setVisible(true); } public TestMenu() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu("TestA"); menuBar.add(mnNewMenu); JMenuItem Item1 = new JMenuItem("TestAA"); Item1.addActionListener(new MyMenuListener(Item1)); mnNewMenu.add(Item1); JMenu Item2 = new JMenu("TestB"); menuBar.add(Item2); JMenu Item3 = new JMenu("TestBB"); Item2.add(Item3); JMenuItem Item4 = new JMenuItem("TestBB-B"); Item4.addActionListener(new MyMenuListener(Item4)); Item3.add(Item4); myPanel = new JPanel(); myPanel.setBorder(new EmptyBorder(25, 25, 25, 25)); myPanel.setLayout(new BorderLayout(10, 10)); setContentPane(myPanel); } }
tagged with: jpanel

http://stackoverflow.com/q/23711183
has body: I have simple code for iterate and update documents. Index is too large – millions of documents, 10-20gb. This is an pseudocode: liveDocs = MultiFields.getLiveDocs(reader); docsEnum = MultiFields.getTermDocsEnum(reader, MultiFields.getLiveDocs(reader), field, bytesRef); while ((doc = docsEnum.nextDoc()) != DocsEnum.NO_MORE_DOCS) { oldDocument = reader.document(doc); // some updates writer.updateDocument(term, newDocument, analyzer); break; // simple flush policy if(doc % 10000 == 0){ writer.commit(); } } DocsEnum worked correctly with reader, which it initialised. But related to reader index segments(files) does't removed before reader is opened, and index size is doubled each update iteration. After day of work, index size is terabytes! If close all readers and writes, and reopen index - old segments will be removed. How to correctly iterate &amp; update documents without disk files leak? I use java 1.7, lucene 4.8
tagged with: java
tagged with: lucene
has answer: http://stackoverflow.com/a/23761483
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36459290
type: Question
accepted answer: http://stackoverflow.com/a/23761483
has comment: http://stackoverflow.com/comment/36443770
has title: How to iterate and update documents over lucene documents?
score: 0
has comment: http://stackoverflow.com/comment/36459231
answer count: 1

http://stackoverflow.com/comment/36548550
comment on: http://stackoverflow.com/a/23758286
type: AnswerComment
has text: Thanks! I found the mistake! :-)
score: 0
type: Comment

http://stackoverflow.com/comment/36515543
type: Comment
comment on: http://stackoverflow.com/a/23750122
has text: The line, `if(iterator.hasNext()){ // L1` should be `while(iterator.hasNext()){ // L1`
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36538452
type: AnswerComment
comment on: http://stackoverflow.com/a/23762429
type: Comment
score: 0
has text: So you main problem is that each invocation of this method produces a warning and you are willing to suppress them if you move them into the method?

http://stackoverflow.com/q/23624308
has answer: http://stackoverflow.com/a/23624456
score: 0
answer count: 3
tagged with: jsp
has answer: http://stackoverflow.com/a/23624470
type: UnansweredQuestion
has title: How can I make the progress bar work in synchronization with the server code?
tagged with: java
has answer: http://stackoverflow.com/a/23624565
tagged with: web-applications
has body: There is a heavy database process that has to be executed before loading the jsp. // jsp &lt;% new bean().startHeavyProcess(); %&gt; . . . As the process is going,I want to show a progress bar using java script. Is there any way I can make the progress bar work in synchronization with the server side code ? Can I know when the server side code finishes its execution or is about to finish the execution ?
type: Question
tagged with: javascript

http://stackoverflow.com/comment/36665518
comment on: http://stackoverflow.com/a/23777619
type: Comment
has text: I am trying to put these in a html block like this <model.photoUrl:{v | <img src="<v>"> }> but it's not working. What am I doing wrong??
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36371690
has text: The constructor in my Wallpaper class just takes a String argument (String filePath) and then calls "super(filePath);" I'm not sure whether I should be calling the File-constructor through super() or if I should make my own... I'm still a bit befuzzled by these object-oriented programming designs.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23675056

http://stackoverflow.com/q/23667748
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23668063
tagged with: jframe
tagged with: jmenubar
type: UnansweredQuestion
tagged with: menu
has comment: http://stackoverflow.com/comment/36357719
tagged with: java
type: Question
has body: The code is here: I don't think the System.exit(); is working properly. Am I using the wrong method or what? JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnRWindow = new JMenu("RWindow"); menuBar.add(mnRWindow); JMenuItem mntmMore = new JMenuItem("More"); mnRWindow.add(mntmMore); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.exit(DISPOSE_ON_CLOSE); } }); mnRWindow.add(mntmExit);
has title: Exit option with my menu in my window
tagged with: system

http://stackoverflow.com/comment/36429267
has text: This is probably a picnic problem. Try reading more how powers and mods work. Break every calculation into smaller ones and check if the result is what you were expecting.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23705530
type: QuestionComment

http://stackoverflow.com/comment/36565028
type: Comment
type: QuestionComment
score: 1
has text: I think you are using the wrong caching annotations. Make sure that `@Cacheable` is imported from `org.springframework.cache.annotation.Cacheable`. Let me know if it works for you
comment on: http://stackoverflow.com/q/23776736

http://stackoverflow.com/a/23700585
answers question: http://stackoverflow.com/q/23700563
score: 4
type: Answer
upvote count: 4
downvote count: 0
has body: Your Comparator should return a negative number if the first object is "less than" the second object, 0 if they're "equal", and a positive number if the first object is "greater than" the second object. It shouldn't return one of the objects. The compare method returns an int, and its Javadocs states: Returns: a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
has comment: http://stackoverflow.com/comment/36419637

http://stackoverflow.com/a/24303121
has body: public class LeadEntry extends Activity implements View.OnClickListener { Spinner productspinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.leadentry); productspinner = (Spinner) findViewById(R.id.myspinner2); productspinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view,int position, long id) { //this will give position of item in spinner Toast.makeText(parent.getContext()," OnItemSelectedListener : " parent.getItemAtPosition(position).toString(),Toast.LENGTH_SHORT).show(); // this will give the selected item not position String product = this.productspinner.getSelectedItem().toString(); } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { // TODO Auto-generated method stub } }); } }
answers question: http://stackoverflow.com/q/23757441
score: 0
type: Answer

http://stackoverflow.com/a/23621328
has body: When an object is instantiated, it makes an implicit, no-args super-constructor call to its parent class before running its own constructor. You can imagine that there is this line ALWAYS in your constructors: public MyClass() { super(); //If this line is not here, it is implicit. //rest of the code } You can override this by providing your own explicit, any-args super-constructor call, but it must be the first line of the method. public MyClass() { super(1, "Hello Word", null); //written explicitly, no other super-constructor code will run //rest of the code } Which can be useful when the superclass does not have a no-args constructor defined.
has comment: http://stackoverflow.com/comment/36266978
type: Answer
answers question: http://stackoverflow.com/q/23621321
upvote count: 6
score: 6
downvote count: 0

http://stackoverflow.com/a/23771294
answers question: http://stackoverflow.com/q/23771129
upvote count: 2
has body: Either of the following options should work add jar to the global libraries of the project. put jar in the lib directory of intellij. put jar in the ext lib of the jre that intellij is running under.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/23693861
answers question: http://stackoverflow.com/q/23670848
type: Answer
has body: Unfortunately, Substance is not maintained for years. Haven't tried it with JDK 8 but there might be some migration issues. It had a fork called Insubstantial but heard that the project is looking for a new maintainer too. Too bad, awesome libs they were. Anyway, these are open source libraries so if you can hunt down the issue and contribute it to the community, it would be a really great support for the community.
score: 0

http://stackoverflow.com/comment/36665516
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23768775
has text: I just read something about certain versions of WebLogic 10.3.x not being able to support other JPA 2.0 implementations...I'm using 10.3.4 - do you know if that is one of the ones that can only use EclipseLink?

http://stackoverflow.com/a/23709256
answers question: http://stackoverflow.com/q/23709229
has body: When you create a JLabel[], you're creating the array of labels. NOT the labels inside the array. In other words, the array elements are still null after you create the array. That's why your second to last bit of code works, but your last didn't -- in the last bit of code, you didn't initialize the elements in the array, so when you try to call a method on them, you get a NullPointerException.
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23709229
upvote count: 3

http://stackoverflow.com/comment/36475839
comment on: http://stackoverflow.com/q/23729774
has text: Did you read http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file?rq=1?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23682334
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/23983076
type: UnansweredQuestion
score: 16
tagged with: web-services
upvote count: 16
type: Question
has body: I am trying to create a small project concerning RESTful services. So I fire up IntelliJ IDEA and do: New Project -> (select Java) -> (select RESTful WebService 2.2) -> check "Generate client and server code", select to download needed libraries. Afterwards when going to the created HelloWorld class I get the following error: cannot resolve symbol "HttpServerFactory" as well as cannot resolve symbol "jersey" for this import: import com.sun.jersey.api.container.httpserver.HttpServerFactory;. Any ideas how to solve this problem?
has answer: http://stackoverflow.com/a/26450063
tagged with: java
has title: Cannot resolve symbol "HttpServerFactory" in IntelliJ IDEA
answer count: 2
tagged with: intellij-idea
downvote count: 0

http://stackoverflow.com/a/23632502
accepted answer of: http://stackoverflow.com/q/23632094
has body: Basically, creating a Dogs class provides you with additional layer of indirection. This means that all your other code will reference (i.e. use) only the Dogs class, but not the internal list. This, in turn, means that whenever you decide to switch from using list to, say, using plain arrays internally (or to change Dogs's implementation in any other way, for that matter), you can readily do so. That's a motivation for it. As for the question of it being 'better', that depends strongly on whether you can limit usage of the internal container by a stable Dogs's API. If you can, creating a Dogs class is justified. Otherwise, it's simpler and easier to just go ahead and use List. One example of the aforementioned 'stable API' is an application of the Visitor pattern. In this case, the Dogs class shall have a single visit() method accepting a visitor argument. A visitor 'knows' how to process a Dog, but is completely unaware of the Dogs internal structure. Which is a good thing.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23632094
score: 4
has comment: http://stackoverflow.com/comment/36290834
downvote count: 0
has comment: http://stackoverflow.com/comment/36291483
type: Answer
upvote count: 4

http://stackoverflow.com/a/23676073
answers question: http://stackoverflow.com/q/23675753
type: Answer
score: 1
upvote count: 1
has body: current is a reference to the current position in your linked list. After the while loop, current refers to the second to last item. When you say current.next = null, you make the current object's next become null. That makes the current object the last object. When you say current = null, you are just setting your local reference variable to null. In other words, it no longer refers to your list. It refers to null.
accepted answer of: http://stackoverflow.com/q/23675753
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23711224
answer count: 1
has title: Why GPars runForkJoin is slow even when there are no forkOffChild()?
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
tagged with: fork-join
type: Question
tagged with: gpars
has body: This is the sequential version: void f(long n) { for (int i=1; i&lt;n-1; i++) { // do nothing } } List result = [] (1..99999).each { f(it) result &lt;&lt; it } It takes a few seconds to run the code. void f(long n) { for (int i=1; i&lt;n-1; i++) { // do nothing } } withPool { runForkJoin(1,99999) { a, b -&gt; List result = [] (a..b).each { f(it) result &lt;&lt; it } return result } } The code above takes several minutes to finish. I haven't call any forkOffChild() or childrenResults() yet. I'm running this code in Windows and single core CPU with Intel Hyperthreading (2 logical CPU). Java Runtime.runtime.availableProcessors() returns 2. I don't understand why the code that uses runForkJoin much slower than the sequential code (minutes versus seconds).
score: 0
has answer: http://stackoverflow.com/a/23719680
tagged with: groovy
accepted answer: http://stackoverflow.com/a/23719680

http://stackoverflow.com/q/23670842
has comment: http://stackoverflow.com/comment/36377186
tagged with: struts2
has comment: http://stackoverflow.com/comment/36371878
has comment: http://stackoverflow.com/comment/36366563
tagged with: model-driven
has comment: http://stackoverflow.com/comment/36369147
has comment: http://stackoverflow.com/comment/36387613
answer count: 0
downvote count: 0
tagged with: jsp
score: 1
has comment: http://stackoverflow.com/comment/36375176
favorite count: 0
has comment: http://stackoverflow.com/comment/36371712
has comment: http://stackoverflow.com/comment/36376758
has title: Struts2 - Strange behavior of ModelDriven Interface
type: Question
has comment: http://stackoverflow.com/comment/36376036
has comment: http://stackoverflow.com/comment/36370494
has comment: http://stackoverflow.com/comment/36376322
has body: My objective is to get an object of TestBean class in Struts2 Action and show its values at jsp page (view layer) I am implementing ModelDriven interface into my action class as follows public class TestAction extends ActionSupport implements ModelDriven&lt;TestBean&gt;{ private TestBean testBeanObject; @Override public TestBean getModel() { return testBeanObject; } @Override public String execute(){ testBeanObject = getting object of TestBean Class from business layer (It is having all the value whatever I want) return ActionSupport.SUCCESS; } } My TestBean class code @Entity @Table(name="test_bean") public class TestBean implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="test_bean_id") private int testBeanId; private String firstProperty; private String secondProperty; @OneToMany(mappedBy="testBeanPaper", fetch = FetchType.LAZY) private List&lt;PapersText&gt; papersTexts; public TestBean() { } public String getFirstProperty() { return this.firstProperty; } public void setFirstProperty(String firstProperty) { this.firstProperty = firstProperty; } public String getSecondProperty() { return this.secondProperty; } public void setSecondProperty(String secondProperty) { this.secondProperty = secondProperty; } public List&lt;PapersText&gt; getPapersTexts() { return this.papersTexts; } public void setPapersTexts(List&lt;PapersText&gt; papersTexts) { this.papersTexts = papersTexts; } } My jsp page code is &lt;s:textarea id="textarea1" class="longinput" name="firstProperty" value="%{firstProperty}"&gt;&lt;/s:textarea&gt; &lt;s:textarea id="textarea2" class="longinput" name="secondProperty" value="%{secondProperty}"&gt;&lt;/s:textarea&gt; At View Layer (Jsp page) I am having text fields with same name as properties of TestBean Class. Now the problem is case 1. If I am getting TestBean class object form another class (as shown above), Values are not reflecting at jsp page. Even TestBean object is initialized perfectly case 2. In actio…
has comment: http://stackoverflow.com/comment/36405237
tagged with: java
has comment: http://stackoverflow.com/comment/36367814
has comment: http://stackoverflow.com/comment/36366353
has comment: http://stackoverflow.com/comment/36370239
upvote count: 1
has comment: http://stackoverflow.com/comment/36376234
has comment: http://stackoverflow.com/comment/36367504
has comment: http://stackoverflow.com/comment/36369183
has comment: http://stackoverflow.com/comment/36366266
has comment: http://stackoverflow.com/comment/36363120
has comment: http://stackoverflow.com/comment/36365426
type: UnansweredQuestion

http://stackoverflow.com/a/50334069
score: 0
answers question: http://stackoverflow.com/q/23643016
type: Answer
has body: This is a full example with java, include a Java class for streaming (no need to create other functions) This is an example for a simple streaming : StreamRTP rtp = new StreamRTP(); rtp.start("10.20.11.142", 5000, "sample.mp3"); You can find the class here : https://github.com/maitmansour/vlcj-audio-rtp-streaming-example

sqlite
tags question: http://stackoverflow.com/q/23636733
type: Tag
tags question: http://stackoverflow.com/q/23630842
tags question: http://stackoverflow.com/q/23704496
tags question: http://stackoverflow.com/q/23767403
tags question: http://stackoverflow.com/q/23665796
tags question: http://stackoverflow.com/q/23630710
tags question: http://stackoverflow.com/q/23764964
tags question: http://stackoverflow.com/q/23635108
tags question: http://stackoverflow.com/q/23673237
tags question: http://stackoverflow.com/q/23735163
tags question: http://stackoverflow.com/q/23633644
tag name: sqlite

http://stackoverflow.com/q/23769444
tagged with: colors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23771178
tagged with: plugins
tagged with: java
tagged with: bukkit
upvote count: 1
downvote count: 1
type: Question
score: 0
answer count: 2
has title: Adding color code translation for a string in a Bukkit config.yml
favorite count: 0
has answer: http://stackoverflow.com/a/23797483
has body: I am trying to add color support to my plugin and when I did, it works, but i get a weird symbol on the left side of it. ( ). Here is my code: public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(sender instanceof Player) { Player player = (Player)sender; if(player.hasPermission("di.use")) { if(label.equalsIgnoreCase("di")) { if(args.length == 0) { /////////////////////////////////////////////////////// player.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.BOLD + "+" + ChatColor.AQUA+""+ChatColor.BOLD + "---------------" + ChatColor.GREEN+""+ChatColor.BOLD + "[" + ChatColor.YELLOW+""+ChatColor.BOLD + "DonationInfo" + ChatColor.GREEN+""+ChatColor.BOLD + "]" + ChatColor.AQUA+""+ChatColor.BOLD + "--------------" + ChatColor.DARK_GRAY+""+ChatColor.BOLD + "+"); player.sendMessage(ChatColor.AQUA+""+ChatColor.BOLD + "/di" + ChatColor.DARK_AQUA+""+ChatColor.BOLD+ " Spinel " + ChatColor.BLUE+""+ChatColor.BOLD + " - " + ChatColor.AQUA+""+ChatColor.BOLD + "Spinel Donation Info"); player.sendMessage(ChatColor.AQUA+""+ChatColor.BOLD + "/di" + ChatColor.DARK_BLUE+""+ChatColor.BOLD+ " Sapphire " + ChatColor.BLUE+""+ChatColor.BOLD + " - " + ChatColor.AQUA+""+ChatColor.BOLD + "Sapphire Donation Info"); player.sendMessage(ChatColor.AQUA+""+ChatColor.BOLD + "/di" + ChatColor.RED+""+ChatColor.BOLD+ " Ruby " + ChatColor.BLUE+""+ChatColor.BOLD + " - " + ChatColor.AQUA+""+ChatColor.BOLD + "Ruby Donation Info"); player.sendMessage(ChatColor.AQUA+""+ChatColor.BOLD + "/di" + ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+ " Amethyst " + ChatColor.BLUE+""+ChatColor.BOLD + " - " + ChatColor.AQUA+""+ChatColor.BOLD + "Amethyst Donation Info"); player.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.BOLD + "+" + ChatColor.AQUA+""+ChatColor.BOLD + "-----------------------------------------" + ChatColor.DARK_GRAY+""+ChatColor.BOLD + "+"); return true; ////////////////////////////////////////////////////// } } }else{ player.sendMessage(ChatColor.RED + "Your do not have p…
has comment: http://stackoverflow.com/comment/36560557

http://stackoverflow.com/q/23636304
upvote count: 2
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/48500233
tagged with: css
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23638921
has comment: http://stackoverflow.com/comment/36300595
type: Question
has comment: http://stackoverflow.com/comment/36295588
tagged with: servlets
answer count: 2
linked to: http://stackoverflow.com/q/3655316
has comment: http://stackoverflow.com/comment/36299045
downvote count: 0
tagged with: tomcat
has title: Attaching a CSS file to a Java Servlet in Tomcat
has comment: http://stackoverflow.com/comment/36295791
duplicate of: http://stackoverflow.com/q/3655316
favorite count: 0
has body: After a lot of looking around on various forums and such, I was not able to find an answer to my question. I want to attach a stylesheet to my servlet instead of having to use &lt;style&gt; tags. I am using Apache Tomcat 7 in Eclipse and I am manually writing the html code (via a PrintWriter). I've tried putting the .css file in the ROOT of the WebApp. I've tried putting it in the css. Nothing is working. Can someone point me in the right direction? Here is some code that I tried. Attempt 1 (css is in a folder. WebContent/css: String cssLocation = request.getContextPath() + "/WebContent/css/styles2.css"; String cssTag = "&lt;link rel='stylesheet' type='text/css' href='" + cssLocation + "'&gt;"; Attempt 2 (css is in the ROOT): String cssLocation = request.getContextPath() + "/styles2.css"; String cssTag = "&lt;link rel='stylesheet' type='text/css' href='" + cssLocation + "'&gt;"; Neither of those worked. EDIT: Here is my directory structure: PROJECT ROOT src testPackage DownloadServlet.java WebContent css styles2.css files fonts js META-INF WEB-INF index.html To explain: I am trying to reference /WebContent/css/styles2.css in DownloadServlet.java How I am doing that: In the method 'doGet', I am initializing a `PrintWriter'. I'm printing out: &lt;html&gt; &lt;head&gt; HERE IS WHERE THE LINK NEEDS TO GO &lt;/head&gt; &lt;body&gt; ... &lt;/body&gt; &lt;/html&gt; Where the text "HERE IS WHERE THE LINK NEEDS TO GO" is, that is where I need the link to the css file. I've tried the methods above, but I had no luck.

http://stackoverflow.com/a/23751867
accepted answer of: http://stackoverflow.com/q/23751773
score: 1
answers question: http://stackoverflow.com/q/23751773
has comment: http://stackoverflow.com/comment/36517290
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36517467
has body: Use yesImagesCount=0; variable in your activity and increment this count in this code as if(resultAvailable) { holder.colView.setImageResource(R.drawable.icon_yes); yesImagesCount++; } else { holder.colView.setImageResource(R.drawable.icon_no); } And Finally display toast as Toast.makeText(getApplicationContext(), "Total number of Yes Icons are:" + String.valueOf(yesImagesCount), Toast.LENGTH_LONG).show();
upvote count: 1

http://stackoverflow.com/comment/36430828
comment on: http://stackoverflow.com/q/23706358
score: 0
type: Comment
type: QuestionComment
has text: @Whymarrh: but the key here really **is** the comparison itself. His issue is with floating point numbers, not iterating through a collection. As for my question -- I recommend using the ratio.

http://stackoverflow.com/a/23763355
has body: You need to have the class com.mysql.jdbc.Driver (and all the imported classes) in the classpath too. You should download the jar (http://dev.mysql.com/downloads/connector/j/5.0.html) and add it to the classpath.
score: 0
answers question: http://stackoverflow.com/q/23763297
has comment: http://stackoverflow.com/comment/36539535
has comment: http://stackoverflow.com/comment/36539614
has comment: http://stackoverflow.com/comment/36566134
type: Answer

http://stackoverflow.com/comment/36453255
type: Comment
type: QuestionComment
has text: I know how to do inorder traversals and adding based on key values. I just don't really know how to "jump" back and forth between branches to add things row by row
score: 0
comment on: http://stackoverflow.com/q/23718297

http://stackoverflow.com/q/23734249
has answer: http://stackoverflow.com/a/23738168
has comment: http://stackoverflow.com/comment/36492584
type: Question
has comment: http://stackoverflow.com/comment/36493392
tagged with: maven-ear-plugin
has comment: http://stackoverflow.com/comment/36485558
accepted answer: http://stackoverflow.com/a/23738168
downvote count: 0
answer count: 1
favorite count: 0
has title: maven-ear-plugin project property lookup fails
upvote count: 2
has comment: http://stackoverflow.com/comment/36491172
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: java
has body: I have created simple ear project with filters. I want to use different settings for each environment, those settings should be passed to generated application.xml file in the form of env-entries. The generation of ear package is done with maven-ear-plugin as shown below: maven-ear-plugin 2.9 <generateApplicationXml>true</generateApplicationXml> 6 customProperty java.lang.String ${custom.property} ${custom.property} To do that I had to use another plugin properties-maven-plugin. It successfully reads properties from file and sets them as maven project properties, so I can insert them in pom.xml file using ${}. It works for most of the pom.xml elements (i.e. , unfortunately it is not successfully looked up when I place it inside env-entry element, where I need it. Below is generated application.xml. <?xml version="1.0" encoding="UTF-8"?> default property test customProperty java.lang.String ${custom.property} It's probably a bug which should be issued at Maven Ear Plugin, but I don't have an account there. I'm also attaching archived maven project, if somebody would like to check that himself: test.zip. Edit I've managed to overcome this problem using maven-resource-plugin and filter application.xml file after it's created as user @skegg99 proposed. Since I cannot replace this file I had to copy it to META-INF directory. I does not look pretty, I know, but it solves the case for now. Here is additional markup for maven-resource-plugin: org.apache.maven.plugins maven-resources-plugin 2.6 ${basedir}/target/${project.artifactId}-${project.version}/META-INF src/main/filters/${env}.properties UTF-8 and also here: ${basedir}/target true application.xml Whole project configuration can be downloaded from here.

http://stackoverflow.com/comment/36297599
comment on: http://stackoverflow.com/a/23637418
score: 2
has text: That's a fairly useless loop since `input` goes out of scope when the loop exits. Declare the variable `input` before the loop and negate the condition; then it would actually be useful.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23711047
has comment: http://stackoverflow.com/comment/36439753
has comment: http://stackoverflow.com/comment/36440502
answers question: http://stackoverflow.com/q/23710736
score: 1
has comment: http://stackoverflow.com/comment/36440253
downvote count: 0
has body: What do you want your edit method to do? Look at your edit method. If you find a product with the ID you are just calling the getter methods and you are doing nothing with the data. After that you are just adding the same object again to your list. You need to define what data you want to edit and then overwrite the data with a setter method. And don't add the object again to your list.
has comment: http://stackoverflow.com/comment/36440277
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36440139

http://stackoverflow.com/comment/36522663
comment on: http://stackoverflow.com/a/23753436
type: AnswerComment
score: 0
has text: So the error is gone when you just have one JUnit on the classpath? I don't see how that would help :-/
type: Comment

http://stackoverflow.com/comment/36464781
has text: @javasuns I can't see any way how to speed up something like `timeMine2` in Java (in assembly you could use SIMD instructions). There may be some high level optimization, I don't know. You should post some code like I did, 'cause now nobody knows how it looks like.
comment on: http://stackoverflow.com/a/23657846
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23736711
type: Answer
has comment: http://stackoverflow.com/comment/36488457
has comment: http://stackoverflow.com/comment/36488711
score: 0
has body: This is how you would write it in Java 5.0 (2004) or later. List&lt;Integer&gt; db = new ArrayList&lt;Integer&gt;(); db.add(1); db.add(3); for(int i : db) System.out.println("Element" + i); As you can see this much cleaner and since Java 7 (2011) you can write List&lt;Integer&gt; db = new ArrayList&lt;&gt;(); Incorrect number of arguments for type Vector; it cannot be parameterized with arguments &lt;> This will happen if your IDE is set to Java 1.4 or older. If you have a really old JDK (more than ten years old) you will also get this error. Try to ensure you have a recent version of Java e.g. Java 8 update 5 and set your IDE to expect Java 8 code.
answers question: http://stackoverflow.com/q/23736576

http://stackoverflow.com/comment/36261503
type: Comment
has text: Have posted the SO error I got for others so they may benefit from this.
comment on: http://stackoverflow.com/q/23618135
score: 0
type: QuestionComment

http://stackoverflow.com/a/23718303
type: Answer
has body: The stdError.readLine() blocks until there are +- 4000 bytes in the error stream No it doesn't. It returns as soon as there is a line to be read. What is happening is that the source process is buffering its output, evidently into 4096-byte chunks. There's nothing you can do about it at the Java end.
upvote count: 1
has comment: http://stackoverflow.com/comment/36454207
score: 1
answers question: http://stackoverflow.com/q/23718121
has comment: http://stackoverflow.com/comment/36453414
has comment: http://stackoverflow.com/comment/36453566
downvote count: 0
has comment: http://stackoverflow.com/comment/36453248

http://stackoverflow.com/a/30039221
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23753214
has body: I ran into a very similar issue, and I was able to resolve it by updating an entry in my Eclipse project's classpath file that was pointing to an older version of JUnit. I changed &lt;classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/&gt; to &lt;classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/&gt;

http://stackoverflow.com/comment/130328867
type: Comment
has text: all 1's before the first 0 will not pass any 0 after that you have to answer the question for each zero how many 1's it will face, suffix array is a good choice.
score: 0
comment on: http://stackoverflow.com/a/73808495
type: AnswerComment

http://stackoverflow.com/comment/36440345
type: QuestionComment
score: 0
has text: Maybe there is some kind of a pointer that points to the wrong library or whatever. I really dont know, im not a java master, i'm just playing with android SDK. I was thinking that including imports in the question wont hurt. Now, why are those 5 lines so bothering you?
comment on: http://stackoverflow.com/q/23711430
type: Comment

http://stackoverflow.com/comment/36279685
type: Comment
type: QuestionComment
has text: Are you sure that `phaseList` is not Null . If it is not null then print like this `${phase}` instead of `${phase.taches}`
score: 0
comment on: http://stackoverflow.com/q/23627393

http://stackoverflow.com/q/23729250
has comment: http://stackoverflow.com/comment/40162464
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36597442
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36540456
has comment: http://stackoverflow.com/comment/36597517
has comment: http://stackoverflow.com/comment/36520042
score: 0
tagged with: nullpointerexception
has title: inputstream null pointer exception when using modified last.fm's Caller.java
has body: For some reason I'm getting null pointer exception. It's downloading the image here and logcat points me to call public Result call(final String method, final String apiKey, final String... params) { return call(method, apiKey, map(params)); } /** * Performs the web-service call. If the session parameter is * non-null then an authenticated call is made. If it's * null then an unauthenticated call is made. * The apiKey parameter is always required, even when a valid * session is passed to this method. * * @param method The method to call * @param apiKey A Last.fm API key * @param params Parameters * @param session A Session instance or null * @return the result of the operation */ public Result call(final String method, final String apiKey, Map<String, String> params) { params = new WeakHashMap<String, String>(params); InputStream inputStream = null; // no entry in cache, load from web if (inputStream == null) { // fill parameter map with apiKey and session info params.put(PARAM_API_KEY, apiKey); try { final HttpURLConnection urlConnection = openPostConnection(method, params); inputStream = getInputStreamFromConnection(urlConnection); if (inputStream == null) { lastResult = Result.createHttpErrorResult(urlConnection.getResponseCode(), urlConnection.getResponseMessage()); return lastResult; } } catch (final IOException ignored) { } } try { final Result result = createResultFromInputStream(inputStream); lastResult = result; return result; } catch (final IOException ignored) { } catch (final SAXException ignored) { } return null; } It finally cracks at the line "new InputSource(new InputStreamReader(inputStream, "UTF-8")));". /** * @param inputStream * @return * @throws SAXException * @throws IOException */ private Result createResultFromInputStream(final InputStream inputStream) throws SAXException, IOException { final Document document = newDocumentBuilder().parse( new InputSource(new InputStreamReader(inputStream, "UTF-8"))); final Element root = document.getDocument…
has comment: http://stackoverflow.com/comment/36518360
has comment: http://stackoverflow.com/comment/36474911

http://stackoverflow.com/q/23629459
has answer: http://stackoverflow.com/a/23630031
type: Question
has answer: http://stackoverflow.com/a/23630241
tagged with: java
has comment: http://stackoverflow.com/comment/36299913
has comment: http://stackoverflow.com/comment/36282236
downvote count: 3
has comment: http://stackoverflow.com/comment/36282010
favorite count: 0
has comment: http://stackoverflow.com/comment/36282300
has answer: http://stackoverflow.com/a/23630119
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36281952
tagged with: buttonclick
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/36281953
answer count: 4
has title: Button Onclick does not work
upvote count: 0
has answer: http://stackoverflow.com/a/23629809
has body: EDIT! I have this eror if i remove 1 from Oncreate1 https://i.sstatic.net/pYTLv.png I don't know why my code it doesn't work, I have no errors but nothing happens. Some help? here is the code: @Override public void onBackPressed() { super.onBackPressed(); } protected void onCreate1(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wallpaper); addButtonClickListner(); } public void addButtonClickListner() { Button btnNavigator = (Button)findViewById(R.id.play); btnNavigator.setOnClickListener(new OnClickListener() { public void onClick(View arg) { Intent intent =new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(intent); } }

http://stackoverflow.com/comment/111844086
has text: Unfortunately `@JacksonXmlText` is no more available on most recent jackson library if I am not wrong. Do you know how to proceed?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23640729

http://stackoverflow.com/comment/36315479
comment on: http://stackoverflow.com/q/23646297
score: 0
has text: If you don't want to effect the width or height of the components, change the row/column weights or `fill` properties and set the `GridBagConstraints` `gridwidth` property to `GridBagConstraints.REMAINDER`...or use a `VerticalLayout` from the SwingLab's SwingX library...
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23687640
type: AnsweredQuestion
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23699446
has comment: http://stackoverflow.com/comment/36395545
type: Question
has comment: http://stackoverflow.com/comment/36412676
tagged with: http://stackoverflow.com/tag/html
score: 0
tagged with: java
has title: request from html page cannot view chinese characters
has body: In my java server code name = request.getParameter("SUPERHERO.NAME") i am getting a series of boxes on my server side code. where printing the variable name give me a series of boxes that becomes question marks However, when the page loads i am able to view the chinese characters on the page without a problem.
has comment: http://stackoverflow.com/comment/36416748
answer count: 1
has answer: http://stackoverflow.com/a/23699446
has comment: http://stackoverflow.com/comment/36416735
has comment: http://stackoverflow.com/comment/36395546
linked to: http://stackoverflow.com/q/10732557

http://stackoverflow.com/q/23739834
has comment: http://stackoverflow.com/comment/36517563
has comment: http://stackoverflow.com/comment/36494509
type: UnansweredQuestion
has body: I have installed Nexus repository in my machine locally. I have uploaded certain artifacts to the 3rd party repo in Nexus. Im not able to access the uploaded jar from Maven. Im on a proxy so I have given the following settings in my settings.xml optional true http myproxy portno username password <servers> thirdparty admin admin123 snapshots admin admin123 <servers> nexus true central http://central true true central http://central true true And in my pom.xml I have mentioned the following: com.custom test-impl 1.1 <distributionManagement> thirdparty http://localhost:8080/nexus/content/repositories/thirdparty </distributionManagement> And, I get an error near the dependency tag as follows: Missing artifact com.custom:test-impl:jar:1.1 I have uploaded the jar directly into the 3rd party as I dont have its POM. Im using Eclipse. Can you please help me access this jar uploaded to 3rd party from Maven's POM.xml?
has comment: http://stackoverflow.com/comment/36495850
answer count: 0
tagged with: maven
type: Question
has title: Not able to access 3rd party in Nexus from Maven
tagged with: java
tagged with: eclipse
score: 0

http://stackoverflow.com/comment/36290336
score: 0
has text: @Duncan the author's question was about storing the character, not about the correctness of the code above. So, this code might (should) be corrected.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23633572

http://stackoverflow.com/comment/36266876
type: QuestionComment
has text: This might be a duplicate (but I didn't find one after a moment of searching), but even if it is, this is a well written question that clearly shows the output that you're interested in, and the full code that reproduces it. Well done!
score: 0
comment on: http://stackoverflow.com/q/23621321
type: Comment

http://stackoverflow.com/comment/36268399
comment on: http://stackoverflow.com/q/23622112
score: 0
type: QuestionComment
has text: can you provide an example of what do you expect to be printed?
type: Comment

http://stackoverflow.com/comment/82431864
type: Comment
score: 1
has text: This can cause NPE if HTTP response body was empty (not `[]` but totally empty). So be careful and check for `null` (`if (forNow != null)...`).
comment on: http://stackoverflow.com/a/26796142
type: AnswerComment

http://stackoverflow.com/comment/36439303
comment on: http://stackoverflow.com/a/23702613
score: 0
type: AnswerComment
has text: Thanks for the idea. By the way I have injected `org.springframework.validation.Validator` instead of `LocalValidatorFactoryBean` and it worked fine.
type: Comment

http://stackoverflow.com/q/23716000
has comment: http://stackoverflow.com/comment/36448863
tagged with: debugging
has comment: http://stackoverflow.com/comment/36448624
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23716502
score: -3
has title: java.lang.StringIndexOutOfBoundsException - just at a particular point of the app...why?
has comment: http://stackoverflow.com/comment/36449521
has comment: http://stackoverflow.com/comment/36449112
upvote count: 0
has comment: http://stackoverflow.com/comment/36449276
has comment: http://stackoverflow.com/comment/36448956
favorite count: 0
has comment: http://stackoverflow.com/comment/36449244
has body: I got an java.lang.StringIndexOutOfBoundsException at this line: timer.start(); in this method: @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { switch(parent.getId()){ case R.id.list_subject: quizWorld.setSubject(quizWorld.getSubjects().get((int) id)); ArrayAdapter&lt;String&gt; adapter2 = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.listItem, quizWorld.getCategories()); list_category.setAdapter(adapter2); state = GameState.Category; viewSlider.next(); break; case R.id.list_category: quizWorld.setCategory(quizWorld.getCategories().get((int) id)); quizWorld.swapQuestion(); state = GameState.Running; timer.start(); viewSlider.next(); break; } } The weired thing is when I call "timmer.start();" anywhere else in an other method it works. And even if I use the debugger I got no error. Only in this particular method and only in the normal mode not in the Debugger mode. The code of the class of the object timer: public class TimerView extends TextView{ private Handler handler = new Handler(); private long startTime; private long elapsedTime; private final int REFRESH_RATE = 100; private String hours,minutes,seconds,milliseconds; private long secs,mins,hrs; private boolean stopped = false; public TimerView(Context context){ super(context); } public TimerView (Context context, AttributeSet attrs) { super(context, attrs); } public TimerView(Context context, AttributeSet attrs, int defStyle){ super(context, attrs, defStyle); } public void start(){ if(stopped){ startTime = System.currentTimeMillis() - elapsedTime; } else{ startTime = System.currentTimeMillis(); } handler.removeCallbacks(startTimer); handler.postDelayed(startTimer, 0); } public void stop(){ handler.removeCallbacks(startTimer); stopped = true; } private Runnable startTimer = new Runnable() { public void run() { elapsedTime = System.currentTimeMillis() - startTime; updateTimer(elapsedTime); handler.postDelayed(this,REFRESH_RATE); } }; private void…
type: Question
tagged with: exception
tagged with: android
has comment: http://stackoverflow.com/comment/36449078
has comment: http://stackoverflow.com/comment/36448893
tagged with: view
tagged with: java
downvote count: 3
answer count: 1

http://stackoverflow.com/comment/36343020
comment on: http://stackoverflow.com/a/23660339
has text: Thats a valid point that i need to use formatting if i want to do indentation. Actually i want to display warning if somebody adds 4 spaces instead of 2 space on applying checkstyles.I updated my question.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36635745
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23744049
type: QuestionComment
has text: I don't have out of the box example for Swing, but I did use this pattern on Android. I'll need some time to convert it to Swing. The biggest problem will be to make sure that the callback is running on the EDT.

http://stackoverflow.com/a/23748602
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23748450
has body: The for-loop advances while you're deleting a character. So another character will be on the index position that you've just passed. An fix would be: public static String removeMultipleCharsFromStr(String str,char temp) { StringBuffer sb = new StringBuffer(); for(int i=0;i&lt;str.length();i++) { sb.append(str.charAt(i)); } for(int i=0;i&lt;sb.length();i++) { if(Character.toLowerCase(sb.charAt(i)) == Character.toLowerCase(temp)) { sb.deleteCharAt(i); i--; } } System.out.println("Final string: " +sb.toString()); return sb.toString(); } Although you might consider using the standard replacement methods as suggested in the comments: str.replaceAll(String.valueOf(temp),"")

http://stackoverflow.com/comment/36281127
comment on: http://stackoverflow.com/a/23628799
type: AnswerComment
has text: more precisely which build tool you r using
score: 0
type: Comment

http://stackoverflow.com/comment/38303733
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24687582
type: Comment
has text: Thanks Marcin I have used PigAvroInputFormat bundled with Pig AvroStorage.

http://stackoverflow.com/a/50214388
has body: Good solutions here, but I want to add another one that taking into consideration handling null values: Map&lt;String,Object&gt; map = new HashMap&lt;&gt;(); Map&lt;String,String&gt; stringifiedMap = map.entrySet().stream() .filter(m -&gt; m.getKey() != null &amp;&amp; m.getValue() !=null) .collect(Collectors.toMap(Map.Entry::getKey, e -&gt; (String)e.getValue()));
downvote count: 0
answers question: http://stackoverflow.com/q/23721355
score: 2
upvote count: 2
type: Answer

http://stackoverflow.com/q/23717572
has answer: http://stackoverflow.com/a/23717677
has comment: http://stackoverflow.com/comment/36451834
type: UnansweredQuestion
tagged with: io
upvote count: 2
has comment: http://stackoverflow.com/comment/36451843
score: 1
tagged with: java
tagged with: file
downvote count: 1
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/36451826
has title: Need help reading words between <> and saving to array
has body: Hello all I am trying to take a predetermined .txt file as shown below and read only the words between the &lt; >, then add them to an array and write them to an HTML file. the txt file is as follows. for some reason its not showing the words in-between the &lt; > on here. "" = word between &lt; &gt; A, &lt;"""&gt; B, &lt;"""&gt; C, &lt;"""&gt; etc. here is my current code for attempting to read from the file, I understand the .split and .delimeter problem is these methods read everything before the chosen character. import java.io.*; import java.util.Scanner; public class TickTacTwice { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File("/Users/Muhammed/Documents/tic_tac_twice.txt")); while(sc.hasNextLine()) { String S = sc.nextLine(); String [] words = S.split("&lt;"); System.out.println(words[0]); } sc.close(); } } Any help would be much appreciated. Thanks
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23624186
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/73565249
tagged with: timeout
type: Question
possible better answer: http://stackoverflow.com/a/35097798
upvote count: 2
answer count: 3
tagged with: junit
has title: How do I apply my JUnit rules in a specific order?
favorite count: 0
has answer: http://stackoverflow.com/a/35097798
has answer: http://stackoverflow.com/a/23624437
accepted answer: http://stackoverflow.com/a/23624437
has body: We have a timeout enforced per-test via a test rule: public abstract class BaseTestCase { @Rule public final Timeout timeout = new Timeout(60*1000); } Then our GUI tests obviously have to run on the EDT, so they have a test rule for that too: public class TestSomeController extends BaseTestCase { @Rule public final RunOnEventDispatchThread runOnEventDispatchThread = new RunOnEventDispatchThread(); @Test public void testStuff() { /* ... */ } } Both of these rules involves messing with the thread the test runs on. Timeout creates a new thread and then kills it N milliseconds later. RunOnEventDispatchThread runs a Runnable on the EDT and then waits for the task to complete. Up to JUnit 4.10 this has been working fine, but we just upgraded to JUnit 4.11 and now it seems that the ordering of test rules has changed. The current JUnit seems to be applying the rules in "logical" order, so it applies Timeout and then RunOnEventDispatchThread. This means that RunOnEventDispatchThread ends up on the "outside" of the Statement "onion". So it runs the task on the EDT, but that task is now "spawn a new thread to run the test" - because it's spawning a new thread, the test fails, because Swing calls are now being called on the wrong thread. Obviously JUnit 4.10 was running the test rules in another order. Is there a way to influence this? Note that existing answers to this sort of question have all been addressed by using RuleChain. As far as I can tell, we cannot use RuleChain because that class demands both rules to be in the same class, and ours are not.

http://stackoverflow.com/comment/36410696
has text: @user3589718 yes, you are right. How i said - it's convetional and only way how to name them.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23695860
type: AnswerComment

http://stackoverflow.com/comment/36466490
has text: Nice catch! Strangely, I've already guessed that it was related with pre alpha multipliying, but I didn't realize the AlphaComposite thing. Strangely, this does not seem to fully explain the problem of the previous question... still looking...
type: Comment
comment on: http://stackoverflow.com/a/23725014
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36541639
score: 0
has text: On first looks, this is exactly what I am looking for. I will take a closer look and probably mark this as the right answer within an hour or so.
type: Comment
comment on: http://stackoverflow.com/a/23764556
type: AnswerComment

http://stackoverflow.com/q/23667084
has title: Make 2 classes share the same instance of an object in Java
has answer: http://stackoverflow.com/a/23667141
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has comment: http://stackoverflow.com/comment/36356304
has body: I was wondering if anyone could help me. I am stuck with something that seems simple. Say I initialize a Student object with the values of name, age and address in one class. How can I share THAT INSTANCE with another class, eg enable methods in the second class to make changes to the instance, thereby affecting the first class etc. I was thinking of using JFrames where a new frame would popup and a button would affect values on the first frame. Thank you
favorite count: 0
has answer: http://stackoverflow.com/a/23667135
upvote count: 0
tagged with: instance
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
downvote count: 1
type: Question
tagged with: object
tagged with: java
score: -1

http://stackoverflow.com/q/23727101
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36473549
has title: Locating Dropbox folder
favorite count: 0
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/12118162
upvote count: 1
has answer: http://stackoverflow.com/a/23727254
downvote count: 1
has comment: http://stackoverflow.com/comment/36470764
type: Question
accepted answer: http://stackoverflow.com/a/23727254
has body: I am working on a personal project in java that will (in theory) use a file in dropbox for data storage and it will be edited across multiple computers and devices. However, these device will not necessariyl have the same file structure due to OS Differences (Linux, Win8, Win7). How would I get the location of the dropbox folder within the code in java? I looked online already and found this regarding doing this in python as well as a c# example linked in the python example, but am not sure how to apply that in java.

http://stackoverflow.com/a/23631351
type: AcceptedAnswer
upvote count: 18
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/90211994
accepted answer of: http://stackoverflow.com/q/23630668
score: 18
answers question: http://stackoverflow.com/q/23630668
has body: static String[][][] School= new String[1000][20][5]; Consider figure which has 3 Dimension. So when you insert School[0][0][0]="A1" it means you have entered element at 0,0,0 position. From 0,0,0 this will move upto the position 1000,20,5. You can insert like this But you have so many elements. School[0][0][0]="A1" School[0][0][1]="A2" School[0][0][2]="A3" ..... School[0][1][0]="B1" School[0][1][1]="B2" School[0][1][2]="B3" ...... In 3D array elements look like int[3][4][2] array3D // means Three (4x2) 2 Dimensional Arrays int[4][2] //means Four 1 dimensional arrays. Now how to add elements in 3D array? At Start you can directly use int[][][] threeDArray = { { {1, 2, 3}, { 4, 5, 6}, { 7, 8, 9} }, { {10, 11, 12}, {13, 14, 15}, {16, 17, 18} }, { {19, 20, 21}, {22, 23, 24}, {25, 26, 27} } }; This is very tedious task in your case as you want to insert details at every position. As you have 1000 records. Your array will have elements like this NOTE:It's not recommended to use 3D array for this purpose. Suggestion:Declare a class with three Strings create constructor with this three parameters and put getter and setters to get and set values via Objects

http://stackoverflow.com/comment/36309041
type: QuestionComment
has text: Most people advise against storing sensitive information in the client, such as Database username/password. You don't need to decompile an entire application to find specific strings of text.
score: 1
comment on: http://stackoverflow.com/q/23642936
type: Comment

http://stackoverflow.com/q/23750284
tagged with: libgdx
score: 1
tagged with: java
tagged with: eclipse
upvote count: 1
answer count: 1
favorite count: 0
has body: I'm trying to connect my app to facebook by sharing highscores and google play link of my app. but the tutorials that I got from the web are all outdated. Does anybody tried this with new facebook sdk? or any link that can help me with this. Thank you!
tagged with: android
tagged with: facebook
downvote count: 0
type: UnansweredQuestion
has title: Facebook intergration with Libgdx
has answer: http://stackoverflow.com/a/23751529
type: Question
linked to: http://stackoverflow.com/q/17005926

http://stackoverflow.com/comment/36283685
has text: Ok, @Bruno meanwhile has posted an answer naming the method to *retrieve the current y position* with. *And i use Times New Roman , sizes and spacing will be default ones* - I don't know those default values, and neither do I know the exact algorithms iText uses while doing layouts. As an estimate I'd simply subtract the bottom y coordinate of the layout region from that current y coordinate and divide this by the font size. The bottom of the layout region should be the bottom of the media box (most often 0) plus the bottom margin.
comment on: http://stackoverflow.com/q/23624285
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36285571
comment on: http://stackoverflow.com/a/23631363
type: AnswerComment
score: 0
has text: It won't be worse than closures in Java 8 :-D
type: Comment

http://stackoverflow.com/comment/36525294
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23755874
has text: read timeout means no connection with remote server... mayby you should provide better try/catch and open/close for inputstreams and not to have this kind of problems (I think 99% of problems comes from closing properly streams).

http://stackoverflow.com/q/23659736
tagged with: java
tagged with: filewriter
type: Question
tagged with: google-analytics
score: 0
has body: Hi all i am using the google analytics api to export some queries to a CSV i am currently having issues with using this code PrintWriter pw = null; try { PrintWriter pw = new PrintWriter(BufferedWriter(new FileWriter("data.csv"))); } catch(Exception e) { e.printStackTrace(); } it keeps telling me that "Multiple markers at this line The method BufferedWriter(FileWriter) is undefined for the type HelloAnalyticsApiSample Duplicate local variable pw" Thanks all
answer count: 1
has answer: http://stackoverflow.com/a/23659761
tagged with: http://stackoverflow.com/tag/csv
has title: Using printwriter with google analytics api to generate CSV file
type: UnansweredQuestion

http://stackoverflow.com/a/23745376
type: AcceptedAnswer
has body: Your @OneToMany association is missing cascading configuration. Add cascade = CascadeType.ALL or cascade = {CascadeType.PERSIST, CascadeType.MERGE} to the @OneToMany annotation. JPA assumes no cascading by default so you would need to persist each EvaluationEvaluator by yourself explicitely otherwise. UPDATE There is another thing wrong with the code - the Ids of EvaluationEvaluators are never assigned. You have a complex key made of two Long columns. Both are marked not insertable nor updatable which tells to JPA that the id is going to be somehow generated on database level and it should not care about it. There is however no sequence configured explicitely in your entity (although it is not necessarily required) and also from your comment: I did what you recommended but it throws the following exception. "A different object with same identifier was already associated with the session" I assume that this is not the case and both id column values default to null or zero and are same for all EvaluationEvaluators you are trying to persist. If you'd like the database to generate the id for you automatically use @GeneratedValue - Configure JPA to let PostgreSQL generate the primary key value - here you can find explanation how to do this (the database part is database dependent, this is for PostgreSQL). The most common use case however, is to configure the sequence but let hibernate pick the next value, instructions here - Hibernate sequence on oracle, @GeneratedValue(strategy = GenerationType.AUTO)
score: 0
has comment: http://stackoverflow.com/comment/36531534
has comment: http://stackoverflow.com/comment/36506526
type: Answer
has comment: http://stackoverflow.com/comment/36548616
has comment: http://stackoverflow.com/comment/36506918
accepted answer of: http://stackoverflow.com/q/23743866
answers question: http://stackoverflow.com/q/23743866

http://stackoverflow.com/comment/65030528
type: Comment
comment on: http://stackoverflow.com/a/23632039
score: 0
type: AnswerComment
has text: No, I modified the implementation. Instead of dealing with extraction in FileExtractorSavor, the data from individual archive files were read first into a string then these strings were processed in parallel.

http://stackoverflow.com/q/23716929
type: Question
has answer: http://stackoverflow.com/a/23716957
tagged with: java
tagged with: transform
answer count: 2
has title: Java, How to convert a string into an Array
tagged with: arrays
downvote count: 0
score: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/23716957
has body: I've got a string, for example: String code = new String("[199, 56, 120]") My goal is to create and Array that contains only the numbers inside the [] and beetween commas; In this case it would be for example: array[0] = 199 array[1] = 56 array[2] = 120 Is possible to do something like this?? Thanks in advance.
possible better answer: http://stackoverflow.com/a/23717155
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23717155
upvote count: 1

http://stackoverflow.com/q/23767505
has comment: http://stackoverflow.com/comment/36547732
tagged with: decimal
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/23768108
downvote count: 0
possible better answer: http://stackoverflow.com/a/23767884
has answer: http://stackoverflow.com/a/23767884
favorite count: 0
has body: I am writing a small physics app. What I am planning to do is to make number rounding. The issue is that it is not a fixed rounding, but rather a variable rounding that depends on the value of the decimal digits. I will give an explanation for the issue. I always need to keep the whole integer part (if any) and the first five decimal digits (if any). half up rounding is always used. 21.1521421056 becomes 21.15214 34.1521451056 becomes 34.15215 If the result consists of only decimal digits then: If the first five digits include non zero digits then keep them. 0.52131125 becomes 0.52131 0.21546874 becomes 0.21547 0.00120012 becomes 0.0012 If the first five digits are all zero digits 0.00000 then go down to first five digits that include non zero digits. 0.0000051234 becomes 0.0000051234 0.000000000000120006130031 becomes 0.00000000000012001 I need to play this rounding while working with BigDecimal because it is a requirement for my needs.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36550124
accepted answer: http://stackoverflow.com/a/23768108
tagged with: java
has title: In Java, how to achieve this type of number rounding?
type: Question
tagged with: rounding
upvote count: 5
has comment: http://stackoverflow.com/comment/36547742
has comment: http://stackoverflow.com/comment/36547433

http://stackoverflow.com/q/23646853
tagged with: ajax
has comment: http://stackoverflow.com/comment/36325598
has title: Struts 2.0 action method called without actually invoking
has comment: http://stackoverflow.com/comment/37483838
has comment: http://stackoverflow.com/comment/36325858
has comment: http://stackoverflow.com/comment/36323920
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36326804
has comment: http://stackoverflow.com/comment/36324483
has comment: http://stackoverflow.com/comment/36329176
tagged with: java
has body: Found a strange issue in Struts action, The scenario is like below , When I was in employees.jsp which just shows list of employees fetched from server , when an employee div is clicked, I will create a dynamic form as "employeeDetailsForm" in a javascript method, which has a hidden input field that holds value of employee code, And I attached an action to the form as "getEmployeeDetails", when an employee div is clicked It will submit the action and navigates to the employeeDetails.jsp, In employeeDetails.jsp I will show set of details of that particular employee. for his list of achievements I have upVote feature. so when I click on upVote, upVote action gets called using ajax in a js method. When upVote action is success , immediately again "getEmployeeDetails" action is getting called which is a strange behaviour. I am not able to backtrace the call stack since many system defined methods are shown, I just cross checked whether my "employeeDetailsForm" is exist in second jsp page as well and some how the form is being submitted somewhere ? but when I checked inspector in browser, that form element was not there at all, I also checked by calling document.getElementById("employeeDetailsFormId") which returned null Then from where this method is getting called ? How to trace this issue ? Update - Source code for reference in employees.jsp - JS method to submit form to fetch details var empDetForm = document.createElement("form"); empDetForm.id=“empDetailsId”; empDetForm.name=“employeeDetailsForm"; empDetForm.method="POST"; empDetForm.action="getEmployeeDetails"; var empCodeinput = document.createElement("input"); empCodeinput.setAttribute("type","hidden"); empCodeinput.id= empCode; empCodeinput.name=“empCode”; empDetForm.appendChild(empCodeinput); empDetForm.submit(); In employeeDetails.jsp - JS method to call upvote service using ajax var formdata = "isUpVote="+isUpVote+”&”+”selectedAchievement="+achievementId; $.ajax({ type: 'POST', url: ‘achievementUpVote’, cont…
tagged with: struts2
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36327469
has comment: http://stackoverflow.com/comment/36330661
tagged with: jsp
has comment: http://stackoverflow.com/comment/36327646

http://stackoverflow.com/comment/36342580
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23658623
has text: OK, fair enough. But why two separate windows?
score: 0

http://stackoverflow.com/q/23706064
score: 0
has title: Java Swing: JPanel only adds components when JFrame window is maximized or it's size changed
answer count: 1
has answer: http://stackoverflow.com/a/23706068
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: I have a Java program that creates a JFrame, a JPanel, and several JTextAreas. I set the text of the JTextAreas and then add them to the JPanel. When the program loads, I only see the empty JFrame. However, if I maximize, or change the size of the program window, the JTextAreas, and their respective texts appear on the screen. How can I correct this so that the program loads, with the text areas populated, without the need to mess with the window? My apologies in advance for being a Swing noob.
type: Question
accepted answer: http://stackoverflow.com/a/23706068
tagged with: jtextarea
tagged with: jpanel

http://stackoverflow.com/comment/36417914
has text: The Java compiler itself will **not** perform inlining in the way that you described. It could *theoretically* do this if the method was `private`, but even then, it will not do such a change, because it has to preserve the structure of the class (for example, for the case that the method is accessed via reflection). Inlining is done by the JIT.
comment on: http://stackoverflow.com/a/23698922
score: 3
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23662070
answers question: http://stackoverflow.com/q/23661024
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36346875
upvote count: 3
has comment: http://stackoverflow.com/comment/36346729
type: Answer
has body: This looks like a known bug: RT24636. It is fixed in the latest release (Java 1.8.0_05). No workaround is posted on the JIRA and none comes to mind immediately.
downvote count: 0
has comment: http://stackoverflow.com/comment/36346973
accepted answer of: http://stackoverflow.com/q/23661024
score: 3

http://stackoverflow.com/comment/36450672
type: AnswerComment
type: Comment
has text: This would be perfect. But the array should be an int array instead of a string array.. how can fix it??
score: 1
comment on: http://stackoverflow.com/a/23716957

http://stackoverflow.com/comment/36520780
comment on: http://stackoverflow.com/a/23753603
score: 0
type: AnswerComment
has text: This solution is just working fine. He used BigDecimals in order to do the formatting.
type: Comment

http://stackoverflow.com/comment/36457914
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23718986
has text: The 'parent class name' doesn't appear to have any relevance. What you need is the name of the calling class, whatever it may be, and you can get all that from the stack trace.
type: Comment

http://stackoverflow.com/q/23745914
linked to: http://stackoverflow.com/q/5360854
has comment: http://stackoverflow.com/comment/36507812
answer count: 1
has comment: http://stackoverflow.com/comment/36507485
favorite count: 0
has comment: http://stackoverflow.com/comment/36507573
has comment: http://stackoverflow.com/comment/36540199
has answer: http://stackoverflow.com/a/23746834
has body: I want to attached the progress bar to the Frame and not the test start button that I have currently. The progress bar works but I want it run when the window is opened for the time being and then I can attach it to whatever I want later on. Code: import java.awt.Component; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.JProgressBar; import javax.swing.JButton; public class ProgressBarWindow extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ProgressBarWindow frame = new ProgressBarWindow(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public ProgressBarWindow() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 183); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JProgressBar progressBar = new JProgressBar(); progressBar.setBounds(22, 77, 386, 27); contentPane.add(progressBar); JButton btnNewButton = new JButton("Cancel"); btnNewButton.setBounds(319, 111, 89, 23); btnNewButton.addMouseListener(new myMouseListener2()); contentPane.add(btnNewButton); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new btnDoAction(progressBar)); btnStart.setBounds(220, 111, 89, 23); contentPane.add(btnStart); } } class myClose implements MouseListener { myClose() { } @Override public void mouseClicked(MouseEvent e) { final Component source = e.getComponent(); final JFrame frame…
tagged with: swing
has comment: http://stackoverflow.com/comment/36507631
has comment: http://stackoverflow.com/comment/36507604
has comment: http://stackoverflow.com/comment/36507850
has comment: http://stackoverflow.com/comment/36508557
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36508520
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/24835638
upvote count: 1
accepted answer: http://stackoverflow.com/a/23746834
type: Question
downvote count: 0
has title: How can I attach the progress bar to when the JFrame Opens?

http://stackoverflow.com/q/23672720
has comment: http://stackoverflow.com/comment/36366762
has title: Generic static Method in Java
has comment: http://stackoverflow.com/comment/36366748
has answer: http://stackoverflow.com/a/23673882
has comment: http://stackoverflow.com/comment/36366644
downvote count: 0
score: 1
tagged with: generics
has answer: http://stackoverflow.com/a/23673666
has comment: http://stackoverflow.com/comment/36366794
favorite count: 0
has comment: http://stackoverflow.com/comment/36366606
has comment: http://stackoverflow.com/comment/36366714
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36366582
has comment: http://stackoverflow.com/comment/36366917
has comment: http://stackoverflow.com/comment/36366550
has answer: http://stackoverflow.com/a/23673209
answer count: 4
has body: I want a generic method which fills a List with objects which are inherite from the class Element My code look like this: public static &lt;T extends Element&gt; List&lt;T&gt; getElement(ElementType type){ List&lt;T&gt; elements = new ArrayList&lt;&gt;(); switch(type){ case LIGHT: elements.add(new Light(id,bezeichnung,beckhoffVars, false)); break; case LIGHTDIM: elements.add(new LightDim(id,bezeichnung,beckhoffVars, false, 0)); break; return elements; } But the Compiler says: The method add(T) in the type List is not applicable for the arguments (Light) The method add(T) in the type List is not applicable for the arguments (LightDim)
has comment: http://stackoverflow.com/comment/36366545
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/23673350
type: Question
has comment: http://stackoverflow.com/comment/36366565
tagged with: java

http://stackoverflow.com/a/23714920
upvote count: 2
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36446825
score: 1
answers question: http://stackoverflow.com/q/23714853
has body: There is no such thing - you don't use pointers or free objects the moment you're done with them in Java. Well, you can do that, but chances are - you'd be doing it wrong. If you must do something when all threads are finished with handling an object, you should track its use yourself and clean up when you're done.

http://stackoverflow.com/q/23728670
tagged with: java
has body: In the data node of Hadoop, there always exists the block file which contains the raw bytes of the data and also the metadata file with the generated stamp and the .meta as extension. I tried to open the meta data in vi and it looks like gibberish content. I am assuming it is some sort of serialized binary format. I took a look at the source code of HDFS and feel like org.apache.hadoop.hdfs.server.datanode.BlockMetadataHeader.readHeader is the most likely approach to read the metadata. I downloaded one of the meta files locally and wrote some code in Eclipse. package com.bw; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.hadoop.hdfs.server.datanode.BlockMetadataHeader; public class Test { public static void main(String[] args) { DataInputStream input = null; BlockMetadataHeader header = null; try { input = new DataInputStream( new FileInputStream("C:/Users/bw/Desktop/blk_1116668343556322736_1551688.meta")); } catch (FileNotFoundException e) { e.printStackTrace(); } try { BlockMetadataHeader.readHeader(input); } catch (IOException e) { e.printStackTrace(); } System.out.println(header.getChecksum()); } } However, the syntax was right but it errors out with the following message. java.io.IOException: Could not create DataChecksum of type 2 with bytesPerChecksum 512 at org.apache.hadoop.util.DataChecksum.newDataChecksum(DataChecksum.java:86) at org.apache.hadoop.hdfs.server.datanode.BlockMetadataHeader.readHeader(BlockMetadataHeader.java:100) at org.apache.hadoop.hdfs.server.datanode.BlockMetadataHeader.readHeader(BlockMetadataHeader.java:75) at com.bwang.Test.main(Test.java:27) Exception in thread "main" java.lang.NullPointerException at com.bwang.Test.main(Test.java:32) I searched for the error and barely find any helpful resource. Can anyone help me how to read the metadata of block metadata file? Update, after all, it is the mismatch between the …
has title: Use java to read hdfs blk_.meta file
accepted answer: http://stackoverflow.com/a/23728788
type: Question
tagged with: hadoop
score: 2
downvote count: 0
answer count: 1
tagged with: hdfs
favorite count: 0
has answer: http://stackoverflow.com/a/23728788
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/36429639
type: Comment
comment on: http://stackoverflow.com/q/23705777
has text: Please share the code that you have tried already.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23698534
favorite count: 0
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/32937848
type: Question
score: 5
has title: eclipse try-with-resource template?
upvote count: 5
tagged with: eclipse
has body: Eclipse supports try-with-resource, somewhat like this: try(Outputstream resource = new FileOutputStream(file)){ // do something... } It has been years since this featured added to eclipse, but there is no template "try-with-reousource". only exists one is "try-catch". I tried to make template, like try($type{} ${localVar} = new $type{}){ {$cursor{} }, but was useless. (non-AutoClosable types were also suggested) Is there any useful try-with-resource template?
tagged with: try-with-resources
has answer: http://stackoverflow.com/a/70316779
answer count: 2
downvote count: 0
tagged with: templates
possible better answer: http://stackoverflow.com/a/70316779
has answer: http://stackoverflow.com/a/32937848

http://stackoverflow.com/comment/36346707
comment on: http://stackoverflow.com/a/23644379
type: Comment
has text: Yes... checkboxes are probably a better way to go. That's about as obvious as you can make it for your users ;).
type: AnswerComment
score: 0

http://stackoverflow.com/a/23763951
has comment: http://stackoverflow.com/comment/36547710
answers question: http://stackoverflow.com/q/23763085
has body: Following code parse using apache digester which is commonly used while parsing in real projects. Nice one from apache community // Updated code as per you need. import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import org.apache.commons.digester.Digester; import org.apache.commons.digester.Rule; import org.apache.commons.digester.Rules; import org.xml.sax.InputSource; public class Parsing { public static void main(String[] args) throws Exception{ InputStream data = new FileInputStream("E:\\workspace\\trunk\\Parsing\\src\\data.xml"); byte[] b = new byte[data.available()]; // data.read(b); Digester digester = new Digester(); //Genearting Array list while encountering dblp xpath digester.addObjectCreate("dblp", HashMap.class); digester.addObjectCreate("dblp/inproceedings", ArrayList.class); //Calling add method while encountering author xpath AuthorRule rule = new AuthorRule(); digester.addRule("dblp/inproceedings/author", rule); digester.addRule("dblp/inproceedings/title", rule); digester.addRule("dblp/inproceedings", rule); HashMap parsedData = (HashMap) digester.parse(data); Iterator&lt;Entry&lt;String, ArrayList&gt;&gt; dataItr = parsedData.entrySet().iterator(); while(dataItr.hasNext()){ Entry&lt;String, ArrayList&gt; entry = dataItr.next(); System.out.println("Title : " + entry.getKey() + ", Authors" + entry.getValue().toString()); } } private static class AuthorRule extends Rule{ String currentTitle = ""; @Override public void body(String namespace, String name, String text) throws Exception { HashMap object = (HashMap) digester.peek(1); ArrayList authors = (ArrayList) digester.peek(0); if(name.equals("title")){ currentTitle = text; } else if(name.equals("author")){ authors.add(text); } } @Override public void end(String namespace, String name) throws Exception { HashMap object = (Hash…
has comment: http://stackoverflow.com/comment/36541404
has comment: http://stackoverflow.com/comment/36573762
downvote count: 0
has comment: http://stackoverflow.com/comment/36561542
type: Answer
has comment: http://stackoverflow.com/comment/36540150
score: 1
upvote count: 1

http://stackoverflow.com/q/23737265
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/1679421
duplicate of: http://stackoverflow.com/q/1679421
downvote count: 0
accepted answer: http://stackoverflow.com/a/23737422
has answer: http://stackoverflow.com/a/23737521
score: 2
type: AnsweredQuestion
tagged with: android
has title: Get type of array of class using Java reflection
has answer: http://stackoverflow.com/a/23737492
has body: In my android project I want to write a function which should return type of array of class as, Class getClassArrayType(String strClassName) { //some code return class; } if I pass "Task" as a class name to above function it should return Task[].class. How can i do this? I have read about the reflection but it confused me a lot! Please Help me.
favorite count: 0
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/23737492
has comment: http://stackoverflow.com/comment/36489897
has answer: http://stackoverflow.com/a/23737422
tagged with: reflection

http://stackoverflow.com/a/23683090
has body: The web server may contain a code to block not authorized user-agent. I guess you can verify this by making sure your program will send a standard User-Agent value (i.e. corresponding to an existing web browser) and see if it makes any difference.
downvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23682679
answers question: http://stackoverflow.com/q/23682679
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36396718
upvote count: 2

http://stackoverflow.com/a/23649016
has comment: http://stackoverflow.com/comment/36320535
upvote count: 1
has body: Just a pointer for you to work on. output_harm[][] outputs = new output_harm[7][6]; outputs[0][0] = new output_harm(); outputs[0][0].state[0] = 0; outputs[0][0].state[1] = 1;
has comment: http://stackoverflow.com/comment/36320692
downvote count: 0
answers question: http://stackoverflow.com/q/23648841
type: Answer
score: 1

http://stackoverflow.com/comment/36481714
has text: How big is the image? Remove the `adjustViewBounds` attribute.
comment on: http://stackoverflow.com/q/23732276
score: 0
type: Comment
type: QuestionComment

couchbase
tags question: http://stackoverflow.com/q/23648108
tags question: http://stackoverflow.com/q/23628742
tag name: couchbase
type: Tag

http://stackoverflow.com/q/23721291
tagged with: java
type: Question
has title: Java Applet using local scanner not working and no errors
has comment: http://stackoverflow.com/comment/36485268
tagged with: eclipse
has comment: http://stackoverflow.com/comment/66748784
score: 0
has comment: http://stackoverflow.com/comment/36485387
tagged with: applet
has comment: http://stackoverflow.com/comment/36485252
type: UnansweredQuestion
tagged with: native-code
has body: I am a newbie in Java but I need to make a scanner (that has a built in ocr) output some content to a browser. I haven't gotten to the browser yet, but the code works when I run it as an application. With the scanner, I received Java code that makes the scanner take a picture, then read from it and output it back to the console. I added a few lines to make it an applet: import gx.*; import pr.*; import java.applet.*; public class DocScan extends Applet { /** * */ private static final long serialVersionUID = 1L; static { try { System.loadLibrary("jgx"); System.loadLibrary("jpr"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load." + e); System.exit(1); } } public static void main(String argv[]) { Lib lib = new Lib(); String text; String[] ec ={ "Ok", "Warning", "Error" }; try { /* Opening the PR system */ lib.FunctionStart("Opening system files"); PassportReader pr = new PassportReader(); /* Object for the PR system */ lib.FunctionEnd(); /* Validity check */ if (!pr.IsValid()) { lib.Error("Failed to initialize!"); lib.PrintStat(); } /* Connecting to the first device */ lib.FunctionStart("Connecting to the first device"); pr.UseDevice(0, jpr.PR_UMODE_FULL_CONTROL); lib.FunctionEnd(); /* Using the device */ while (!lib.KbHit()) { lib.ProcessStart("Processing document"); try { /* Capturing images */ lib.FunctionStart("Capturing images"); pr.Capture(); lib.FunctionEnd(); /* Getting document data */ lib.FunctionStart("Recognizing."); prDoc doc = pr.Recognize(0); lib.FunctionEnd(); if (!doc.IsValid()) lib.WriteLine("No data found."); else { /* Displaying document type */ lib.WriteLine("Document type: " + doc.Code() + ", status: " + ec[doc.Status() / 100]); /* Get some fixed fields and displaying them */ text = doc.Field(jpr.PR_DF_NAME); if (!text.equals("")) lib.WriteLine("NAME \"" + text + "\" [" + ec[doc.FieldStatus(jpr.PR_DF_NAME) / 100] + "]"); text = doc.Field(jpr.PR_DF_DOCUMENT_NUMBER); if (!text.equals("")) lib.WriteLine("DOCU…
answer count: 0

http://stackoverflow.com/q/23630710
tagged with: java
has comment: http://stackoverflow.com/comment/36284792
type: Question
tagged with: hashmap
score: -1
has comment: http://stackoverflow.com/comment/36285310
tagged with: sqlite
answer count: 1
downvote count: 1
favorite count: 0
has body: I've been trying for almost a day to fix this problem but I cannot figure out what is wrong. I got this code private void someFunction() { listDataHeader = new ArrayList&lt;String&gt;(); listDataChild = new HashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; tempNomoi = new ArrayList&lt;String&gt;(); List&lt;GeneralInfo&gt; diamerismata = db.getAllDiamerismata(); List&lt;GeneralInfo&gt; nomoi = new ArrayList&lt;GeneralInfo&gt;(); for (GeneralInfo a : diamerismata) { listDataHeader.add(a.getDiamerisma()); nomoi = db.GetNomousDiamerismatos(a.getDiamerisma()); tempNomoi.clear(); for (GeneralInfo b : nomoi) { tempNomoi.add(b.getNomo()); } listDataChild.put(a.getDiamerisma(), tempNomoi); System.out.println(listDataChild); } } And I get this output I/System.out(5750): SELECT nomos FROM info WHERE diamerisma = 'diamerisma1' I/System.out(5750): {diamerisma1=[nomos1, nomos3, nomos5]} I/System.out(5750): SELECT nomos FROM info WHERE diamerisma = 'diamerisma2' I/System.out(5750): {diamerisma2=[nomos2, nomos4], diamerisma1=[nomos2, nomos4]} I/System.out(5750): SELECT nomos FROM info WHERE diamerisma = 'diamerisma3' I/System.out(5750): {diamerisma2=[nomos6], diamerisma3=[nomos6], diamerisma1=[nomos6]} (the select statements come from the functions responsible for managing the queries) As you can see from the output, after each loop the values are getting overwriten by the new ones... I wanted to have {diamerisma1=[nomos1, nomos3, nomos5], diamerisma2=[nomos2, nomos4], diamerisma3=[nomos6]} Maybe there is something I miss about how HashMaps work... I would really appreciate if someone could point out where I am wrong Thanks in advance and thanks for reading!
has comment: http://stackoverflow.com/comment/36284261
type: UnansweredQuestion
tagged with: android
upvote count: 0
has answer: http://stackoverflow.com/a/23630996
has title: Fill ExpandableListAdapter with SQLite
tagged with: list
has comment: http://stackoverflow.com/comment/36285479

http://stackoverflow.com/comment/36463194
has text: @Bohemian yes! I have no ideia how to do that
comment on: http://stackoverflow.com/q/23723331
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36549823
type: Comment
has text: Thank you for your answer and patience. Yes, I would like to know if I can run it in a different J2EE container. I might be getting the implementation of that wrong, and I understand I am not being clear, I am sorry, I don't have much experience with it.
comment on: http://stackoverflow.com/a/23747814
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36324221
comment on: http://stackoverflow.com/q/23650843
score: 0
has text: Range axis as well as value axis shows the data that you put there. So if you want to show time, you have to put there time..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36373154
score: 0
comment on: http://stackoverflow.com/q/23676192
type: Comment
type: QuestionComment
has text: I agree, but my problem is to do the exact same thing as the installing screen of windows 98

http://stackoverflow.com/a/23748185
type: Answer
answers question: http://stackoverflow.com/q/23747982
score: 2
downvote count: 0
upvote count: 2
has body: Your string is definitively base 64 encoded. It translates to %PDF-1.4 3 0 obj &lt;&lt;/Type /Page /Parent 1 0 R /Resources 2 0 R /Group &lt;&lt;/Type /Group /S /Transparency /CS /DeviceRG which isnt a full pdf file by itself which leads me to belive you have something wrong with the way your reading the data from the server. As of java 6 they added a base 64 converter outside the sun packages. byte [] bytes = javax.xml.bind.DatatypeConverte.parseBase64Binary(texto); new String(bytes, "UTF-8");

http://stackoverflow.com/a/23660722
score: 0
answers question: http://stackoverflow.com/q/23660662
type: Answer
has body: The difference between -&gt; and -> Is the font. If this is ASCII art, you should be using a monospace font(Consolas, Courier New, Monaco...) for your JLabel via setFont. something like: JFrame j = new JFrame("TEST"); JLabel label = new JLabel(" -&gt; "); label.setFont(new Font("Courier New", Font.PLAIN, 12))); j.add(label); ...

http://stackoverflow.com/comment/43538166
score: 0
comment on: http://stackoverflow.com/q/23730328
type: Comment
has text: This is not your fault. See my answer below.
type: QuestionComment

http://stackoverflow.com/comment/66586106
type: QuestionComment
comment on: http://stackoverflow.com/q/23696317
has text: Compared to a simple forEach cycle, this would create lots of objects on the heap and dozens of dynamic method calls. While this might not always affect the bottom line in your performance tests, in the hot spots it makes a difference to abstain from the trivial use of Stream and similar heavyweight constructs.
score: 2
type: Comment

http://stackoverflow.com/comment/36462120
score: 0
type: Comment
type: QuestionComment
has text: Are you sure?: `JOptionPane.showMessageDialog(JDialog name,` looks a bit skanky to me. You can't call a method this way. Regardless, you should post a [small compilable example program](http://stackoverflow.com/help/mcve) that shows us your problem.
comment on: http://stackoverflow.com/q/23722858

http://stackoverflow.com/comment/36518112
type: Comment
has text: It will continue the song from where you paused. I added an example if you want to restart the song.
comment on: http://stackoverflow.com/a/23739773
type: AnswerComment
score: 0

http://stackoverflow.com/q/23653119
tagged with: oracle10g
type: Question
tagged with: jstl
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23654512
score: 0
tagged with: oracle-database
has body: I have an issue with using jstl inside JSP on Oracle AS 10g. The issue here is that c:out doesn't work with scriptlet variable. In jsp I have something like this: &lt;%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %&gt; &lt;%@ page import="java.io.*"%&gt; ... &lt;% String ERROR = request.getParameter("ERROR"); %&gt; ... (NOTE I had to use http://java.sun.com/jstl/core instead of http://java.sun.com/jsp/jstl/core - this doesn't work for me). And now I try to print it out with c:out tag: &lt;p style="color: #FF1A00"&gt;&lt;c:out value="&lt;%=ERROR%&gt;" /&gt;&lt;/p&gt; But it doesn't work. It prints out &lt;%=ERROR%> as red text. I tried to change web.xml tag to include version number and other definitions inside this tag and this doensn't work. What I had to do is to set this variable to page context and print it from it &lt;% pageContext.setAttribute("ERROR", ERROR); %&gt; ... &lt;p style="color: #FF1A00"&gt;&lt;c:out value="${ERROR}" /&gt;&lt;/p&gt; Can somone please explain me what is the problem here and why I couldn't use " />? Thanks in advance.
answer count: 1
linked to: http://stackoverflow.com/q/3177733
has answer: http://stackoverflow.com/a/23654512
has comment: http://stackoverflow.com/comment/36329881
type: AnsweredQuestion
tagged with: java
has title: jstl tag on Oracle AS 10g

http://stackoverflow.com/a/23673350
downvote count: 0
type: Answer
score: 1
has body: if you really want to create list of any requred classes, try this public static &lt;T&gt; List&lt;T&gt; getElement(Class&lt;T&gt; t) { List&lt;T&gt; elements = new ArrayList&lt;&gt;(); return elements; } you called this by doing List&lt;String&gt; list = getElement(Light.class); you could do switch on name of clas (if i remember from java 7 switch on string is allowed), if i'm wrong you could translate classname to enum. if you want create single element for your array, then switch statement is not required, you could do this by reflection. but this is not right way, right way is to create list of type which is shared for all object which you want to use, in your case Element
upvote count: 1
answers question: http://stackoverflow.com/q/23672720

http://stackoverflow.com/a/23637352
score: 1
answers question: http://stackoverflow.com/q/23636593
accepted answer of: http://stackoverflow.com/q/23636593
has body: It seems that the shell executing the command is not same as that you are using to run the script on command line. Specify the shell as bash. Add shebang in the script (as first line). It is always a good practice to be specific about the shell in the script #!/bin/bash You could also specify the shell you want to use for the shell script String[] command = {"/bin/bash", "/home/pi/tbe/testSleep.sh"};
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36393056
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23665924
type: AnswerComment
has text: oh, and don't forget to set the session timeout in web.xml to something reasonable 3

http://stackoverflow.com/comment/36364185
comment on: http://stackoverflow.com/a/23671375
score: 0
type: AnswerComment
has text: But i want only Valid table data be in Cache not every table or query data store in Cache
type: Comment

http://stackoverflow.com/comment/36508423
score: 0
type: Comment
has text: Do yoou have 2 separate text boxes for enetering the values ?
type: AnswerComment
comment on: http://stackoverflow.com/a/23747194

http://stackoverflow.com/comment/36955022
type: Comment
has text: This just shows that you should always use @Override: http://docs.oracle.com/javase/jp/8/api/java/lang/Override.html
type: AnswerComment
comment on: http://stackoverflow.com/a/23650512
score: 0

http://stackoverflow.com/comment/36549705
has text: @jyoon I can probably use the jarsigner I suppose. That is the post-building process though.
score: 0
comment on: http://stackoverflow.com/q/23768440
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23713608
type: Question
score: 0
has title: Out of memory Exception on Listview with images and text
answer count: 1
has comment: http://stackoverflow.com/comment/36445004
has comment: http://stackoverflow.com/comment/36443955
tagged with: android-listview
tagged with: android
accepted answer: http://stackoverflow.com/a/23714469
tagged with: bitmap
type: AnsweredQuestion
has body: My App has run out of memory due to a ListView with an ImageView and 2 TextView's inside. The images are big and I shrink them down to 56x56dp in single_row.xml for the ListView, but they are also used in larger sizes on other screens. The MainActivity calls the single_row into the listview and inflates it. Then the single row is duplicated with individual content for each row. Each row has an image and 2 textviews. I know there's a way to use bitmap but I'm unsure how to implement it in the code. Here is the main activity.java code @Override public View getView(int i, View convertView, ViewGroup viewGroup) { View row=convertView; if(row==null){ LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); row=inflater.inflate(R.layout.single_row, viewGroup,false); } TextView title = (TextView) row.findViewById(R.id.textView); TextView description = (TextView)row.findViewById(R.id.textView2); ImageView image = (ImageView)row.findViewById(R.id.imageView); SingleRow temp=list.get(i); title.setText(temp.title); description.setText(temp.description); image.setImageResource(temp.image); return row; } here is the singlerow.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ImageView android:id="@+id/imageView" android:layout_width="56dp" android:layout_height="56dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_margin="10dp" android:src="@drawable/placeholder1" /&gt; &lt;TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignTop="@+id/imageView" android:layout_toRightOf="@+id/imageView" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textView2" android:l…
has answer: http://stackoverflow.com/a/23714469
tagged with: java
tagged with: listview

http://stackoverflow.com/comment/36321598
has text: The snippet you're showing is the part not to optimize. **Improvement may be possible in what you're hiding** (i.e., `findCorrelation`). At this level, you could only parallelize (which may be worth it, but the speed-up is limited by the number of cores).
comment on: http://stackoverflow.com/q/23647687
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36486530
type: Comment
has text: Spoilsport. @JonSkeet was trying to teach the fellow how to debug logic problems in his program, and you just gave up the answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23735729

http://stackoverflow.com/comment/36505336
type: AnswerComment
has text: I was wondering the same, but taking the first (leftmost for big endian systems) 16 bytes [could suffice](http://crypto.stackexchange.com/questions/9418/how-random-is-the-shared-secret-in-the-diffie-hellman-key-agreement/9428#9428). To use a the "right" cryptographic method, you should use one or more calls to a KBKDF (key based key derivation method) though, e.g. HKDF. Only using SHA-256 and taking the first 128 bytes of the result can be seen as a poor mans KDF.
type: Comment
comment on: http://stackoverflow.com/a/23744199
score: 1

http://stackoverflow.com/q/23739353
has body: I'm trying to get a ListView working in an android ViewPager Fragment. This code I have so far however causes the app to crash - I'm not sure why! public class DirectoryFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_directory, container, false); ListView listView = (ListView) getActivity().findViewById(R.id.list); String[] values = new String[] {"Viewer 1", "Viewer 2", "Viewer 3" }; ArrayAdapter adapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, values); listView.setAdapter(adapter); return rootView; } }
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
tagged with: android-viewpager
accepted answer: http://stackoverflow.com/a/23739398
score: 0
tagged with: android-listview
answer count: 1
has answer: http://stackoverflow.com/a/23739398
has title: ListView in ViewPager Fragment
tagged with: android

http://stackoverflow.com/a/23646054
type: Answer
answers question: http://stackoverflow.com/q/23645988
score: 0
has comment: http://stackoverflow.com/comment/36315062
has body: You're looking at a ternary operator: Properly formatted, one looks like this: foo.isSomething() ? doThis() : doThat(); and translates to: "If the expression before the ? evaluates to true, execute the statement between the ? and the :, otherwise execute the statement after the :." In other words, you can think of this as shorthand for: if (foo.isSomething()) { doThis(); } else { doThat(); } Note that this is merely a shorthand - there's nothing you can do with a ternary operator that you can't do with if / else statements. That said, you should get familiar with them if you plan to learn programming by exploring professional code (which, incidentally, I recommend strongly), as you'll see it used a lot - not just in Java but in a multitude of languages.

http://stackoverflow.com/a/23677186
downvote count: 1
has body: Seems like scanner is reading a non int value from your file and when it does , while(input.hasNext()) will always be true because there is something as an input to scanner but it is not int. So scanner skips reading this non-int value in the inner if(input.hasNextInt()) check. So scanner does not proceed beyond this element and always return true. If you want to sum up all the integers in your file then you should modify your code to below: while(input.hasNext()) { if(input.hasNextInt()) { sum += input.nextInt(); } else input.next(); } Just read the non integer elements when scanner encouters it. Hope this clarifies.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36383581
answers question: http://stackoverflow.com/q/23676834
upvote count: 1

http://stackoverflow.com/q/23676998
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36374622
upvote count: 1
has body: This has only happened once but I'm a bit concerned with it. I was testing the app changing the orientation and the application crashed. Never happened before so just want to see if anyone else has had this issue and what I could do to fix it. Please see the log below: 05-15 12:13:07.304: E/AndroidRuntime(2596): FATAL EXCEPTION: main 05-15 12:13:07.304: E/AndroidRuntime(2596): java.lang.RuntimeException: Unable to start activity ComponentInfo{com./.hearing.InstructionsActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class &lt;unknown&gt; 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread.access$700(ActivityThread.java:141) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.os.Handler.dispatchMessage(Handler.java:99) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.os.Looper.loop(Looper.java:137) 05-15 12:13:07.304: E/AndroidRuntime(2596): at android.app.ActivityThread.main(ActivityThread.java:5103) 05-15 12:13:07.304: E/AndroidRuntime(2596): at java.lang.reflect.Method.invokeNative(Native Method) 05-15 12:13:07.304: E/AndroidRuntime(2596): at java.lang.reflect.Method.invoke(Method.java:525) 05-15 12:13:07.304: E/AndroidRuntime(2596): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 05-15 12:13:07.304: E/AndroidRuntime(2596): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 05-15 12:13:07.304: E/AndroidRuntime(2596): at dalvik.system.NativeStart.main(Native Method) 05-15 12:13:07.…
downvote count: 1
has comment: http://stackoverflow.com/comment/36376627
favorite count: 0
possible better answer: http://stackoverflow.com/a/23677662
accepted answer: http://stackoverflow.com/a/23677438
tagged with: android
has answer: http://stackoverflow.com/a/23677662
has title: Android Orientation change results in app crashing
has answer: http://stackoverflow.com/a/23677438
has comment: http://stackoverflow.com/comment/36374590
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36378584
type: Question

semaphore
type: Tag
tags question: http://stackoverflow.com/q/23689642
tag name: semaphore

http://stackoverflow.com/comment/36267618
comment on: http://stackoverflow.com/q/23621654
score: 0
type: QuestionComment
has text: @vkg Added settings.gradle content
type: Comment

http://stackoverflow.com/comment/36329961
type: QuestionComment
has text: @Benjamin that's what I feared... pretty bad as it shows a direct dependency to lucene (its Version class) in the transport client. Do you mind opening an [issue](https://www.github.com/elasticsearch/elasticsearch/issues) so we can see if we can easily fix it? Otherwise, a solution might be to shade lucene within elasticsearch so that you don't have conflicts anymore, although of course it would be great to have a separate client which we don't have at the moment.
comment on: http://stackoverflow.com/q/23627769
type: Comment
score: 1

http://stackoverflow.com/q/23720050
downvote count: 0
tagged with: java-io
answer count: 3
has body: I am implementing my own FilterWriter. Is there one write/append method of the FilterWriter, that will be called for by all the other write/append implementations? So I don't have to override all methods and just override e.g. the `void write(int c).
favorite count: 0
has title: One write method for all, FilterWriter
accepted answer: http://stackoverflow.com/a/23720153
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23720282
has answer: http://stackoverflow.com/a/23720282
type: Question
has answer: http://stackoverflow.com/a/23720166
has answer: http://stackoverflow.com/a/23720153

http://stackoverflow.com/comment/36461574
has text: Use LogCat to examine the Java stack trace associated with your crash.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23722444

http://stackoverflow.com/comment/36397143
score: 0
type: Comment
type: QuestionComment
has text: your second for-loop does the same thing everytime(so k will have the same value), and at every loop you're asigning k to m[l]. What are you trying to accomplish with your code?
comment on: http://stackoverflow.com/q/23688231

http://stackoverflow.com/q/23762337
tagged with: oop
tagged with: java
downvote count: 5
has body: How many instances of class A does the following code create ?? A x, u, v; x=new A(); A y=x; A z=new A();
type: Question
has title: How many instances of class A does the following code create?
accepted answer: http://stackoverflow.com/a/23762553
has answer: http://stackoverflow.com/a/23762480
favorite count: 0
has comment: http://stackoverflow.com/comment/36537135
has answer: http://stackoverflow.com/a/23762415
answer count: 5
has answer: http://stackoverflow.com/a/23762399
possible better answer: http://stackoverflow.com/a/23762353
has answer: http://stackoverflow.com/a/23762353
score: -4
has comment: http://stackoverflow.com/comment/36537383
has comment: http://stackoverflow.com/comment/36537139
upvote count: 1
has answer: http://stackoverflow.com/a/23762553
type: AnsweredQuestion

http://stackoverflow.com/a/23800471
has body: I managed to solve this issue. You need to edit the myModule_stub.h file (it is automatically generated). In my case I had to change the line: extern HsPtr myFunction_hs(HsPtr a1); to: extern char* myFunction_hs(const char* a1); Of course, you should rename your myModule_stub.h into myModule.h after manual editing. Otherwise it will be overwritten by GHC, and your specific types will be lost.
has comment: http://stackoverflow.com/comment/49568537
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/49568326
accepted answer of: http://stackoverflow.com/q/23629000
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23629000

http://stackoverflow.com/comment/36383190
type: Comment
has text: java.naming.provider.url=iiop://localhost:2811
comment on: http://stackoverflow.com/q/23680750
score: 0
type: QuestionComment

http://stackoverflow.com/q/23661708
has body: I get the following error when trying to compile a project in NetBeans 8.0: error: cannot find symbol dim_names.add(TheDim.getShortName().toUpperCase()); ^ symbol: method getShortName() location: variable TheDim of type Dimension So TheDim, in this case, is an object of the ucar.nc2.Dimension class, for those familiar with the netCDF libraries (I'm using v4.3 if it helps at all). The method getShortName() definitely exists when I browse through the library both in the IDE and looking through the JavaDoc. Just to state the obvious, yes netcdfAll-4.3.jar is in my project's libraries. When I run the code through debug mode it works fine. Not sure what is up with this but it's preventing me from building the project. Any possible solutions or workarounds?
has title: Error compiling, "cannot find symbol" on method that does exist
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23662095
upvote count: 1
type: Question
tagged with: compilation
has comment: http://stackoverflow.com/comment/36348849
has comment: http://stackoverflow.com/comment/36345584
answer count: 1
downvote count: 0
favorite count: 0
tagged with: compiler-errors
type: UnansweredQuestion

http://stackoverflow.com/comment/36547994
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23765990
has text: I am extremely suspicious about those `NULL` values. I haven't worked with HQL for a while, I'll have to dig up the docs on what it does with `c.entityTwo.serial = 'TEST3'` when entityTwo is NULL
type: Comment

http://stackoverflow.com/comment/36465346
score: 0
type: Comment
type: QuestionComment
has text: Has `EMPLOYEE_LIST` been initialized? Why the UPPERCASE for this variable?
comment on: http://stackoverflow.com/q/23724545

http://stackoverflow.com/comment/36583082
has text: intend to store it under the filename, will take the hash value from the filename and recheck it matching, does it make sense ?
comment on: http://stackoverflow.com/q/23763343
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23630933
type: Question
tagged with: spring
answer count: 1
tagged with: spring-integration
has answer: http://stackoverflow.com/a/23637063
score: 0
tagged with: java
has title: SpelParseException on setting key of MessageHeader to 'NEW' in Spring Integration
accepted answer: http://stackoverflow.com/a/23637063
tagged with: spring-el
has body: Below code is setting 'NEW' key of MessageHeader in Spring Integration 2.2.6. public Message&lt;String&gt; getFlow() { return MessageBuilder.withPayload("demo").setHeader("NEW", "NEW").build(); } Below code retreives the value of 'NEW' key from header in the SI configuration file. &lt;jdbc:outbound-gateway query="select name from emp where status=:headers[NEW]" row-mapper="empMapper" data-source="dataSource" max-rows-per-poll="100000" /&gt; 'NEW' header is set as shown in the below logs. [Headers={timestamp=1399978938970, id=777bb8ba-04b6-4408-9d60-18c9711375cc, NEW=NEW}] However, getting below exception: org.springframework.expression.spel.SpelParseException: EL1043E:(pos 11): Unexpected token. Expected 'identifier' but was 'rsquare(])' It is resolved by changing key of MessageHeader from 'NEW' to 'STATUS_NEW' as shown below: public Message&lt;String&gt; getFlow() { return MessageBuilder.withPayload("demo").setHeader("STATUS_NEW", "NEW").build(); } &lt;jdbc:outbound-gateway query="select name from emp where status=:headers[STATUS_NEW]" row-mapper="empMapper" data-source="dataSource" max-rows-per-poll="100000" /&gt; Is this the bug in SpEL or there are some restrictions in using names for key in MessageHeader?
type: AnsweredQuestion

http://stackoverflow.com/comment/36410301
type: Comment
has text: @108 The problem is when I input an invalid answer: `3,99,g` it goes into an infinite loop instead of taking the input again.
comment on: http://stackoverflow.com/a/23695502
score: 1
type: AnswerComment

http://stackoverflow.com/a/23710426
answers question: http://stackoverflow.com/q/23710025
has comment: http://stackoverflow.com/comment/46868211
has comment: http://stackoverflow.com/comment/36438121
has comment: http://stackoverflow.com/comment/36438214
has body: Yes, it does. The documentation perhaps isn't crystal clear on that point, but this is easy to both test (see the your own answer below, for example), and to see the canonical (HotSpot) implementation. Thread.sleep shells out to os:sleep which checks interruption before staring the sleep process as you can see here (look for os:sleep). If this wasn't the case, interrupts would be more or less impossible to use. If they happened to arrive outside of any sleep() call they would be lost as subsequent sleep() calls would ignore them. You couldn't even re-interrupt the thread because it is already interrupted.
accepted answer of: http://stackoverflow.com/q/23710025
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/36438101
type: Answer

http://stackoverflow.com/comment/36416712
has text: Then the code is not fine.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23699279

http://stackoverflow.com/comment/36451906
score: 1
comment on: http://stackoverflow.com/q/23717634
has text: Where's the stacktrace? And what is `a`?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23731024
has comment: http://stackoverflow.com/comment/36480831
answers question: http://stackoverflow.com/q/23729981
has comment: http://stackoverflow.com/comment/37002744
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23729981
score: 4
has comment: http://stackoverflow.com/comment/36489525
has comment: http://stackoverflow.com/comment/37001224
has comment: http://stackoverflow.com/comment/36480307
has comment: http://stackoverflow.com/comment/37002515
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37002651
type: Answer
has body: Alright, Button isn't the best starting point if you basically want to draw a completely different type of button. You can however, create your own widget using this tutorial. I wrote an example here: public class ImageButton extends Composite { private Color textColor; private Image image; private String text; private int width; private int height; public ImageButton(Composite parent, int style) { super(parent, style); textColor = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); /* Add dispose listener for the image */ addListener(SWT.Dispose, new Listener() { @Override public void handleEvent(Event arg0) { if (image != null) image.dispose(); } }); /* Add custom paint listener that paints the stars */ addListener(SWT.Paint, new Listener() { @Override public void handleEvent(Event e) { paintControl(e); } }); /* Listen for click events */ addListener(SWT.MouseDown, new Listener() { @Override public void handleEvent(Event arg0) { System.out.println("Click"); } }); } private void paintControl(Event event) { GC gc = event.gc; if (image != null) { gc.drawImage(image, 1, 1); Point textSize = gc.textExtent(text); gc.setForeground(textColor); gc.drawText(text, (width - textSize.x) / 2 + 1, (height - textSize.y) / 2 + 1, true); } } public void setImage(Image image) { this.image = new Image(Display.getDefault(), image, SWT.IMAGE_COPY); width = image.getBounds().width; height = image.getBounds().height; redraw(); } public void setText(String text) { this.text = text; redraw(); } @Override public Point computeSize(int wHint, int hHint, boolean changed) { int overallWidth = width; int overallHeight = height; /* Consider hints */ if (wHint != SWT.DEFAULT &amp;&amp; wHint &lt; overallWidth) overallWidth = wHint; if (hHint != SWT.DEFAULT &amp;&amp; hHint &lt; overallHeight) overallHeight = hHint; /* Return computed dimensions plus border */ return new Point(overallWidth + 2, overallHeight + 2); } public static void main(String[] args) { Display display = Display.getDefault(); …
has comment: http://stackoverflow.com/comment/37002880

http://stackoverflow.com/a/23625078
score: 0
has comment: http://stackoverflow.com/comment/36275361
type: Answer
has body: You code looks fine. You can try to do all your updates in one ... SET ts.edu_id=CASE WHEN ts.time_id=? THEN ? &lt;-- time_id=timeID then eduID ELSE null END WHERE ts.time_id = ? OR ts.edu_id = ? and params should be Object[] parameters = new Object[] {timeId, eduId, timeId, eduId};
answers question: http://stackoverflow.com/q/23624873

http://stackoverflow.com/a/25241482
type: Answer
has comment: http://stackoverflow.com/comment/39388998
upvote count: 1
answers question: http://stackoverflow.com/q/23620862
downvote count: 1
has body: 1.2.10 is available on request to Moto helpdesk. It will not be postet, the fix will be incorporated into next official image release.
score: 0

http://stackoverflow.com/a/23702638
upvote count: 1
score: 1
has body: For solution you need to take a closer look into word "linear operator": it means, that for x and y it returns something like ax + by, where a and b are constants. So: a * 1 + b * 1 = 1 a * 2 + b * 2 = 2 // may be removed as it's the same as the first line multiplied by 2 a * 919 + b * 648 = 1135 You can subtract first equality from the last multiplied by 648 and get a * (919 - 648) = 1135 - 648 => a = 487 / 271 => b = 1 - a = (271 - 487) / 271 = -216 / 271 So, the resulting operator is f(x, y) = 487/271 * x - 216/271 * y
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23702475

http://stackoverflow.com/comment/36257896
type: QuestionComment
has text: what is mHihglightedPositions and where is it set?
score: 0
comment on: http://stackoverflow.com/q/23616325
type: Comment

http://stackoverflow.com/comment/36578471
score: 0
type: Comment
has text: thank you ! Your answer was simple and I applied the same logic. It working fine now.
comment on: http://stackoverflow.com/a/23680791
type: AnswerComment

http://stackoverflow.com/comment/36574468
has text: Yes, that is correct. You should know that SSPI is actually not performing reverse DNS lookup but relies that the SPN matches the `CNAME` record. I, personally, have disabled reverse DNS lookups in MIT/Heimdal Kerberos. Please note that the DNS entries must not necessary but incorrect. If you have a canonical name for a service run on server phys. machines but under one hostname, you'll need a service account for that in here reverse lookups do not simply work.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23760218

http://stackoverflow.com/comment/36435845
has text: @sahimgiray if the solution worked, please accept the solution.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23706241
type: AnswerComment

http://stackoverflow.com/comment/36563604
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23775955
has text: ok thanks, i think ill leave it, if things work, why change them?

http://stackoverflow.com/comment/36356004
comment on: http://stackoverflow.com/q/23666897
score: 0
type: Comment
type: QuestionComment
has text: @AndrewMedico The deal is that move() in case of `Player` should just encourage player to click on a button and if `fetchNextPlayer()` returns instance of `ComputerPlayer extends Player` it suppose to automatically click a certain button.

http://stackoverflow.com/q/23711815
score: 0
favorite count: 0
has body: I am using selenium web driver with java. i want to click on the link with name Downloads. Actually there are four links with the same name. when i inspect the element i get &lt;a href="http://selenium-release.storage.googleapis.com/2.41/selenium-java-2.41.0.zip"&gt;&lt;/a&gt; i am trying to click the link with the following driver.findElement(By.xpath("//a[@ href='//http://selenium-release.storage.googleapis.com/2.41/selenium-java-2.41.0.zip']")).click(); In the following link i am trying to click on the first Download link. Selenium Download Click is not working. Can any body please tell me how can i click this specific link ? Thanks in advance.
answer count: 5
has answer: http://stackoverflow.com/a/23712299
tagged with: xpath
has title: How to click link with same names in selenium webdriver?
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/23712141
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23712088
has answer: http://stackoverflow.com/a/23712088
has answer: http://stackoverflow.com/a/23719896
accepted answer: http://stackoverflow.com/a/23712299
has answer: http://stackoverflow.com/a/23711940

http://stackoverflow.com/a/23771889
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36566299
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23764613
has comment: http://stackoverflow.com/comment/36558644
answers question: http://stackoverflow.com/q/23764613
score: 2
has body: WHILE and FOR are statements. You should rather try adding them as statementsBlacklist instead of tokenBlacklist. List&lt;Class&gt; statementBlacklist = new ArrayList&lt;&gt;(); statementBlacklist.add( org.codehaus.groovy.ast.stmt.WhileStatement ); secure.setStatementsBlacklist( statementBlacklist );

http://stackoverflow.com/a/23743318
downvote count: 1
type: Answer
has body: I solved it by using the Singleton Design Pattern in my User class. Just so people can look that up to solve this if they are having the same issues! Cheers and thanks for all the replies!
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23739333
has comment: http://stackoverflow.com/comment/36535009

http://stackoverflow.com/comment/36507803
type: QuestionComment
comment on: http://stackoverflow.com/q/23746876
has text: 100% certain as I can play it from my phone
score: 0
type: Comment

jena
tags question: http://stackoverflow.com/q/23750840
tags question: http://stackoverflow.com/q/23765257
tags question: http://stackoverflow.com/q/23657919
tag name: jena
tags question: http://stackoverflow.com/q/23753012
tags question: http://stackoverflow.com/q/23764815
tags question: http://stackoverflow.com/q/23640770
tags question: http://stackoverflow.com/q/23626194
type: Tag

http://stackoverflow.com/comment/36293000
type: Comment
type: QuestionComment
has text: thank u. it's the answer I forgot to build the java file so when I regenerate it, the h file dose not change.
comment on: http://stackoverflow.com/q/23633511
score: 0

http://stackoverflow.com/q/23701657
score: 3
downvote count: 0
tagged with: java
tagged with: apdu
has comment: http://stackoverflow.com/comment/36429553
has body: I am attempting to allow DoD CAC registration/authentication for a Java application I am writing. I am using the javax.smartcario package to read the card. I can successfully connect and read the GUID. The information I am looking for is the user name that is on the card (LAST.FIRST.M.123456789). I am using the following AID which gives me access to the GUID and certificates: byte[] aid = {(byte) 0xA0, 0x00, 0x00, 0x03, 0x08, 0x00, 0x00, 0x10, 0x00}; Is there a different application on the card that houses the user name? Is the username somehow embedded in the certificates? Thanks! [EDIT] I am trying to generate a certificate based off the APDU command response but an exception is thrown. // X.509 Certificate for PIV auth command byte[] apdu = {0x00, (byte)0xCB, 0x3F, (byte)0xFF, 0x05, 0x5C, 0x03, 0x5F, (byte)0xC1, 0x05}; answer = channel.transmit(new CommandAPDU(apdu)); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate( new ByteArrayInputStream(answer.getBytes())); Throws the following exception: java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Empty input The byte array is not empty. Thanks!
type: Question
answer count: 1
upvote count: 3
tagged with: smartcard
has title: DoD CAC ADPU Commands
tagged with: cac
favorite count: 0
has answer: http://stackoverflow.com/a/24197620
type: UnansweredQuestion

http://stackoverflow.com/comment/36552898
has text: Thank you for your replies. I made some changes to my code (made templist a field variable) to look at what happens. I don't know how to debug a GUI well (like using breakpoints). It seems that the reading part of the "updateFileHistory()" method gets skipped somehow. Thank you for your help so far. I will try to find a solution :)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23769486
type: Comment

http://stackoverflow.com/comment/36292974
type: Comment
has text: Depending on your answer to @PeterLawrey's question, there is a high chance (at least for unit tests which are usually compiled and run together with production code) you won't be able to compile the project with java 6 the classes "developed" with 7 due to the differences between versions, such as `catch (IOException|SQLException ex)`
score: 0
comment on: http://stackoverflow.com/q/23634928
type: QuestionComment

http://stackoverflow.com/a/23658017
score: 1
accepted answer of: http://stackoverflow.com/q/23657575
has comment: http://stackoverflow.com/comment/36338697
has comment: http://stackoverflow.com/comment/36340178
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36338830
has comment: http://stackoverflow.com/comment/36338131
type: Answer
has body: Can't you go through the matches one by one and do the next match from an index after the previous match? You can use this regex: \[(?&lt;text&gt;[^\]]*)\]\((?&lt;link&gt;[^\)]*)\) The method Find() tries to find all matches even if the match is a substring of the entire string. Each call to find gets the next match. Matches() tries to match the entire string and fails if it doesn't match. Use something like this: while (m.find()) { String s = m.group(1); // s now contains "BAR" }
upvote count: 1
answers question: http://stackoverflow.com/q/23657575

http://stackoverflow.com/comment/36488652
type: QuestionComment
comment on: http://stackoverflow.com/q/23736211
score: 0
has text: OK then, can you suggest me another link with code for linear hashing?
type: Comment

http://stackoverflow.com/q/23764964
has comment: http://stackoverflow.com/comment/36542713
has comment: http://stackoverflow.com/comment/36543225
tagged with: sqlite
tagged with: file-permissions
has body: I am trying to added an application folder to the Application Support folder on Mac. It works, but I can not write to the folder. when I do ls -l on the folder I get: drwxr-xr-x, but for some reason I can not create the db file there. String OS = (System.getProperty("os.name")).toUpperCase(); String location; if(OS.contains("WIN")){ location = "/" + System.getenv("APPDATA").replace("\\", "/") + "/Phantom"; }else{ location = System.getProperty("user.home"); location += "/Library/Application Support/Phantom"; } File f = new File(location); if(!f.isDirectory()){ f.mkdir(); } Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:" + location + "/phantom.db"); First off, this is the right place to store this information on mac right? Assuming so, what should I be doing so that this works? Edit Trace: Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application…
answer count: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/36543592
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/36542548
has comment: http://stackoverflow.com/comment/36543304
has title: Can not create SQLite database on mac (permission) issues
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36543131
downvote count: 1
tagged with: permissions
has comment: http://stackoverflow.com/comment/36542749
tagged with: java
has answer: http://stackoverflow.com/a/23765364
type: Question
has comment: http://stackoverflow.com/comment/36542929
upvote count: 0

http://stackoverflow.com/q/23626992
tagged with: maven
upvote count: 1
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/36280676
has comment: http://stackoverflow.com/comment/36316699
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36277614
has title: ProGuard: "Unsupported version number [52.0]" with correct Java version
type: Question
has comment: http://stackoverflow.com/comment/36317108
linked to: http://stackoverflow.com/q/23170502
has comment: http://stackoverflow.com/comment/36277594
has body: When trying to obfuscate my Java program, I get following error (running mvn clean install): [INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ myproduct --- [INFO] execute ProGuard [-injars, 'D:\dev\myproduct\target\myproduct-1.0.6_proguard_base.jar'(!META-INF/maven/**), -outjars, 'D:\dev\myproduct\target\myproduct-1.0.6.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\easytesting\fest-util\1.2.3\fest-util-1.2.3.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\powermock\powermock-api-support\1.5.1\powermock-api-support-1.5.1.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\powermock\powermock-reflect\1.5.1\powermock-reflect-1.5.1.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\objenesis\objenesis\1.2\objenesis-1.2.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\powermock\powermock-core\1.5.1\powermock-core-1.5.1.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\javassist\javassist\3.18.0-GA\javassist-3.18.0-GA.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\easytesting\fest-assert-core\2.0M8\fest-assert-core-2.0M8.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\com\google\guava\guava\15.0\guava-15.0.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\mockito\mockito-all\1.9.5\mockito-all-1.9.5.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\com\h2database\h2\1.3.173\h2-1.3.173.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\ru\mycompany\commons\2.9\commons-2.9.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\com\google\inject\guice\2.0\guice-2.0.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar', -libraryjars, 'C:\Users\MYUSER\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.1.4\jackson-core-2.1.4.jar', -libraryjars, 'C:\Users\MYUSER\.m2\rep…
downvote count: 0
tagged with: proguard
favorite count: 0
has comment: http://stackoverflow.com/comment/36278808
duplicate of: http://stackoverflow.com/q/23170502
type: UnansweredQuestion

http://stackoverflow.com/comment/36427406
type: QuestionComment
has text: Where's your view named `hello`? Did you intend to make this a `RestController` or use `@ResponseBody`?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23704548

http://stackoverflow.com/q/23739989
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36494727
has body: I wrote the following code to write a file on my jBoss server: Path path = Paths.get("myfile.csv"); BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8); writer.write(csvtext, 0, csvtext.length()); writer.close(); The file is saved in jboss/bin Now I want to add a link in my front end to be able to download the csv. But I don't know what URL to use because the file csv is store in jboss/bin. How can I do? Should I store it in jboss/standalone/deployments? How?
has comment: http://stackoverflow.com/comment/36494487
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23746507
tagged with: jboss
has title: File created in jboss/bin instead of jboss/standalone/deployments

http://stackoverflow.com/comment/36686496
type: Comment
type: AnswerComment
has text: Like I said, this is being done dynamically. Are you saying I would have to encase every component I modify in its own container just to apply CSS to it? It seems like an awfully ugly workaround, but if its all I've got, I guess It'll have to do :/.
comment on: http://stackoverflow.com/a/23832850
score: 0

http://stackoverflow.com/q/23748242
has comment: http://stackoverflow.com/comment/36510828
has answer: http://stackoverflow.com/a/23749385
upvote count: 2
score: 1
has title: Need help checking my logic please
tagged with: loops
downvote count: 1
has comment: http://stackoverflow.com/comment/36512153
linked to: http://stackoverflow.com/q/2429228
type: Question
has answer: http://stackoverflow.com/a/23749597
has comment: http://stackoverflow.com/comment/36513541
has body: I have this loop that won't stop when it should and it's only happen on my production server but not on my dev server. So I'm going crazy. //objectName can be any value from [a-}], char objectName = 'a'; //objectName is initialized with value 'a' //before objectName hit the line below, it was increment objectName++; until the value of //objectName = '}' for( char c = objectName; c &lt;= 'z'; c++ ){ //do something } objectName can be any character but in my case I know that my objectName will be "}" character, which is technically more than 'z'. So what I don't understand is why is my loop being executed still. The funny thing is we have test server which uses JAVA 1.6.0_30, and we have try testing there and it's working just fine. My Dev Server uses : java 1.6.0_45 My Prod Server uses : java 1.6.0_30 If you see anything wrong with my logic please let me know, any circumstance that will make my loop be active even when it shouldn't feel free to let me know.
linked to: http://stackoverflow.com/q/15610247
tagged with: java
has comment: http://stackoverflow.com/comment/36510489
has comment: http://stackoverflow.com/comment/36510644
has comment: http://stackoverflow.com/comment/36510513
has comment: http://stackoverflow.com/comment/36586395
tagged with: char
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36510512
favorite count: 0
has comment: http://stackoverflow.com/comment/36510585
has comment: http://stackoverflow.com/comment/36510739
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36513922
has comment: http://stackoverflow.com/comment/36510519

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/23671439

http://stackoverflow.com/comment/91595260
comment on: http://stackoverflow.com/a/34206517
type: Comment
score: 0
has text: This should not work...... Extract From Oracle Doc [link](https://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashMap.html)... This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map (insertion-order). Note that insertion order is not affected if a key is re-inserted into the map. (A key k is reinserted into a map m if m.put(k, v) is invoked when m.containsKey(k) would return true immediately prior to the invocation.)
type: AnswerComment

http://stackoverflow.com/comment/59251757
type: AnswerComment
type: Comment
has text: This may help for network problems but not for the stated "too small heap".
comment on: http://stackoverflow.com/a/35790760
score: 0

sidebar
type: Tag
tag name: sidebar
tags question: http://stackoverflow.com/q/23693545

http://stackoverflow.com/q/23736491
answer count: 0
has title: importing aop context gives Cglib error
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36488940
score: 0
tagged with: spring-aop
has comment: http://stackoverflow.com/comment/36489663
has body: Error Stack trace. Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy20]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy20 at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:218) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:111) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:477) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:409) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1655) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) ... 23 more Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy20 at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446) at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33) at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216) at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377) at org.springframework.cglib.proxy.Enhancer.create(En…
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/36809104

http://stackoverflow.com/a/23713432
downvote count: 0
has body: No, there's no functionality to extract matching groups in a regex and compare them to the username. Also, note that ant patterns don't support regex expressions at all. It's not a good idea to rely on complicated URL patterns in any case. For something like this you're best to use method security at the controller level or on some service interface, where you can refer to method parameters by name. For example, with method security expressions enabled, you could write @PreAuthorize("#user.name == authentication.name") public void editUser(User user) { .... } Alternatively, as Misha says, you can just code the rule directly, which is preferable if things get more complicated than simple expressions.
type: Answer
has comment: http://stackoverflow.com/comment/36507267
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23700951
answers question: http://stackoverflow.com/q/23700951
type: AcceptedAnswer

http://stackoverflow.com/q/23759016
type: Question
upvote count: 4
tagged with: kerberos
accepted answer: http://stackoverflow.com/a/23760218
answer count: 1
downvote count: 0
score: 4
tagged with: tomcat
favorite count: 0
tagged with: linux
tagged with: spnego
has body: I am currently implementing a single signon solution for a customer that is based on Java, Tomcat and Kerberos. Users are to access the URL of an intranet Tomcat application from their client browsers, the Tomcat application acquires the users' credentials via Kerberos and redirects them to the actual web application. Our customer's environment is a typical mixture of a Windows AD server acting as the KDC and Linux Tomcat application servers. The SSO functionality is supposed to be used from both Windows and Linux clients. This is what appears to be different from most answers I can find on the net where people have Linux web application servers but only use Windows clients. Now, in my local setup I get some strange behaviour. My development environment is a Tomcat 7.0.26 running from MyEclipse 8.6 under Windows 7. My test environment is a Tomcat 7.0.26 or 7.0.53 behind an Apache web server on a Centos 6 machine. I have set up the AD server correctly, generated the necessary keytab files etc. and everything is running smoothly in the development environment. I can access the Tomcat application from both Linux and Windows clients using IE and Firefox, Kerberos authentication proceeds and I get redirected properly. When deploying the Tomcat application on the test server this keeps working when trying to sign on from Windows clients. However, when I try to access the test server from a Linux client (I have tried from Linux Mint 13 and Ubuntu 13.10), I get the following error: javax.servlet.ServletException: GSSException: No credential found for: 1.3.6.1.5.2.51.3.6.1.5.2.5 usage: Accept net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:233) I have to admit that I do not properly understand this message. Does it point to a problem with the credentials supplied by the client or a problem with the application server negotiating with the KDC? I have done some research on this problem and have found out that the indicated oid 1.3.6.1.5.2.5 stands for GS…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23760218
tagged with: java
has title: SPNEGO/Kerberos No credential found error with requests from Linux client

http://stackoverflow.com/q/23631282
upvote count: 1
has body: When using Wrapper class comparisons compareTo method(For example for Long or Integer) if(!this.getAttribute().compareTo(myobj.getAttribute())) { //changeLog to log the changes done from this object to myobj } In above condition I want to create the changeLog string , few conditions are there : 1.this.getAttribute() can be null. 2.myobj.getAttribute() can be null. 3.Both this.getAttribute() and myobj.getAttribute() can be null. In case of null I want to append empty string in changeLog string.It should also take care of null checks as well.
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23631331
answer count: 4
has comment: http://stackoverflow.com/comment/36285518
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23631331
tagged with: java
has answer: http://stackoverflow.com/a/23631476
type: Question
has answer: http://stackoverflow.com/a/23631888
has title: How to chek for NullPointers when comparison under such condition
possible better answer: http://stackoverflow.com/a/23631363
score: 0
has answer: http://stackoverflow.com/a/23631363

http://stackoverflow.com/comment/36557921
has text: Instead of a long chain of if else statements, consider using switches. Efficiency and readability go hand in hand. Might be a good idea to incorporate some of the repetitive code for setting the rows and columns into a single method.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23772895

http://stackoverflow.com/comment/36452305
type: QuestionComment
has text: The previous implementation in my proj doesnot show the attachment icon though the logo is displayed. I dont see any significant difference between my implementation from the original one. Not sure what is causing to display the attachment icon. If i remove the line messageBodyPart.setDisposition(MimeMessage.INLINE); gmail also shows the attachment icon and logo is displayed inline.
comment on: http://stackoverflow.com/q/23717667
score: 0
type: Comment

http://stackoverflow.com/comment/36404411
score: 0
comment on: http://stackoverflow.com/a/23691670
type: AnswerComment
type: Comment
has text: Thanks for your answer, but Im trying to get new ProfilingReport objects that contain an average of the runTime atribute. Right now I am iterating over that list and creating new ProfilingReport objects like you suggested, but I was just looking for a cleaner solution. Thank you!

http://stackoverflow.com/comment/36306462
comment on: http://stackoverflow.com/a/23640909
has text: @user3634077 the BufferedWriter = ... code goes at the beginning of your function and the bw.println(... goes instead of the System.out.println(column) inside your (String column:row loop.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36350987
type: Comment
has text: @CodeMed one workaround i can suggest for time being until i go through dandelion datatable API. In your controller don't always call your DAO method if size is less than 3.call database to fetch result when entered keyword length is at least 3.meanwhile i search altimate soution for this
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23662863

http://stackoverflow.com/q/23671043
tagged with: android
has comment: http://stackoverflow.com/comment/36363470
has title: How to send file or string in a socket connection in android?
type: AnsweredQuestion
tagged with: java
tagged with: inputstream
downvote count: 1
has answer: http://stackoverflow.com/a/23671450
type: Question
accepted answer: http://stackoverflow.com/a/23671450
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/23671156
has body: i am developing an android application that capable of sending file and string (message) to another android device. here i have one server mobile and another as client. I am really struck with sending file(image) and string using same socket. how to identify whether sending information is file or string. Please help me on this. the client sends message to server using service and server receives data using ascynctack.
score: -1
has answer: http://stackoverflow.com/a/23671156
favorite count: 0
tagged with: sockets

http://stackoverflow.com/a/35695704
type: Answer
answers question: http://stackoverflow.com/q/23756363
downvote count: 0
score: 1
has body: Also check for hibernate-cfg.xml whether it contains entry for mapping java object. &lt;mapping class="com.yourpackage.App" /&gt;
upvote count: 1

http://stackoverflow.com/comment/36375456
comment on: http://stackoverflow.com/q/23677301
has text: actually that part is also an issue. had it be the same, I would have looped without an issue? This makes the situation complex.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36457526
score: 0
type: Comment
type: QuestionComment
has text: Thanks, I fixed it, I realized that I was just going to the menu and selecting `new`. I didn't actually go to HKEY_LOCAL_MACHINE\Software\JavaSoft`
comment on: http://stackoverflow.com/q/23720446

http://stackoverflow.com/comment/36471365
score: 2
comment on: http://stackoverflow.com/q/23727501
type: Comment
type: QuestionComment
has text: In _that_ declaration, there is no difference.

http://stackoverflow.com/q/23758072
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36529140
score: 7
accepted answer: http://stackoverflow.com/a/23759522
favorite count: 0
has comment: http://stackoverflow.com/comment/36558831
has comment: http://stackoverflow.com/comment/36531391
has title: Hibernate Java rearranging parentheses in SQL
answer count: 3
has answer: http://stackoverflow.com/a/23759955
upvote count: 7
has comment: http://stackoverflow.com/comment/36529725
possible better answer: http://stackoverflow.com/a/23759955
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23759522
has comment: http://stackoverflow.com/comment/36531570
downvote count: 0
has comment: http://stackoverflow.com/comment/36558825
has answer: http://stackoverflow.com/a/27665586
has body: I've got a @NamedQuery like so select i from MyTable i where (i.streetId = :streetId and i.cityId = :cityId) or (i.streetId is null and i.cityId = :cityId) or (i.streetId = :streetId and i.cityId is null) Somehow Hibernate rearranges the parentheses to Hibernate: select mytable0_.id as id1_14_, mytable0_.version as version2_14_, mytable0_.streetId as streetI3_14_, mytable0_.cityId as cityId7_14_ from myTable mytable0_ where mytable0_.streetId=? and mytable0_.cityId=? or ( mytable0_.streetId is null ) and mytable0_.cityId=? or mytable0_.streetId=? and ( mytable0_.cityId is null ) Why is it doing this ? (They could be equivalent, but I prefer the simpler where clause) Current workaround is to write this in native SQL, but I'm just wondering if this is a known issue.
tagged with: jpql
type: Question

http://stackoverflow.com/comment/36306675
has text: Hmm, modjk is just a proxy, it shall not affect processing. Strange
comment on: http://stackoverflow.com/q/23638815
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23663726
has comment: http://stackoverflow.com/comment/36349838
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/23664139
tagged with: java
tagged with: eclipse
has body: I'm trying to remove Junit from the build path a (plugin) project in Eclipse(I've refactored the tests into a separate Project. Should be simple, but the remove button is greyed out for me: Am I missing something obvious?
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has title: Remove Junit from eclipse build path
has answer: http://stackoverflow.com/a/23664139

http://stackoverflow.com/q/23618666
tagged with: http://stackoverflow.com/tag/html
has title: Add video in jsp page
answer count: 0
tagged with: jsf
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36261691
type: Question
has comment: http://stackoverflow.com/comment/36261671
has body: i am trying to put a video inside my jsp page, dynamically, like: &lt;video id="myVideo" width="420" height="345" controls="controls"&gt; &lt;source src="#{detailsBean.ref.videoLink}" type="video/ogg" /&gt; &lt;/video&gt; But I get this error : org.apache.jasper.JasperException: /details.jsp(64,29) #{..} is not allowed in template text What should i use instead? package beans; import dto.Referinta; public class DetailsBean { Referinta ref = new Referinta( ); public Referinta getRef ( ) { return ref; } public void setRef ( Referinta ref ) { this.ref = ref; } } I dont think that the problem is in the bean, it's about the tag, can't find one to use with dynamic src. This will work if in src i put the direct link to the video.
tagged with: jsp
has comment: http://stackoverflow.com/comment/36261716
has comment: http://stackoverflow.com/comment/36261734

http://stackoverflow.com/comment/36493974
has text: What do you mean by that? Also, assuming this is a typo, but you're missing a semicolon after `UNKNOWN`
comment on: http://stackoverflow.com/q/23739557
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36298957
type: Comment
has text: What would I change R.id.lyt_main to?
comment on: http://stackoverflow.com/a/23637527
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36389219
comment on: http://stackoverflow.com/q/23684149
score: 0
type: QuestionComment
has text: it's take it's value from text file and i'm sure that is not null
type: Comment

http://stackoverflow.com/comment/36547679
score: 1
has text: @IvayloSlavov just note that some AOT compilers do ... tricks there.
comment on: http://stackoverflow.com/a/23767262
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36452194
comment on: http://stackoverflow.com/q/23717749
score: 4
has text: While you are still a beginner, now is the best time to get out of the habit of using `double` to store an amount of money. If you use `double` in this way, you will introduce errors as soon as you start doing arithmetic. I strongly recommend _either_ using `BigDecimal` to store your money, _or_ using `int` to store a number of cents.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36450357
has text: Sorry, havent check back in a while. Back, But I did some research before and it was all too confusing. I'll look at what you guys sent me though.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23654824

http://stackoverflow.com/a/23709204
downvote count: 0
has body: First of all, names of your variables make it difficult to explain, so: private void myMethod(){ final Object finalObject = null; _myMethod(finalObject); } private void _myMethod(Object methodObject){ methodObject = new Object(); } Java passes objects by a value of reference. Passing argument to the method means, that methodObject holds a copy of reference to finalObject (but not the copy of an object). Now, body of the method does not change or reassign finalObject object - it simply reassign the methodObject by changing a value of the reference passed to method. Please, see also this answer - I suppose it will make it much clearer.
answers question: http://stackoverflow.com/q/23708465
score: 4
has comment: http://stackoverflow.com/comment/36437813
type: Answer
upvote count: 4

http://stackoverflow.com/q/23646745
has comment: http://stackoverflow.com/comment/36316120
duplicate of: http://stackoverflow.com/q/56867
has answer: http://stackoverflow.com/a/23646986
has comment: http://stackoverflow.com/comment/36316092
has comment: http://stackoverflow.com/comment/36316709
has comment: http://stackoverflow.com/comment/36316488
has answer: http://stackoverflow.com/a/23646839
favorite count: 0
has title: Why interface really needed when normal class can do the same work
has comment: http://stackoverflow.com/comment/36316431
duplicate of: http://stackoverflow.com/q/383947
linked to: http://stackoverflow.com/q/240152
tagged with: interface
score: -3
linked to: http://stackoverflow.com/q/56867
downvote count: 7
has comment: http://stackoverflow.com/comment/36316372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36315969
tagged with: java
has comment: http://stackoverflow.com/comment/36316509
linked to: http://stackoverflow.com/q/383947
has comment: http://stackoverflow.com/comment/36316303
has comment: http://stackoverflow.com/comment/36316055
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36316232
accepted answer: http://stackoverflow.com/a/23646986
has comment: http://stackoverflow.com/comment/36316561
answer count: 2
has body: I have been wondering the real use of interface. please check the below code. interface Animal { public void eat(); public void travel(); } public class MammalInt implements Animal{ public void eat(){ System.out.println("Mammal eats"); } public void travel(){ System.out.println("Mammal travels"); } public int noOfLegs(){ return 0; } public static void main(String args[]){ MammalInt m = new MammalInt(); m.eat(); m.travel(); } } in the above code if i remove implements Animal from class declaration still the code works fine without any difference. So what is the actual use of interface. ?
possible better answer: http://stackoverflow.com/a/23646839
tagged with: jsp
duplicate of: http://stackoverflow.com/q/240152

http://stackoverflow.com/comment/36336689
has text: `if ( obj = null )` yields an error in Eclipse and any correct Java compiler.
type: AnswerComment
comment on: http://stackoverflow.com/a/23657027
type: Comment
score: 2

http://stackoverflow.com/a/23725797
has body: Here is an example for adding comment to xml file: root.addContent(new Comment("Info about " + cars[i][0]));
score: 1
answers question: http://stackoverflow.com/q/23725753
has comment: http://stackoverflow.com/comment/138173963
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36468601
upvote count: 1

http://stackoverflow.com/a/23759855
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23759752
type: Answer
answers question: http://stackoverflow.com/q/23759752
upvote count: 3
has body: А+ doesn't work, because the + is an operator in Java. Better add a few more grades, like: A_PLUS(true), A_MINUS(true), .... , F_PLUS(false);

spring-boot
tags question: http://stackoverflow.com/q/23661492
type: Tag
tags question: http://stackoverflow.com/q/23701616
tags question: http://stackoverflow.com/q/23677808
tags question: http://stackoverflow.com/q/23648667
tags question: http://stackoverflow.com/q/23673743
tags question: http://stackoverflow.com/q/23636368
tags question: http://stackoverflow.com/q/23638462
tag name: spring-boot
tags question: http://stackoverflow.com/q/23639965
tags question: http://stackoverflow.com/q/23640470
tags question: http://stackoverflow.com/q/23692101
tags question: http://stackoverflow.com/q/23621723

http://stackoverflow.com/q/23675490
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36372375
has comment: http://stackoverflow.com/comment/36371767
tagged with: .class-file
type: Question
has comment: http://stackoverflow.com/comment/36386041
has title: What happens if I mislay the qualified path name information for a "third party" .class file?
has answer: http://stackoverflow.com/a/23676990
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36382846
possible better answer: http://stackoverflow.com/a/23676917
has answer: http://stackoverflow.com/a/23676917
has body: Suppose I buy a .class file from a "third party" developer. They send me the .class file, but not the source code. In their accompanying documentation, they tell me what the qualified path name for the .class file is, what the class is called, and what its public members are. Suppose I use their class in my program, like so: class Main { public static void main(String[] args) { thirdparty.special.PaidFor.method(); } } To compile my project, my ("cut down") javac command looks like this - javac -cp bin Main.java I've added in a -cp option to this javac command, and also manually created the following folder structure, to which the PaidFor.class file has been moved to. (Presumably, the javac -cp option, and manually creating this folder structure are mandatory.) (folder structure) \bin \ thirdparty \ special \ PaidFor.class What happens if the following situation occurs: Sometime in the future, my project source code and associated folder structure are deleted, and I also mislay the accompanying documentation for the third party .class file. In other words, I no longer know that the third party .class file has a qualified name of "thirdparty.special", which contains a class called PaidFor, containing members such as method(). I searched online for some clues as to what I could do in this situation. I came across various downloads with descriptions such as "Java class analyzer". Not knowing anything about this topic, I wonder if this is the most appropriate and relevant approach to take in this situation. Thanks a lot for any comments.
accepted answer: http://stackoverflow.com/a/23676990

http://stackoverflow.com/q/23695844
answer count: 2
has body: I want to write custome annonation on method .my usecase is - I have user which has role so when user try to access some method of class then i want to check his roles. so roles i want pass in annotation. my code is here package com.samples; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Roles { public String roles(); } package com.samples; public class AnnotationExample { @Roles(roles="admin") public void createAction(){ String userrole = "admin"; // this hardcoded value // a // here i want to compare annotaiton value with user role } } How can i do this ? It is possible to declare annotation value as object value. like @Roles(Role.AADMIN)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23697231
tagged with: java
tagged with: annotations
type: Question
has answer: http://stackoverflow.com/a/23697392
has title: Java custom annotation
score: 0

http://stackoverflow.com/q/23769345
answer count: 1
type: UnansweredQuestion
has body: I'm new to Java. I feel pretty dumb right now. I'm just trying to run an example program and I'm not having any luck. At this time, I'm trying to just run the JavaMail sample app from the command line. From my understanding, I should be able to do this: java -Dmail.imap.sasl.enable=true -Dmail.imap.sasl.mechanisms=XOAUTH2 -Dmail.imap.auth.login.disable=true -Dmail.imap.auth.plain.disable=true -Dmail.imap.ssl.enable=true -Dmail.debug.auth=true msgshow -D -U [EmailAddress] -P "[AccessToken]" -T imap -H imap-mail.outlook.com -f INBOX 1 However, when I enter that command into the terminal window on my Mac OS X machine, I get an error that says: Exception in thread "main" java.lang.NoClassDefFoundError: msgshow Caused by: java.lang.ClassNotFoundException: msgshow I feel so bad, because I don't know how to even compile this thing. I opened up the directory in IntelliJ IDEA and hit the Build -> Rebuild Project. I'm just not having any luck. How do I get this sample app to run? I sincerely appreciate your help.
tagged with: java
type: Question
has title: Running Java Mail samples
has answer: http://stackoverflow.com/a/23769541
score: 0
tagged with: jakarta-mail

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/23750966
tags question: http://stackoverflow.com/q/23659617
tags question: http://stackoverflow.com/q/23730465
tags question: http://stackoverflow.com/q/23737297
tags question: http://stackoverflow.com/q/23620716
tags question: http://stackoverflow.com/q/23724221
tags question: http://stackoverflow.com/q/23758252
tags question: http://stackoverflow.com/q/23630291
tags question: http://stackoverflow.com/q/23758904
tags question: http://stackoverflow.com/q/23772122
tags question: http://stackoverflow.com/q/23633522
tags question: http://stackoverflow.com/q/23714119
tags question: http://stackoverflow.com/q/23628897
tags question: http://stackoverflow.com/q/23766744
tags question: http://stackoverflow.com/q/23731478
tags question: http://stackoverflow.com/q/23735458
tags question: http://stackoverflow.com/q/23627237
tags question: http://stackoverflow.com/q/23622266
tags question: http://stackoverflow.com/q/23660334
tags question: http://stackoverflow.com/q/23770591
tags question: http://stackoverflow.com/q/23726389
tags question: http://stackoverflow.com/q/23745889
tags question: http://stackoverflow.com/q/23718346
tags question: http://stackoverflow.com/q/23718183
tags question: http://stackoverflow.com/q/23678518
tags question: http://stackoverflow.com/q/23730062
tags question: http://stackoverflow.com/q/23685338
tags question: http://stackoverflow.com/q/23770434
tags question: http://stackoverflow.com/q/23645878
tags question: http://stackoverflow.com/q/23742467
tags question: http://stackoverflow.com/q/23642171
type: Tag
tags question: http://stackoverflow.com/q/23750663
tags question: http://stackoverflow.com/q/23679658
tags question: http://stackoverflow.com/q/23760323
tags question: http://stackoverflow.com/q/23659004
tags question: http://stackoverflow.com/q/23631868
tags question: http://stackoverflow.com/q/23762443
tags question: http://stackoverflow.com/q/23615967
tags question: http://stackoverflow.com/q/23684386
tags question: http://stackoverflow.com/q/23717618
tags question: http://stackoverflow.com/q/23720240
tags question: http://stackoverflow.com/q/23730768
tags question: http://stackoverflow.com/q/23744216
tags question: http://stackoverflow.com/q/23695649
tags question: http://stackoverflow.com/q/23770188
tags question: http://stackoverflow.com/q/23628513
tags question: http://stackoverflow.com/q/23633402
tags question: http://stackoverflow.com/q/23733020
tags question: http://stackoverflow.com/q/23666872
tags question: http://stackoverflow.com/q/23745356
tags question: http://stackoverflow.com/q/23764628
tag name: json
tags question: http://stackoverflow.com/q/23753533
tags question: http://stackoverflow.com/q/23632077
tags question: http://stackoverflow.com/q/23680832
tags question: http://stackoverflow.com/q/23726068
tags question: http://stackoverflow.com/q/23743370
tags question: http://stackoverflow.com/q/23722675
tags question: http://stackoverflow.com/q/23734536
tags question: http://stackoverflow.com/q/23674861
tags question: http://stackoverflow.com/q/23707796
tags question: http://stackoverflow.com/q/23642335
tags question: http://stackoverflow.com/q/23703431
tags question: http://stackoverflow.com/q/23760035
tags question: http://stackoverflow.com/q/23630094
tags question: http://stackoverflow.com/q/23734124
tags question: http://stackoverflow.com/q/23768692
tags question: http://stackoverflow.com/q/23678198
tags question: http://stackoverflow.com/q/23749161
tags question: http://stackoverflow.com/q/23622686
tags question: http://stackoverflow.com/q/23704415
tags question: http://stackoverflow.com/q/23659138
tags question: http://stackoverflow.com/q/23710037
tags question: http://stackoverflow.com/q/23633287
tags question: http://stackoverflow.com/q/23684134
tags question: http://stackoverflow.com/q/23773609
tags question: http://stackoverflow.com/q/23718739
tags question: http://stackoverflow.com/q/23735179
tags question: http://stackoverflow.com/q/23676739

http://stackoverflow.com/a/23780847
accepted answer of: http://stackoverflow.com/q/23777891
answers question: http://stackoverflow.com/q/23777891
score: 1
has comment: http://stackoverflow.com/comment/36575405
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
has body: void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException: Parameters: parameterIndex - the first parameter is 1, the second is 2,... sqlType - a value from Types typeName - the fully-qualified name of an SQL structured type You have parameter name, not parameter type. Try use just: cstmt.registerOutParameter(2,OracleTypes.RAW)

http://stackoverflow.com/a/23716530
score: 0
answers question: http://stackoverflow.com/q/23716473
type: Answer
has body: You can use .setVisiblity(int visibility) to hide or show your ImageViews (as per http://developer.android.com/reference/android/view/View.html#setVisibility%28int%29). In your case, you should be able to do: Random random = new Random(); int rndIndex = random.nextInt(IMGS.length); IMGS[rndIndex].setVisibility(View.VISIBLE); To show the view. To hide the last one, I would suggest defining rndIndex with your array so that you could do IMGS[rndIndex].setVisibility(View.GONE); before the chunk of code above, meaning it would look more like: IMGS[rndIndex].setVisibility(View.GONE); Random random = new Random(); rndIndex = random.nextInt(IMGS.length); IMGS[rndIndex].setVisibility(View.VISIBLE); Good luck!

http://stackoverflow.com/comment/47179919
score: 0
comment on: http://stackoverflow.com/q/23743469
type: QuestionComment
type: Comment
has text: Hello, my tomcat is in this location: C:\Tools\apache-tomcat-7.0.52 and i have installed it "by hand". I just said Eclipse to use that location. Same thing happens when i use custom location.

http://stackoverflow.com/comment/70704406
score: 0
type: AnswerComment
type: Comment
has text: Your post was on a review queue for first post of new user. The goal there is to improve answers by editing, commenting, voting, flagging... I saw idiosyncratic formatting, and more intro than needed and trailing sentences that could be succinct and do better above the code. As for the points/badge accusation - you're confused... I *already have* the badge. You can only get one for editing posts. I do it to improve & clean up posts and I've helped a lot of users. It's weird because there are some red flags in what you've said & done that make you sound like you're not new here but only 1 rep
comment on: http://stackoverflow.com/a/41753199

http://stackoverflow.com/q/23764286
tagged with: android-intent
linked to: http://stackoverflow.com/q/18939249
possible better answer: http://stackoverflow.com/a/23764319
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36540867
type: Question
has comment: http://stackoverflow.com/comment/36540859
tagged with: listview
accepted answer: http://stackoverflow.com/a/23764397
has answer: http://stackoverflow.com/a/23764319
score: 0
answer count: 2
tagged with: android-listview
has answer: http://stackoverflow.com/a/23764397
has body: I'm trying to open an activity depending on which item in ListView I chose. Add click to my ListView : private void addClickList() { myList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent intent = new Intent(FirstActi.this, SecondActi.class); startActivity(intent); } }); } This is my android manifest for these two activities : &lt;activity android:name=".FirstActi" android:label="@string/firstActi"&gt; &lt;intent-filter&gt; &lt;action android:name="com.example.applicationname.FirstActi" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".SecondActi" android:label="@string/secondActi" &gt; &lt;/activity&gt; This is the output from the logcat : 05-20 17:28:58.251: E/AndroidRuntime(27073): FATAL EXCEPTION: main 05-20 17:28:58.251: E/AndroidRuntime(27073): Process: com.example.applicationname, PID: 27073 05-20 17:28:58.251: E/AndroidRuntime(27073): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.applicationname/com.example.applicationname.FirstActi}: java.lang.InstantiationException: can't instantiate class com.example.arduinodivecompanion.SecondActi; no empty constructor 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.os.Handler.dispatchMessage(Handler.java:102) 05-20 17:28:58.251: E/AndroidRuntime(27073): at android.os.Looper.loop(Looper.java:136) 05-20 17:28:58.251…
tagged with: android
has title: Fatal error using intent inside a ListView

http://stackoverflow.com/q/23649233
has answer: http://stackoverflow.com/a/23650174
tagged with: clojure-java-interop
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/216894
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23650174
type: Question
has title: Clojure - Java interop: pass an OutputStream argument and get back a String
has comment: http://stackoverflow.com/comment/36321904
answer count: 1
downvote count: 0
tagged with: outputstream
has body: I'm using a java library and want to call a method which exports data. This method has two variants: one with a String parameter which is used as a destination file name, and another which accepts an OutputStream object and writes to it with an OutputStreamWriter. I'd like to use the second method and be able to get back the OutputStream into a String so I can do whatever I want with it. I'm not sure it is possible actually, but as I found clojure.core/with-out-str I'm having some hope that it is possible, however I'm not sure how to use it. Is it possible to pass an OutputStream argument to a Java method from Clojure and get back the written data as a String? Thanks. Edit: Actually, the class constructor takes an OutputStream argument, and a method writes through it and closes it. Hope this helps.
tagged with: clojure
favorite count: 0
has comment: http://stackoverflow.com/comment/36320859
has comment: http://stackoverflow.com/comment/36321304

http://stackoverflow.com/a/23622693
type: Answer
score: 0
has body: Check if your userIdtext2.getText() is null or not. If it is not null, then use userIdtext2.getText().toString() Because using toString() on null object is known to cause NPE Reference : Convert null object to String
answers question: http://stackoverflow.com/q/23622577

http://stackoverflow.com/comment/36316133
type: QuestionComment
comment on: http://stackoverflow.com/q/23646793
has text: check URL address, I think that is incorrect
score: 0
type: Comment

http://stackoverflow.com/q/23673426
type: Question
has answer: http://stackoverflow.com/a/23673511
tagged with: debugging
has body: I am working in a project in Eclipse which uses an ExecutorService class. Well I am not familiar with multithreading or concurrency but the problem I am facing is that when I am debugging I cannot proceed to the next method by using step into (F5). To be more specific I put a breakpoint in: pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.DAYS); and I cannot proceed any further. The execution is suspended and if a unsupened (by pressing the suspend button) it stops to Unsafe.park(boolean, long) which is of java and I cannot see the code. There I cannot seem to be able to proceed any further using unsuspend or step into. The really annoying is that I can proceed using resume (F8) which leads me to the next breakpoint just like nothing happened. If it's of any use the arguments seems to be TERMINATION_TIMEOUT = 100, TimeUnit.DAYS=6. I have seen other posts and I am guessing that an exception was thrown (ThreadPoolExecutor maybe) but the proposed solutions did not work for me or I did not manage to apply them. Anyway any idea how can I overcome this issue?
has comment: http://stackoverflow.com/comment/36370969
score: 0
answer count: 1
type: UnansweredQuestion
has title: java program execution is suspended and I cannot step into
tagged with: multithreading
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/23625001
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36284053
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23624053
type: Answer
answers question: http://stackoverflow.com/q/23624053
has body: Use StyleRange to set multiple occurrences of the string. Snippet: String searchKey = "hello"; String content = styledText.getText(); // StyledText instance int index = content.indexOf(searchKey, 0); do { if (index != -1) { StyleRange styleRange = new StyleRange(index, searchKey.length(), Display.getCurrent().getSystemColor( SWT.COLOR_BLACK), Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); styledText.setStyleRange(styleRange); index = content.indexOf(searchKey, index + 1); } else { System.out.println("End of search"); break; } } while (index != -1); Refer this article an examples here on style ranges.
has comment: http://stackoverflow.com/comment/36283693

http://stackoverflow.com/a/24045571
score: 0
type: AcceptedAnswer
has body: The BufferStrategy class solved my problem. Here is a good link to it, with a well made example of how to use it: http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferStrategy.html
accepted answer of: http://stackoverflow.com/q/23710181
type: Answer
answers question: http://stackoverflow.com/q/23710181

http://stackoverflow.com/q/23685567
tagged with: http://stackoverflow.com/tag/pdf
has body: I am trying to open a PDF file that is packaged into the jar file during runtime. The basic idea is that the user clicks the help option and then it displays a help file that is a PDF. Right now I have this in LineFit.class in the linefit package to try and open the help PDF: try { File test = new File(LineFit.class.getClass().getResource("/linefit/helpTest.pdf").toURI()); try { Desktop.getDesktop().open(test); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } catch (URISyntaxException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } It works in eclipse when I run it but if I try to export it to a runnable JAR file it does not open the PDF file and when I look into the JAR, the PDF is in the same folder as when it was in eclipse.
favorite count: 0
has answer: http://stackoverflow.com/a/61362166
possible better answer: http://stackoverflow.com/a/61362166
type: AnsweredQuestion
has title: Opening a PDF file that is packaged in a JAR
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23688509
accepted answer: http://stackoverflow.com/a/23688509
tagged with: eclipse
type: Question
answer count: 2
upvote count: 1
tagged with: jar

http://stackoverflow.com/comment/36295350
comment on: http://stackoverflow.com/q/23616927
has text: Ohh, I see what you're getting at now. Like I said my regex knowledge is low level, I thought there would be a way to make it work. So then if I don't filter in real time and use `InputVerifier`, would I still use a `MaskFormatter` of `##-###**`? Also, what would I use in the `InputVerifier` to validate the user input?
score: 0
type: QuestionComment
type: Comment

java-native-interface
tags question: http://stackoverflow.com/q/23737199
tags question: http://stackoverflow.com/q/23669931
tags question: http://stackoverflow.com/q/23743860
tags question: http://stackoverflow.com/q/23627732
tags question: http://stackoverflow.com/q/23674160
type: Tag
tag name: java-native-interface
tags question: http://stackoverflow.com/q/23757428
tags question: http://stackoverflow.com/q/23732386
tags question: http://stackoverflow.com/q/23633511
tags question: http://stackoverflow.com/q/23629031
tags question: http://stackoverflow.com/q/23777389
tags question: http://stackoverflow.com/q/23635768

http://stackoverflow.com/a/23637157
score: 0
has comment: http://stackoverflow.com/comment/36297122
accepted answer of: http://stackoverflow.com/q/23635272
has body: I found the reason, as it appears I didn't have any .java files in scr/main/java directory. Instead I had my .javas in src/test/java for some reason. What a stupid mistake. After I moved my .java files to src/main/java, compiled and packaged the .war, I moved my .war to Tomcat webapps directory, restarted the server and was able to run it:)
answers question: http://stackoverflow.com/q/23635272
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23709175
has comment: http://stackoverflow.com/comment/36436011
score: 0
has answer: http://stackoverflow.com/a/23709447
tagged with: apache
answer count: 1
tagged with: tomcat
type: UnansweredQuestion
tagged with: architecture
tagged with: java
type: Question
has title: How to conceptually compute the max of concurrent request/load an server can serve?
has body: During the web application architecture design, I have to conceptually compute how many current client that ONE of my server can serve. Then I can budget it. So, is there any formula to follow about this ? or, How do you compute this? or, usually, how many concurrent client an httpd/tomcat server can serve ?

http://stackoverflow.com/comment/36580034
has text: Can't really tell without seeing you folder structure. At the beginning of the createShowReport function create a file, like `File f = new File("a.txt"); System.out.println(f.getAbsolutePath());`. This will show you the current location, where it is actually searching for the report file as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/23781084
score: 0
type: Comment

http://stackoverflow.com/q/23630429
tagged with: swing
downvote count: 1
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/16730113
score: -1
has comment: http://stackoverflow.com/comment/36283558
has answer: http://stackoverflow.com/a/23630642
duplicate of: http://stackoverflow.com/q/16730113
has body: I' m writing a class in java that extends JPanel for a chess game. Its principal goal is to give to another class one point with the function getXY. When the method getXY is called it starts a new Thread and then it calls wait(). The other thread adds to the panel one mouse listener and when the user clicks on the panel it calculates the coordinates and the notify() the panel, but it gives one error. This is the class: int spacesX; int spacesY; int panelWidth; int panelHeigth; private int x; private int y; public PannelloInputGriglia(int x, int y,int heigth,ChessModel model) { this.setBounds(x, y, (heigth/model.getHeight()*model.getWidth()), heigth); spacesX = model.getWidth(); spacesY = model.getHeight(); panelWidth = this.getWidth(); panelHeigth = this.getHeight(); } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public Point getXY() { InputThread th = new InputThread(this); try { this.wait(); } catch (InterruptedException ex) { Logger.getLogger(PannelloInputGriglia.class.getName()).log(Level.SEVERE, null, ex); } return new Point(x, y); } private class InputThread extends Thread { PannelloInputGriglia pannello; public InputThread(PannelloInputGriglia p) { pannello = p; start(); } @Override public void run() { pannello.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int sectorsX = panelWidth/spacesX; int sectorsY = panelHeigth/spacesY; setX(e.getX() / sectorsX); setY(e.getY() / sectorsY); super.mouseClicked(e); pannello.notify(); } }); } } What can I do?
has comment: http://stackoverflow.com/comment/36283622
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36283686
has title: How to wait one user click in Java?
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/36446264
has text: I think that the method is determined on run time .....
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23714860
type: QuestionComment

http://stackoverflow.com/comment/55015914
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23658824
has text: There are many web (browser-only) viewers for 3D models in STEP files, such as GrabCAD. If you want to see example source code, look at pythonocc.org.

http://stackoverflow.com/q/23627606
favorite count: 0
answer count: 3
tagged with: javac
has answer: http://stackoverflow.com/a/46981449
has answer: http://stackoverflow.com/a/49872350
upvote count: 13
accepted answer: http://stackoverflow.com/a/46981449
has body: I'm testing Java on a Windows Surface Pro. The Surface Pro has Java 7 Update 55, but does not have the JDK installed. I compiled a program on my MacBook from the command line using javac. The MacBook Has Java 8 Update 5 and it includes the JDK (obviously because I compiled on the MBP). When I move the program from the MackBook to the Surface Pro, I get the following error. Here, "moving the program" means copying the two *.class files to the new machine and trying to execute the byte codes. java.lang.UnsupportedClassVersionError: HttpsTest : Unsupported major.minor version 52. Trying to compile with target information results in: $ javac -target 1.7 HttpsTest.java SSLSocketFactoryEx.java javac: target release 1.7 conflicts with default source release 1.8 javac -help does not list any options to control the version information of the compiled program (other than target, which does not appear to work). How do I compile my source files for down level versions of a JRE? In this case, I'm targeting Java 7 from a Java 8 machine.
score: 13
type: AnsweredQuestion
tagged with: java
tagged with: compilation
type: Question
possible better answer: http://stackoverflow.com/a/45349688
has answer: http://stackoverflow.com/a/45349688
tagged with: version
downvote count: 0
has title: Target different version of JRE

http://stackoverflow.com/q/23630828
downvote count: 0
has title: Problems To Cancel A CountDownTimer Android Java
favorite count: 0
has answer: http://stackoverflow.com/a/23630959
upvote count: 8
tagged with: back
type: Question
tagged with: countdowntimer
tagged with: android
has body: When I close my app by pressing the BACK button (onBackPressed() called), the CountDownTimer doesn't stop, until it is done with counting. How can I put the CountDownTimer cancel(); in my onBackPressed()? Because, when I quit my application (shown below with descriptions) I don't want counter toasts on my screen anymore. On top of my code: boolean network_connected = false; What's in my onCreate(): if (check_network.isInternetAvailable(this)) { network_connected = true; new connect_task_main().execute(""); } else { network_connected = false; } if (network_connected == false) { new CountDownTimer(11000, 1000) { public void onTick(long millisUntilFinished) { global.toast.setText("No Internet Connection!" + "\n" + "Automatic Refresh In: " + millisUntilFinished / 1000); //set text for toast global.toast.show(); //show toast } public void onFinish() { if (network_connected == false) { global.cancel_toast(0); //stop all toasts finish(); //quit activity startActivity(new Intent(main_activity.this, main_activity.class)); //start activity } else { } } }.start(); //start the countdowntimer } else { network_connected = true; } onBackPressed() method @Override public void onBackPressed() { if (page_number &gt; global.page_number_min) { //does not matter page_number--; //does not matter global.cancel_toast(0); //stop all toasts network_connected = true; finish(); } else { global.cancel_toast(0); network_connected = true; finish(); //quit activity super.onBackPressed(); //quit application } } Thanks.
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/23630959
has comment: http://stackoverflow.com/comment/36284677
score: 8
linked to: http://stackoverflow.com/q/6423848
type: AnsweredQuestion

http://stackoverflow.com/a/71350530
answers question: http://stackoverflow.com/q/23736429
score: 0
type: Answer
has body: You can also cast into a List of strings using readAllLines() and then loop through it. List<String> myfilevar = Files.readAllLines(Paths.get("/PATH/TO/MY/FILE.TXT")); for(String x : myfilevar) { System.out.println(x); }

http://stackoverflow.com/a/23680364
score: 1
has comment: http://stackoverflow.com/comment/36382990
has comment: http://stackoverflow.com/comment/36383459
upvote count: 1
has comment: http://stackoverflow.com/comment/36382402
answers question: http://stackoverflow.com/q/23679564
has comment: http://stackoverflow.com/comment/36383614
downvote count: 0
type: Answer
has body: I note a little redundancy. It shouldn't, by itself, cause these problems, but it may be worth exploring: You use &lt;context:component-scan base-package="main.java.com.springapp.mvc" &gt;, which seems like it's intended to load your @Controller-annotated DSLRServletController. If that is the case, then there is no need to declare the bean named s in your XML configuration. You can simply put @Autowired on the bean property setters. Alternatively, you can remove the &lt;context:component-scan&gt; from your XML configuration, and trust your delcaration of the controller to be sufficient. Additionally, though it's probably not related. If you load something using @Controller and classpath annotation scanning, you don't need to implement HttpServlet at all. The point of @Controller and Spring MVC is to make it so that your controllers can be Plain Old Java Objects (POJOs). Most importantly, it looks like your web.xml is only causing mvc-dispatcher-servlet.xml to be loaded (by using the servlet name as a hint), and nothing is loading DSLRServletController-servlet.xml. A consequence of this, is that your &lt;context:component-scan base-package="main.java.com.springapp.mvc"/&gt; is causing the controller to be loaded, but none of it's properties are being set. To further clean up your system, move your DSLRServletController-servlet.xml into mvc-dispatcher-servlet.xml so that your spring contexts are configured from a single config.

http://stackoverflow.com/a/54274959
downvote count: 0
answers question: http://stackoverflow.com/q/23623098
upvote count: 2
has body: Starting Scala 2.13, scala.util.Random provides: def between(minInclusive: Int, maxExclusive: Int): Int which used as follow, generates a 6-digit Int (between 100_000 (included) and 1_000_000 (excluded)): import scala.util.Random Random.between(100000, 1000000) // in [100000, 1000000[
type: Answer
score: 2

http://stackoverflow.com/comment/36480118
score: 0
type: AnswerComment
has text: Where is your put for `doc_id` ? What error are you getting ? First you have to put your json parameters to jsonobject and then you call the method as above answer.
type: Comment
comment on: http://stackoverflow.com/a/23731407

http://stackoverflow.com/q/23641872
has answer: http://stackoverflow.com/a/23641992
has body: I'm making a quiz like game. I have two arrays (One with the states and the other with the capitals). Basically it asks the user what capital goes with a random state. I want that if the user inputs the correct state for it to be like nice job or whatever but I do not know how to compare the user input to the specific array compartment. I tried .contains but no avail... Any help? My bad - I'm using Java For Example if(guess.equals(capitals[random])) where guess is the string and capitals is the array and random is the random number
accepted answer: http://stackoverflow.com/a/23641992
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36306927
tagged with: arrays
score: 0
tagged with: compare
tagged with: string
possible better answer: http://stackoverflow.com/a/23642354
linked to: http://stackoverflow.com/q/3413586
has answer: http://stackoverflow.com/a/23642354
has title: How to compare a string to a specific compartment of an array of strings?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36562031
has text: You mean something like [this](http://stackoverflow.com/questions/23751298/how-to-compare-an-rgb-value-to-color/23751541#23751541)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23775266
score: 0

http://stackoverflow.com/comment/36426333
has text: Yeah, I'm not surprised. I've only seen people setting -Xmx in multiples of 1m so in most cases I wouldn't expect it to be an issue.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23702224

http://stackoverflow.com/q/23668991
has title: Error deploying Grails application - Beginner
tagged with: groovy
type: Question
has comment: http://stackoverflow.com/comment/36359873
accepted answer: http://stackoverflow.com/a/23671352
score: 5
has comment: http://stackoverflow.com/comment/36359887
has comment: http://stackoverflow.com/comment/36360033
answer count: 1
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36359742
has comment: http://stackoverflow.com/comment/36360703
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36359909
has comment: http://stackoverflow.com/comment/36359764
has answer: http://stackoverflow.com/a/23671352
tagged with: grails
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36359835
has body: I am having issues deploying a Grails application. Everything works in the local test environment. ERROR [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO Exception: "java.io.FileNotFoundException: /var/lib/tomcat7/prodDb.lock.db (Permission denied)"; "/var/lib/tomcat7/prodDb.lock.db" [90031-164]) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error cre…
favorite count: 0

http://stackoverflow.com/a/23623045
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23618729
answers question: http://stackoverflow.com/q/23618729
has body: Indeed as Etan pointed out, you're creating a string from the entire buffer--all 512 bytes--instead of a string of the correct length, so the string that is created has lots of zero bytes at the end. A simple fix would be to use the String constructor that cuts off the buffer at the position and length you specify, along with the number of bytes received from the packet from DatagramPacket.getLength Change the line assigning received to String received = new String(incomingBytes, 0, incomingPacket.getLength());
score: 0

http://stackoverflow.com/q/23678355
has comment: http://stackoverflow.com/comment/36378065
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36378691
has title: Return value from Sequence using JPQL
has body: I am trying to use a Sequence in SQL on an Oracle Database to retrieve an ID before I run a query. But for some reason it never returns an integer for me that I can use. Just null. The SQL query have been tested to work before I decided to do the application with this Netbeans Persistency approach. Query idRes = manager .createNativeQuery("SELECT seq_bug.nextval from dual"); manager.getTransaction().begin(); idRes.executeUpdate(); manager.getTransaction().commit(); int id = (Integer) idRes.getParameterValue(0); Query q = manager. createNativeQuery( "INSERT INTO REPORTEDBUG" + "VALUES(?,?,?,?,?,?,?,?,?)"); manager.getTransaction().begin(); q.setParameter(1, id); q.setParameter(2, author); q.setParameter(3, bugtype); q.setParameter(4, component); q.setParameter(5, sysversion); q.setParameter(6, priority); q.setParameter(7, assignedto); q.setParameter(8, status); q.setParameter(9, desc); q.executeUpdate(); manager.getTransaction().commit(); I guess I am just placing int id = (Integer) idRes.getParameterValue(0); wrong but I can't figure out what else it could be.
tagged with: jpql
score: 0
tagged with: persistence

http://stackoverflow.com/q/23678958
score: 0
has answer: http://stackoverflow.com/a/24014505
answer count: 1
has title: Custom Component extending JavaFX 8 TreeTableView
tagged with: java
type: UnansweredQuestion
tagged with: javafx-8
type: Question
tagged with: javafx-2
has body: I have a class MyTreeTableView extending TreeTableView I have implmented few methods to populate the treeview by passing an observable list in my derived class, which is not available in the original TreeTableView. Other than that there are no additional functionalities. I am able to use this class and it works as intended when coding in Java i.e MyTreeTableView localtree = new MyTreeTableView(new TreeItem&lt;&gt;()); localtree.setItems(myobservedList); If I add this instance to a scene everything works like a standard TreeTableView.. To add this instance to the scene I have to do this on the Java side. I have to make my class MyTreeTableView in to a custom FXML component so that its accessible using scene builder for easy drag and drop. Before venturing on to the custom component side of FXML, I tried to assign the localtreetable to a standard Java FX 8 TreeTableView which is defined in the FXML and is part of the existing scene. I did the following localtreetable.getColumns().addAll(col1,col2); localtreetable.setShowRoot(false); localtreetable.setItems(myobservedList); JavaFX8TreeTableView.setRoot(localtreetable.getRoot()); col1 = (TreeTableColumn&lt;Object, String&gt;) JavaFX8TreeTableView.getColumns().get(0); col2 = (TreeTableColumn&lt;Object, String&gt;) JavaFX8TreeTableView.getColumns().get(1); //setCellValueFactory and CellFactories for col1 and col2 after this. Here col1 and col2 are defined in the FXML and they are the columns of the JavaFX8TreeTableView which is also defined in the FXML. With this hack, the JavaFX8TreeTableView shows up on the UI with the data populated in the localtreetable object. However the UI is not correctly intended and the tree view is messed up. When I say messed up, the tree is in proper order, but the > is placed on the 4th letter of a tree item and a click on the arrow doesn't expand or close the tree item, you have to click it at some other location for it to expand and close it. My first issue is how do I transpose values fro…

http://stackoverflow.com/a/23667558
score: 0
has body: Use- scanner.nextBoolean() do{ try{ System.out.print("Are you above 18?"); Scanner scanner = new Scanner(System.in); if(scanner.nextBoolean()==true) //do stuff }else{ //do stuff } }
type: Answer
answers question: http://stackoverflow.com/q/23667462

http://stackoverflow.com/q/23643584
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23645289
accepted answer: http://stackoverflow.com/a/23645289
type: Question
has title: Rx Zip buffered observables of uneven length
upvote count: 1
tagged with: rx-java
answer count: 1
favorite count: 0
tagged with: buffer
has body: The problem I'm trying to solve is expressed in the following code: @Test public void buffer_shouldZipAllTheThings() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); Observable&lt;List&lt;String&gt;&gt; strings = Observable.from(Arrays.asList("red", "blue", "yellow", "green")).buffer(3); Observable&lt;List&lt;Integer&gt;&gt; integers = Observable.from(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).buffer(3); class Zipped { final List&lt;String&gt; strings; final List&lt;Integer&gt; integers; Zipped(List&lt;String&gt; strings, List&lt;Integer&gt; integers) { this.strings = strings; this.integers = integers; } @Override public String toString() { return "Strings: { " + strings.toString() + " }\n" + "Integers: { " + integers.toString() + " }"; } } Observable&lt;Zipped&gt; zipper = Observable.zip(strings, integers, new Func2&lt;List&lt;String&gt;, List&lt;Integer&gt;, Zipped&gt;() { @Override public Zipped call(List&lt;String&gt; strings, List&lt;Integer&gt; integers) { return new Zipped(strings, integers); } }); zipper.subscribeOn(Schedulers.newThread()).subscribe(new Subscriber&lt;Zipped&gt;() { @Override public void onCompleted() { latch.countDown(); } @Override public void onError(Throwable throwable) { } @Override public void onNext(Zipped zipped) { System.out.println("-- New zipped object: "); System.out.println(zipped.toString()); } }); latch.await(); } Here is the output of this test: -- New zipped object: Strings: { [red, blue, yellow] } Integers: { [1, 2, 3] } -- New zipped object: Strings: { [green] } Integers: { [4, 5, 6] } Here is my desired output: -- New zipped object: Strings: { [red, blue, yellow] } Integers: { [1, 2, 3] } -- New zipped object: Strings: { [green] } Integers: { [4, 5, 6] } -- New zipped object: Strings: { [] } Integers: { [7, 8, 9] } -- New zipped object: Strings: { [] } Integers: { [10, 11] }

http://stackoverflow.com/q/23735503
answer count: 1
has title: Simple Java Server to listen to a client and redirect[302] to some other site
favorite count: 0
has answer: http://stackoverflow.com/a/23736292
score: -3
type: AnsweredQuestion
has body: Before you close this question as duplicate, I tried many thing found here and nothing worked. A bit new to server coding in Java. What I need is a simple server which should listen to a port to get some data. I need to work on the data, and save it somewhere(that I can handle) and then redirect to some other website. I started with simple server using Sockets then people started suggesting tomcat and all. Tried many things, got lost in set ups, and configurations... and at last coming back here to ask (thinking why didn't I do this earlier). Please let me know if you need more info. EDIT: What I am doing - Using Serversocket with thread to handle multiple requests. Done Reading client request BufferedReader and working on it. Done Need to do a post request after processing. To do. :( Need to respond to client with 302 redirect. Not sure if working - out = new PrintWriter(s.getOutputStream(), true); out.println("HTTP/1.0 302 Found"); out.println("Location: http://www.xyz.co"); out.flush(); out.close(); connection.close();
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/3696986
has comment: http://stackoverflow.com/comment/36526098
type: Question
has comment: http://stackoverflow.com/comment/36489379
upvote count: 0
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23736292
has comment: http://stackoverflow.com/comment/36487215

http://stackoverflow.com/comment/36374167
comment on: http://stackoverflow.com/a/23675344
type: AnswerComment
score: 0
has text: Turns out, "copy your txt file from assets to internal storage" is harder than it sounds. Any tips or links to a good guide?
type: Comment

http://stackoverflow.com/comment/36559639
comment on: http://stackoverflow.com/a/23756436
score: 0
type: AnswerComment
has text: `http://localhost:8080/demo/index` still says `404 Not found` and `http://localhost:8080/demo/index.action` gives me the required form. I am testing it on Jetty: `mvn jetty:run`
type: Comment

http://stackoverflow.com/a/23828982
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23649839
downvote count: 0
has body: You can also try Google dd-plist.jar libraries or SAXON parse for parsing plist. Go through this conversion : https://code.google.com/p/plist/wiki/Examples http://developer.android.com/reference/javax/xml/parsers/SAXParser.html You can use dd-plist jar for doing this, Download dd-plist.jar from Google its nice and fast. I am putting an example working for me from Google code colud. Link is here. http://plist.googlecode.com/svn-history/r61/trunk/src/com/dd/plist/XMLPropertyListParser.java package com.dd.plist.test; import com.dd.plist.*; import java.io.File; import java.util.Arrays; import java.util.Date; import junit.framework.TestCase; public class ParseTest extends TestCase { /** * Test the xml reader/writer */ public static void testXml() throws Exception { System.out.println(new File("test-files/")); // parse an example plist file NSObject x = PropertyListParser.parse(new File("test-files/test1.plist")); // check the data in it NSDictionary d = (NSDictionary)x; assertTrue(d.count() == 5); assertTrue(((NSString)d.objectForKey("keyA")).toString().equals("valueA")); assertTrue(((NSString)d.objectForKey("key&amp;B")).toString().equals("value&amp;B")); assertTrue(((NSDate)d.objectForKey("date")).getDate().equals(new Date(1322472090000L))); assertTrue(Arrays.equals(((NSData)d.objectForKey("data")).bytes(), new byte[]{0x00,0x00,0x00,0x04,0x10,0x41,0x08,0x20,(byte)0x82})); NSArray a = (NSArray)d.objectForKey("array"); assertTrue(a.count() == 4); assertTrue(a.objectAtIndex(0).equals(new NSNumber(true))); assertTrue(a.objectAtIndex(1).equals(new NSNumber(false))); assertTrue(a.objectAtIndex(2).equals(new NSNumber(87))); assertTrue(a.objectAtIndex(3).equals(new NSNumber(3.14159))); // read/write it, make sure we get the same thing PropertyListParser.saveAsXML(x, new File("test-files/out-testXml.plist")); NSObject y = PropertyListParser.parse(new File("test-files/out-testXml.plist")); assertTrue(x.equals(y)); } /** * Test the binary reader/writer. */ public static void test…
type: Answer

http://stackoverflow.com/q/23674046
has answer: http://stackoverflow.com/a/26796142
upvote count: 258
answer count: 14
has answer: http://stackoverflow.com/a/70708440
has answer: http://stackoverflow.com/a/63818381
has comment: http://stackoverflow.com/comment/93673361
has answer: http://stackoverflow.com/a/55431133
linked to: http://stackoverflow.com/q/36915823
has answer: http://stackoverflow.com/a/68444148
has title: Get list of JSON objects with Spring RestTemplate
has answer: http://stackoverflow.com/a/46177164
downvote count: 1
has answer: http://stackoverflow.com/a/67866678
has body: I have two questions: How to map a list of JSON objects using Spring RestTemplate. How to map nested JSON objects. I am trying to consume https://bitpay.com/api/rates, by following the tutorial from http://spring.io/guides/gs/consuming-rest/.
score: 257
has answer: http://stackoverflow.com/a/31947188
has answer: http://stackoverflow.com/a/71940625
has answer: http://stackoverflow.com/a/53790813
tagged with: resttemplate
accepted answer: http://stackoverflow.com/a/23675418
has answer: http://stackoverflow.com/a/30247904
tagged with: spring
has answer: http://stackoverflow.com/a/53384092
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23675418
type: Question
linked to: http://stackoverflow.com/q/50826061
possible better answer: http://stackoverflow.com/a/31947188
favorite count: 0
has answer: http://stackoverflow.com/a/48511717

http://stackoverflow.com/q/23668095
tagged with: file-io
has comment: http://stackoverflow.com/comment/36358446
downvote count: 1
has comment: http://stackoverflow.com/comment/36358086
has comment: http://stackoverflow.com/comment/36358380
has comment: http://stackoverflow.com/comment/36358388
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/36358281
tagged with: frequency
has comment: http://stackoverflow.com/comment/36358275
type: UnansweredQuestion
has title: Reading a File Containing Words in Order to Count its Frequency
has comment: http://stackoverflow.com/comment/36358006
has body: I am working on a program that will read a file in order to find the frequency of words. I have to create a void method that will read the file of unique words to count it. I am completely new to Java. I have been reading my textbook and other online sources in order to understand the concept/process of reading a file for this specific purpose, but I am still struggling to implement the logic of it. I'd like to know what I am missing/or doing wrong that prevents me from reading the file to count the frequency of words. Here is my code: [This is a part of my code. The other methods(such as the method for sorting the frequency and getting the output) are also within the same class - not included here.] import java.io.*; import java.util.*; public class CountingFrequencyOfWords { int frequency [] = new int [999]; String words [] = new String [999]; int uniqueCount = 0; int count_Word= 0; public void methodForInput() throws Exception { File file = new File("file.txt"); Scanner input = new Scanner(file); String x; int i = 0; while(input.hasNext()) { x = input.next(); count_Word[i] = x; i = i + 1; if (i == uniqueCount) { uniqueCount[i] = x; uniqueCount = uniqueCount + 1; } frequency[i] = frequency[i] + 1; } } }
has comment: http://stackoverflow.com/comment/36358518
tagged with: java
has answer: http://stackoverflow.com/a/23668488
has comment: http://stackoverflow.com/comment/36358558
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36358052
has comment: http://stackoverflow.com/comment/36358178
score: -1
has answer: http://stackoverflow.com/a/23668637
has comment: http://stackoverflow.com/comment/36358631
has comment: http://stackoverflow.com/comment/36358772

http://stackoverflow.com/q/23693427
upvote count: 5
has title: Is it possible to use EVAL SHA with spring-data redis?
has answer: http://stackoverflow.com/a/23715795
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/40126512
downvote count: 0
tagged with: spring-data-redis
favorite count: 0
possible better answer: http://stackoverflow.com/a/40126512
tagged with: redis
accepted answer: http://stackoverflow.com/a/23715795
type: AnsweredQuestion
has body: Is it possible to use the Redis command EVAL SHA command with Spring-Data Redis? We are successfully using EVAL with execute command: redisTemplate.execute(script, null, args);, but it seems to put great overhead to transfer script to the Redis server each time. Is it possible to store the script once and run it based on its SHA, using Spring-Data Redis?
tagged with: java
type: Question

http://stackoverflow.com/q/23679990
has body: I am using regular expression to restrict sections of my website and sometimes subsections as well, but there is kind of url which I am not able to restrict so far, and that is with parameters. &lt;intercept-url pattern="^/(?i)(hardcopy|hardcopy/[^/]*|china_digest)/(article)?(\d+)(\.|/).*$" access="isPanicking() or check14DayAccess() or checkFeatureIndicator() or (isAuthenticated() and hasGotPermission('title:UP', 'product:UP,ONUP,UPON') and getAccessDetails())"/&gt; Now as you could see hardcopy subsections are restricted when I use hardcopy/[^/]* but I have two url's www.website.com/china_digest/?hashedzmagsid=dd4da72e&amp;magsid=248106 and www.website.com/china_digest/2004/article1189217.ece, this I am not able to block with the same pattern. Any ideas how this could be achieved? Thanks in advance.
linked to: http://stackoverflow.com/q/10467930
has comment: http://stackoverflow.com/comment/36380651
tagged with: spring-security
has title: spring security url regex pattern
duplicate of: http://stackoverflow.com/q/10467930
has comment: http://stackoverflow.com/comment/36381911
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36381017
tagged with: spring
tagged with: regex
tagged with: spring-mvc
answer count: 0
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/23739137
has body: I am pretty new to Elastic Search. I have following things in my code OR looking for solution to 'No Node Available Exception' problem in the following scenario. 1) We have ES running on System with 1 Node and 1 Cluster. 2) We have 4 indexes on ES. (Each index has different type of data, Example: Customer Preference / Customer Address / Customer Interests / Customer Basic Details) 3) We have WebApplication (as webservice) running on Tomcat. 4) We are calling webservice method as Controller's. -This will receive request from consumers in the form JSON data. 5) Based on that data(Example: If consumers asks for Customer Preference for given customer Id then we go to 'Customer Preferences' index) we will go to service(using Spring) layers. 6) In each of the service layer we get TransportClient instance in SingleTon object and wait for its response and return the result to Controller. In a Scenario if consumer asks for all 4 types of data for a Customer, and if we ask first for preference, address, interests and basic details in sequence. It works well. But this adds to performance. So we want these things to process and get data parallel. So we used Spring Task Executors to do this parallel. In that case we get data from one index and others will get 'No Node Available Exception'. Its pretty random to on say on which data we get this problem. Pleas help me here. Thanks in advance!....
score: 2
downvote count: 0
answer count: 1
tagged with: transport
favorite count: 0
accepted answer: http://stackoverflow.com/a/30189496
tagged with: elasticsearch
tagged with: client
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Getting 'No Node Available Exception' while using TrasnsportClient of ElasticSearch
type: Question
has comment: http://stackoverflow.com/comment/36661597
tagged with: native
has answer: http://stackoverflow.com/a/30189496
has comment: http://stackoverflow.com/comment/36502860

http://stackoverflow.com/comment/36301498
score: 0
type: AnswerComment
has text: The questioner said like @ ALWAYS@ , it is in the 3rd position. Gone with the same assumption.
comment on: http://stackoverflow.com/a/23639061
type: Comment

http://stackoverflow.com/comment/36476058
type: Comment
type: QuestionComment
has text: Hmmm, where is this? Can't seem to find it in JLS 8, although it could be Preview failing me
score: 0
comment on: http://stackoverflow.com/q/23729821

http://stackoverflow.com/comment/36442684
score: 0
has text: Note that the (sorta) correct way to convert the first to the second would be to multiply out the offset value represented by the timezone and add/subtract that to the milliseconds.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23712780

http://stackoverflow.com/q/23770007
tagged with: signing
has title: class "Scanx" does not match the trust level of other classes in the same package
type: Question
has answer: http://stackoverflow.com/a/23770951
accepted answer: http://stackoverflow.com/a/23770951
tagged with: security
score: 0
answer count: 1
tagged with: applet
has body: I'm attempting to use some other jar files that have functions I'd like to access. The are public, and I have sample code I built my test app from. It appears to be signing related (ie they are signed, mine was self-signed). When I attempt to load the applet in a webpage I am asked if I wish to block or unblock. If I tell it to unblock I get the following error: class "Scanx" does not match the trust level of other classes in the same package. I've read at least a dozen different articles but they either don't apply or exceed my ability to understand at my current level of Java coding knowledge. I'd really appreciate any thoughts on how to get past this so I can test &amp; complete my java applet? Code is below: &lt;html&gt;&lt;body&gt; &lt;applet id=scanx name=scanx code="Scanx.class" height="600" width="600" archive="./Scanx.jar,./ij.jar,./plugin.jar,./twain.jar"&gt;&lt;/applet&gt; &lt;script type="text/javascript"&gt; function scanit() { document.scanx.getScan(); } &lt;/script&gt; &lt;input type=button onclick="scanit();"&gt; &lt;/body&gt;&lt;/html&gt; Here's my java code, which I compile into a jar using "jar cvf Scanx.jar Scanx.java" ... package uk.co.mmscomputing.device.twain.applet; import javax.swing.JApplet; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.awt.image.RasterFormatException; import javax.imageio.ImageIO; import netscape.javascript.*; import java.io.File; import uk.co.mmscomputing.device.scanner.Scanner; import uk.co.mmscomputing.device.scanner.ScannerListener; import uk.co.mmscomputing.device.scanner.ScannerDevice; import uk.co.mmscomputing.device.scanner.ScannerIOException; import uk.co.mmscomputing.device.scanner.ScannerIOMetadata; public class xScanx extends JApplet implements ActionListener, ScannerListener{ int index = 0; String filename; Scanner scanner; public Scanx(){ } public Scanx(String title, String[] argv){ init(); } public void init(){ scanner=Scanner.getDev…
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36600145
type: Comment
has text: great thanks, but what do you mean by configuration files? would you give me an example
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23793376

http://stackoverflow.com/comment/36388463
has text: What I want is to loop directly in the second level, as I already know the value for the first and the last.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23684051

http://stackoverflow.com/q/23729029
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23729164
has body: Okay, I am still very much a Java newbie. To be honest, this is for a homework assignment, but I am beating my head against the wall right now. I don't have any idea where to go from here. I'm writing an inventory program for the assignment, and it MUST use a normal array. Not an ArrayList The part I am stumped on is the part where you have to add a new entry to the array. I managed that by using Arrays.copyof to create a second version of it, then to recopy it to the original with an enhanced length. It seems to work, through the console I can print my new array no problem, complete with the new entry. The problem I am encountering is with my gui for it.. Every time I try to display the new entry in my gui I get "Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5" I'm sure its some stupid mistake I'm making, but I've had a long day and I'm completely stumped on this. package inventoryprogram3; public class Inventoryprogram3 { public static void main(String[] args) { inventoryGui gui = new inventoryGui(); gui.setVisible(true); } } package inventoryprogram3; import java.io.Serializable; class sItem implements Serializable{ int itemNumber; String itemName; int itemStock; double itemPrice; double stockTotal; public sItem(int iNumber, String iName, int iStock, double iPrice){ itemNumber = iNumber; itemName = iName; itemStock = iStock; itemPrice = iPrice; } } public class rBook extends sItem { int pCount; double rFee; public rBook(int iNumber, String iName, int iStock, double iPrice, int pageCount) { super(iNumber, iName, iStock, iPrice); pCount = pageCount; rFee = (iPrice * iStock) * 1.05; } } package inventoryprogram3; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.text.NumberFormat; import java.util.Arrays; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; public class inventoryGui extends javax.swing.JFrame { /** * Creates new form…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36474540
tagged with: swing
has answer: http://stackoverflow.com/a/23729164
type: Question
has title: java swing ui not displaying rebuilt array index out of bounds
tagged with: java
tagged with: indexoutofboundsexception
score: 0

http://stackoverflow.com/comment/36267665
comment on: http://stackoverflow.com/q/23621741
has text: Maybe you got `this.height = height` backwards.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23646098
has comment: http://stackoverflow.com/comment/36314847
answer count: 4
type: AnsweredQuestion
tagged with: onclicklistener
downvote count: 0
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/23646174
has title: Android - Can I use setOnLongClickListener and setOnClickListener for same button?
type: Question
has answer: http://stackoverflow.com/a/23646174
has answer: http://stackoverflow.com/a/23646330
has comment: http://stackoverflow.com/comment/36314857
has answer: http://stackoverflow.com/a/23646258
possible better answer: http://stackoverflow.com/a/23646241
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/23646241
tagged with: android
has comment: http://stackoverflow.com/comment/36315027
has body: Can I really use these setOnLongClickListener and setOnClickListener for same button? Because if I long click the button both longclick and normal click will be executed and I dont know why. Can I really do this? Please help me:) readDbButton.setOnLongClickListener( new View.OnLongClickListener() { public boolean onLongClick(View view) { //do something return false; } } ); readDbButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { //Do something else } });
has comment: http://stackoverflow.com/comment/36314839

http://stackoverflow.com/comment/36507974
type: QuestionComment
comment on: http://stackoverflow.com/q/23746996
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)
score: 0
type: Comment

http://stackoverflow.com/a/23656999
accepted answer of: http://stackoverflow.com/q/23656788
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23656788
has body: The reason is by default, if you POST your data, the data will be wrapped in request body, and you got content-type: application/x-www-form-urlencoded
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36336128
type: QuestionComment
type: Comment
has text: @jameslarge An expression evaluates to a value. You're right, the `return` is the problem since it itself _is_ a statement and doesn't evaluate to a value, which is required for the last part of the ternary operator.
score: 0
comment on: http://stackoverflow.com/q/23656833

http://stackoverflow.com/q/23683940
has comment: http://stackoverflow.com/comment/36532512
has comment: http://stackoverflow.com/comment/36531915
has comment: http://stackoverflow.com/comment/36673613
type: AnsweredQuestion
upvote count: 0
tagged with: jce
has comment: http://stackoverflow.com/comment/36480848
favorite count: 0
has body: I have two applets. One does: RSAPrivateKey sKey = getPrivateKey(keyFile); Cipher cipher = Cipher.getInstance("RSA/None/OAEPWithSHA512AndMGF1Padding"); cipher.init(Cipher.DECRYPT_MODE, sKey); sKey is 2048 bits long. the other one: byte[] kSession= fileToBytes(kSessionFile); SecretKeySpec skeySpec = new SecretKeySpec(kSession, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); kSession is 32 Bytes long I am aware of the need to install extended JCE Unlimited Strength Jurisdiction Policy files for some cryptographic operations, as noted here. My question is, when these jars are not installed, why does encryption throw the same exception while decryption does not?
type: Question
tagged with: encryption
downvote count: 2
has title: InvalidKeyException for encryption but not for decryption
score: -2
has comment: http://stackoverflow.com/comment/36390310
has answer: http://stackoverflow.com/a/23744165
tagged with: java
has comment: http://stackoverflow.com/comment/36554971
answer count: 1
linked to: http://stackoverflow.com/q/6481627
accepted answer: http://stackoverflow.com/a/23744165

http://stackoverflow.com/comment/36401188
type: Comment
type: QuestionComment
has text: There's no such class? I debugged thru it. It's located here: \.m2\repository\org\springframework\boot\spring-boot-actuator\1.0.1.RELEASE\spring-boot-actuator-1.0.1.RELEASE-sources.jar!\org\springframework\boot\actuate\autoconfigure\EndpointAutoConfiguration.java
comment on: http://stackoverflow.com/q/23687369
score: 0

http://stackoverflow.com/comment/36296140
type: QuestionComment
comment on: http://stackoverflow.com/q/23636187
has text: Does the mobile device have a reliable connection to whatever network you're communicating over? Maybe you could test on a LAN if you're using whatever data network your provider has.
score: 0
type: Comment

http://stackoverflow.com/q/23761963
has answer: http://stackoverflow.com/a/23775980
score: 0
answer count: 1
tagged with: rest
tagged with: wcf
type: UnansweredQuestion
has body: So i am developing some WCF REST WebService methods. The application that will consume them is a blackbox to me, i only know it is a Phonegap app (java) and the method definition. I also have the sourcecode for the equivalent JAVA rest services developed for the same app, but for a different system. The idea is that many HR systems can use the same app by implementing the webservices. The documentation says method expects "application/json" in the body of the request, which translates to regular String in .NET. Howeber I get a bad request when i deploy the webservice and have the Phonegap-App call this method. Seeing the already-implemented and working properly java implemenation of the service, the said method expects a Java.Io.InputStream as input in the body like that : @Override public Response manageSubAbs(String codeEnv, String user, String password, String produit, String module, InputStream absSubFlux) { //do stuff } All parameters but the last one are URL-Query parameters, the Inputstream is expected in the body as i confirmed via Fiddler. So, since there is no InputStream equivalent in .NET ....is there a way i can develop a WCF REST method accepts such an input or what are my options? Thank you
tagged with: java
has title: WCF REST Service with Java.IO.InputStream as body input
tagged with: inputstream
type: Question

http://stackoverflow.com/a/23707944
has comment: http://stackoverflow.com/comment/36433901
type: Answer
has comment: http://stackoverflow.com/comment/36434932
has comment: http://stackoverflow.com/comment/36433597
has comment: http://stackoverflow.com/comment/36433999
has comment: http://stackoverflow.com/comment/36434062
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/36433478
upvote count: 3
has comment: http://stackoverflow.com/comment/36434825
has comment: http://stackoverflow.com/comment/36433921
answers question: http://stackoverflow.com/q/23707833
has comment: http://stackoverflow.com/comment/36433414
has body: No, an InputStream will return -1 when the socket is closed. End of stream means "End of File" ie. closed connection. It doesn't mean "no data read". The socket is likely still open, so your code is blocking for the next request and never returning a -1. It will not return until either more data arrives, or the stream is closed. The request is probably an HTTP 1.1 request. With HTTP 1.1, the socket will stay open to allow reuse of the connection, unless your server decides not to honor it, or the web browser decides to close it. The point of HTTP 1.1 is to allow multiple HTTP requests to pipeline on a single TCP stream connection, and avoid the overhead of build/teardown. A socket can stay open, but idle with no data for a long time, so if you try to read from it with a blocking call, your code will hang. The Java InputStream.read() call will block, because it cannot return 0, since 0 is a valid byte value. I recommend that you switch to an alternate read() form, in any case. Finally, if you are going to write an HTTP server, you shouldn't be using end of stream as your only method of managing the incoming request, you need to parse or scan the request for a legally formed HTTP request, and once received, serve a response, then close the connection. As it is, your current approach doesn't know if/when the HTTP response is well-formed or complete. Refer to online RFC of the HTTP protocol for the format of a legal request. Request lines end in CR-LF (carriage return + linefeed). You read the 1st line as the request (command), and then a single empty line (CR-LF only), then any HTTP headers will be 1 per line, and when you receive the next empty line, it is the end of the request. You should at minimum issue a "Connection: close" header if you intend to close the socket. Otherwise the client may think your server can handle pipelined requests. http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36433430
has comment: http://stackoverflow.com/comment/36433467
has comment: http://stackoverflow.com/comment/36434863
has comment: http://stackoverflow.com/comment/36433804
has comment: http://stackoverflow.com/comment/36434785
accepted answer of: http://stackoverflow.com/q/23707833

http://stackoverflow.com/comment/36368944
score: 1
comment on: http://stackoverflow.com/q/23673925
type: Comment
type: QuestionComment
has text: @BirajZalavadia why asynctask has to be the answer to every threading question?

http://stackoverflow.com/comment/36497662
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23741636
has text: `println()` is irrelevant to this scenario. Any function call would have the strings behave the same way.

http://stackoverflow.com/comment/36566650
has text: Thank you. It works with a little error about 10pi I will try to fix it and post the working version afterwards.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23770306
type: Comment

http://stackoverflow.com/q/23758248
has body: Is there any way to display the code by the help of using textview. Here is my problem, when i write the code into android:text=" " of the textview it shows an error.I am just trying to show the code using textview. Please help me Error 1(Line 14):String literal is not properly closed by a double-quote Error 2(line 20):Multiple markers at this line - Illegal modifier for the local class MainActivity; only abstract or final is permitted - The nested type MainActivity cannot hide an enclosing type Here is my xmlcode: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.test.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;/FrameLayout&gt; Here is my Java Code: package com.example.test; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.widget.TextView; import com.example.han.R; public class MainActivity extends ActionBarActivity { TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv=(TextView) findViewById(R.id.textView1); tv.setText("package com.example.test; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import com.example.han.R; public class MainActivity extends ActionBarActivity { @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; } }"); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/36570416
tagged with: android
has comment: http://stackoverflow.com/comment/36529228
tagged with: textview
linked to: http://stackoverflow.com/q/1529068
answer count: 0
has comment: http://stackoverflow.com/comment/36529295
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36529299
upvote count: 1
has comment: http://stackoverflow.com/comment/36529494
type: Question
has title: Display programming language code exactly as it is in textview
score: 1
has comment: http://stackoverflow.com/comment/36529999
tagged with: java
has comment: http://stackoverflow.com/comment/36529511
downvote count: 0

http://stackoverflow.com/comment/36398769
has text: So is it fair to say then that once a Callable starts it will not release its thread back to the pool until it has completed its task? Even if it has nothing to do? A quick test program suggests that is true. I placed a Callable that does nothing but `Thread.sleep(10000)` and that also holds up the queue till its finished (although arguable that *should* effect the thread itself anyway)
score: 0
comment on: http://stackoverflow.com/a/23689225
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/36552675
type: AnswerComment
comment on: http://stackoverflow.com/a/23769991
score: 0
type: Comment
has text: @UraniumDevelopers If you are converting to a String, you can use the constructor `new String(bytes, 0, length, charset);` This way you don't need reset the bytes, just use the bytes which are valid.

http://stackoverflow.com/a/23735249
has comment: http://stackoverflow.com/comment/36591044
type: AcceptedAnswer
has body: As said by others, synchronized already gives you a fairly efficient tool. So using something different should not be motivated by hoping for better performance. However, if your intention is not to block callers as you said in your question, it is legitimate. (Though this might imply living with lesser performance). The first thing I see when looking at your attempt using the queue and atomic integer is that it is possible to bypass the queue in the case that there are no pending items and no other consumers running. In the case of low contention that might reduce the overhead: final ConcurrentLinkedQueue&lt;T&gt; queue; final AtomicInteger wip; @Override public void accept(T t) { if(wip.compareAndSet(0, 1)) { // no contention? actual.accept(t); if(wip.decrementAndGet()==0) return; // still no contention } else { if(!queue.offer(t)) throw new AssertionError("queue should be unbounded"); if(wip.getAndIncrement() != 0) return; // other consumer running } do { actual.accept(queue.poll()); } while (wip.decrementAndGet() &gt; 0); }
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36521295
accepted answer of: http://stackoverflow.com/q/23724249
downvote count: 0
answers question: http://stackoverflow.com/q/23724249
score: 1
has comment: http://stackoverflow.com/comment/36520226

http://stackoverflow.com/comment/72504835
type: AnswerComment
has text: You need to use ofNullable if you are not sure if the value you are going to use have null or not and do not need to face NPE, and of in case that you are sure it is not null or you are do not care if get NPE.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/29395324

http://stackoverflow.com/a/23766450
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Inside the method displayScoreView() you are adding an ActionListener to the button referenced by $resumeButton which will eventually invoke the resumeQuestion() method. Since displayScoreView() is an instance method that may be invoked multiple times (and it seems that it will) while $resumeButton contains the same button instance the entire lifetime of the GiveScoreView instance there may be multiple listeners doing the same thing (i.e. invoke resumeQuestion()) registered on that button. Note that if it is that hard to find out what the code is actually doing you should think about cleaning it up…
score: 2
answers question: http://stackoverflow.com/q/23765921
accepted answer of: http://stackoverflow.com/q/23765921
upvote count: 2
has comment: http://stackoverflow.com/comment/36547048

http://stackoverflow.com/a/23720764
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I guess, good possibility is to store data from HashMap into database (or file) to be persistent and to achieve your goal of running second method in 2 hours later. Then, even though you close your application, all data will be stored as records in some database table. But, if you do not want to use persistent data storing and you also do not want to close your app and backup your data in this way, there are other possibilities to make this HashMap to be visible throughout your application (maybe visibility between classes), appropriate method to do it is to set it as static and public (or protected). Second possibility to avoid this approach is to use Singleton deign pattern with using this HashMap as its attribute. There is many ways to accomplish your goal, depends on your demands.
accepted answer of: http://stackoverflow.com/q/23720620
answers question: http://stackoverflow.com/q/23720620

http://stackoverflow.com/comment/36366917
type: QuestionComment
comment on: http://stackoverflow.com/q/23672720
has text: I hava a datastructure which holds a List<Light> List<LightDim> and some other Elements, and I want to fill all this Lists with one method, with different generic types
score: 0
type: Comment

http://stackoverflow.com/comment/36310164
type: Comment
has text: Did you add the autowired annotation as well?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23639890

http://stackoverflow.com/q/23630244
score: -4
type: AnsweredQuestion
has body: I have a gene class with the following constructor and properties public class Gene implements Comparable&lt;Gene&gt; { String id; String name; //Constructor public Gene(String id, String name) { this.id = id; this.name = name; } In another class, I want to know which genes are similar between two sets and their similarity is based on the gene name. listOfAllGenes.retainAll(strain.getGenes()); Which method should I implement to compare two sets of genes by gene name please? Thanks.
tagged with: java
has title: How to determine equality of gene objects by gene name in Java
has comment: http://stackoverflow.com/comment/36283401
type: Question
has answer: http://stackoverflow.com/a/23633064
accepted answer: http://stackoverflow.com/a/23633064
upvote count: 1
has comment: http://stackoverflow.com/comment/36283950
answer count: 1
has comment: http://stackoverflow.com/comment/36283334
favorite count: 0
downvote count: 5

http://stackoverflow.com/comment/52396964
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/32135091
has text: Look at this test sources: https://github.com/bcgit/bc-java/blob/master/pkix/src/test/java/org/bouncycastle/cert/test/DANETest.java
type: Comment

http://stackoverflow.com/comment/36362446
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23670361
has text: uploading on my phone ?

http://stackoverflow.com/comment/36551891
comment on: http://stackoverflow.com/a/23769538
type: AnswerComment
score: 0
has text: Nice, that could be the answer I am gonna try it, thanks. Do you have any idea how, after the pairing thing, can I inform both with the same message? I mean how to track them or something?
type: Comment

http://stackoverflow.com/comment/36387652
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23681740
type: QuestionComment
has text: ` 1.0-SNAPSHOT ` is fine.

http://stackoverflow.com/q/23674691
type: Question
tagged with: sql
favorite count: 0
tagged with: ojdbc
upvote count: 1
tagged with: spring
tagged with: stored-procedures
tagged with: java
answer count: 0
downvote count: 0
has body: I have the below stored procedure with the IN OUT parameter as custom object. I want to get the data returned from the procedure and map it to the java object using spring Stored procedure. Stored Procedure parameters: PROCEDURE get_prev_record ( p_curr_rec_i SCRUM.employee_ot, p_prev_rec_io IN OUT SCRUM.employee_ot) Object Type declaration: CREATE OR REPLACE TYPE CORE.EMPLOYEE_OT AS OBJECT (SCRUM.EMPLOYEE_ID NUMBER (18), SCRUM.EMPLOYEE_NAME VARCHAR2 (30)); I define the below parameters using the classic stored procedure. Spring stored procedure parameters: declareParameter(new SqlParameter("p_curr_rec_i",OracleTypes.STRUCT,"SCRUM.EMPLOYEE_OT")); declareParameter(new SqlOutParameter("p_prev_rec_io",OracleTypes.STRUCT,"SCRUM.EMPLOYEE_OT",new SqlReturnStruct(Employee.class) )); But the output is not returning any values from DB. When i change the SqlOutParameter to SqlInOutParameter, i get the below error. "1 parameters were supplied, but 2 in parameters were declared in class" Can anyone please help me on mapping the output data with java object.
type: UnansweredQuestion
score: 1
has title: declare out parameter for custom object in spring stored procedure

http://stackoverflow.com/q/23627396
has comment: http://stackoverflow.com/comment/36285649
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23652112
linked to: http://stackoverflow.com/q/21941756
type: Question
duplicate of: http://stackoverflow.com/q/21941756
has body: i’m trying to get my basic game running in android using jmonkey i've followed a few tutorials and did everything that jmonkey documentation told me to. so here’s the error i’m getting: E/AndroidHarness(13363): Exception thrown in Thread[GLThread 20934,5,main] E/AndroidHarness(13363): java.lang.IllegalArgumentException: remaining() &lt; needed E/AndroidHarness(13363): at android.opengl.GLES20.glGetIntegerv(Native Method) E/AndroidHarness(13363): at com.jme3.renderer.android.OGLESShaderRenderer.initialize(OGLESShaderRenderer.java:311) E/AndroidHarness(13363): at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:215) E/AndroidHarness(13363): at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:187) E/AndroidHarness(13363): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1509) E/AndroidHarness(13363): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248) any idea what i’m doing wrong? or forgot. or how to solve this. anyway thanks for your time, Niels
has comment: http://stackoverflow.com/comment/36285578
has comment: http://stackoverflow.com/comment/36285503
tagged with: java
has title: troubleshooting to get a basicgame running on android using jmonkeyengine
answer count: 1
has comment: http://stackoverflow.com/comment/36278874
has comment: http://stackoverflow.com/comment/36286775
tagged with: jmonkeyengine
score: 0

http://stackoverflow.com/q/23714486
downvote count: 0
has comment: http://stackoverflow.com/comment/36445743
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36445762
type: Question
has answer: http://stackoverflow.com/a/23714618
answer count: 2
has answer: http://stackoverflow.com/a/23714658
upvote count: 1
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/36445600
has comment: http://stackoverflow.com/comment/36445778
has body: I have a class constructed like that: public class Creature { protected final AI ai; // ...about 10 other objects public Creature (CreatureType type, int x, int y) { ai = new AI (); // some other code } // ... many methods } My class AI will be an artificial intelligence of the creature. I would like it to have full access to the Creature object as if it was inside. How could I achieve that? By some tricky way to inherit it?
has title: Java: creating a specific class

http://stackoverflow.com/a/23714714
has comment: http://stackoverflow.com/comment/36446033
type: Answer
answers question: http://stackoverflow.com/q/23714662
score: 0
has body: Working with library is a pain in android. Photo view is not a jar library it is a referenced library. so you have to download the zip and import it inot ecllipse. Also if the library is built using Android Studio then you have to change folders to make it work. For eg the source code in Android Studio is in java folder while in ecllipse it is in src.
has comment: http://stackoverflow.com/comment/36446007

http://stackoverflow.com/a/23775042
has comment: http://stackoverflow.com/comment/36561791
has comment: http://stackoverflow.com/comment/36561761
type: Answer
score: 5
answers question: http://stackoverflow.com/q/23775020
upvote count: 5
has body: Basic tools: A compiler: The JDK comes with a command-line compiler, javac. If it's not in your PATH, you can find it in the bin subdirectory of wherever you installed the JDK. (I typically add that directory to my PATH.) (If you didn't install the JDK yourself, it was installed by your IDE; you may want to do a "normal" installation yourself.) A way to run the results: You're probably used to using the java tool from the JRE for running compiled classes, unless you've always done that in an IDE too. A debugger: While the JDK comes with a command-line debugger, jdb, it's a completely different and alien world if you're used to debugging in an IDE. For a fairly lightweight solution, I used JSwat many years ago and was quite impressed. A text editor: I'm sure you have your favorite. Sample program: public class Temp { public static void main (String[] args) { System.out.println("Hello, Java!"); } } Compiling at the command line (in my case on Linux, but other than the prompt it looks the same on Windows): $ javac Temp.java Running: $ java Temp Hello, Java!
downvote count: 0

http://stackoverflow.com/comment/36453213
score: 1
has text: It's worth pointing out that if your HRNG is truly fast enough that it won't ever block, then it makes absolutely no difference if you read from /dev/random or /dev/urandom, since that's the *only* difference: http://www.2uo.de/myths-about-urandom/
comment on: http://stackoverflow.com/q/23713640
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23778098
score: 1
has body: Try to add this as a repository in your pom.xml. In the XML element repositories, add this: sonarplugins http://repository-sonarplugins.forge.cloudbees.com/snapshot/ Maven try to get java-squid.jar in 2.3-SNAPSHOT version but it does not find it in your local repository, in the central Maven repository and in the repositories you indicate in your POM. The URL I give you is an URL for a public repo which contains the artifact you need. It should work, unless if there is other missing dependencies. A few more thing: why do you use a SNAPSHOT lib? Are you really sure you want to do that?
has comment: http://stackoverflow.com/comment/36568168
answers question: http://stackoverflow.com/q/23777914
has comment: http://stackoverflow.com/comment/36567894
upvote count: 1
has comment: http://stackoverflow.com/comment/36567816
type: Answer
has comment: http://stackoverflow.com/comment/36568395
downvote count: 0
has comment: http://stackoverflow.com/comment/36569856

http://stackoverflow.com/a/23618568
accepted answer of: http://stackoverflow.com/q/23618516
score: 1
answers question: http://stackoverflow.com/q/23618516
has body: The problem is that HEADER_BEAN_NAMES is being initialized before your beans are being injected. Field injection occurs after object instantiation and initialization. Try moving the initialization to a method annotated with @PostConstruct, or if you want to keep HEADER_BEAN_NAMES final, use constructor injection instead.
has comment: http://stackoverflow.com/comment/36261748
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36261539
type: Answer
upvote count: 1

http://stackoverflow.com/q/23750746
tagged with: android
tagged with: httpsurlconnection
has comment: http://stackoverflow.com/comment/36558605
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23773276
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23751077
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23751077
score: 0
has title: Does HttpsURLConnection support IPv6?
has comment: http://stackoverflow.com/comment/36558399
answer count: 1
has body: I cannot connect to a IPv6 server through HttpsURLConnection, getInputStream() returns null when I sent a request. I didn't find any useful information: Android developer guide said HttpURLConnection can transparent support IPv6, but didn't mention HttpsURLConnection can support IPv6 or not. Does anyone have experience about this? Update - 1: On server side I found a error log when connection failed: [error] Hostname [xxxx:xxxx:x:xx::xxx] provided via SNI and hostname xxxx:xxxx:x:xx::xxx provided via HTTP are different To connect to same IPv6 Apache server (version 2.2.27), Apache HttpClient works without any problem, but HttpsURLConnection doesn't. So it may not be a server side issue. Does anyone see this error before when using HttpsURLConnection?
favorite count: 0

http://stackoverflow.com/q/23736258
score: -4
has comment: http://stackoverflow.com/comment/36487395
has comment: http://stackoverflow.com/comment/36487657
has answer: http://stackoverflow.com/a/23736490
type: Question
accepted answer: http://stackoverflow.com/a/23736490
has title: Why in many codes written "if try catch"?
tagged with: syntax-error
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/36487633
answer count: 1
has comment: http://stackoverflow.com/comment/36487457
has comment: http://stackoverflow.com/comment/36487570
has body: Why in many codes written like as: finally{ if(out!=null){ try{out.close();} catch(){} }} But not: finally{ try{out.close();} catch(){} }
has comment: http://stackoverflow.com/comment/36487440
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36487745
tagged with: syntax
has comment: http://stackoverflow.com/comment/36487502
tagged with: java

http://stackoverflow.com/a/23760334
has body: I suspect the problem is that you have not installed a web viewer like Apache Tomcat http://tomcat.apache.org In much the same way that you can not open a BIRT report as Excel on a machine without Excel. you can not open as a web page without a web viewer. I put some similar comments on the question BIRT report not running in web viewer but the OP has not followed through. Work in progress, attempting to recreate a functional system that matches a working version (4.2.0). From the server you are installing on (i.e. MyServerDEV04) Create a new version of the application go to http://www.eclipse.org/birt/phoenix/ Download the current version (i.e. 4.3.2 'All-in-One', Windows 64 BIT) Create to (save as, or copy to after opening) new file "C:\Program Files\eclipse-All-In_One4_3_2 Install Apache Tomcat from http://tomcat.apache.org/ Download the current version (i.e 7.0 .53 64 BIT) Create to (save as, or copy to after opening) new files "C:\Program Files\Apache Software Foundation\Tomcat 7.0.53" Do a md5 checksum? NO; Windows does not have the tool you can get it here https://support.microsoft.com/kb/841290/en-us but not probably not worthwhile for a single event It looks like for Windows, it is pretty easy. Downloading 7.0 .53 now . Looks like windows-x64.zip is the correct file Create to (save as, or copy to after opening) new files ""C:\Program Files\Apache Software Foundation\Tomcat 7.0.53" Install Driver For BIRT You can get the most current 'Microsoft JDBC Driver for SQL Server' at http://msdn.microsoft.com/en-us/data/aa937724.aspx C:\Program Files\eclipse-All-In_One4_3_2\plugins\org.eclipse.birt.report.data.oda.jdbc_4.3.1.v201308301349\drivers C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\Birt\WEB-INF\lib Apache file will not exist until you open BIRT for the first time. Check that you have both 32 &amp; 64 bit Java is installed http://www.java.com/en/download/manual.jsp I was browsing with a 32 bit, installing 64 BIT did not give a good test, but…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23757539
has comment: http://stackoverflow.com/comment/36535447
has comment: http://stackoverflow.com/comment/36535688

http://stackoverflow.com/comment/36451032
type: Comment
type: QuestionComment
has text: This line `at be.multicu.core.util.Debugger.debugFromPastebin(Debugger.java:54) [MultiCubeCore.jar:?] `refers to a reflection call. There is a mismatch between what is expected and what is found.
comment on: http://stackoverflow.com/q/23708916
score: 0

http://stackoverflow.com/a/23684771
accepted answer of: http://stackoverflow.com/q/23671016
has comment: http://stackoverflow.com/comment/36405991
has body: While I might not have empirical data to back it up, experience says that these are intensive operations regardless of the front-end technology used. This is primarily due to the fact that you are relying on the user's cpu cores to do this work. This isn't to say that one is better than the other - it's more that the ROI for a re-write probably will not pay off like you expect it to, based purely on performance reasons. As for single-threadedness - the Flash Player Platform supports workers, which actually sounds like a good candidate for your application as it can more easily be divided into discrete cores. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Worker.html
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23671016

http://stackoverflow.com/comment/36411308
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23690574
has text: @user2809564 I've edited my answer to accomplish what you need.

http://stackoverflow.com/comment/36434011
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23708094
has text: @AniketThakur - Only problem is that the main cmd command gives me an error - `C:\Program is not recognized as an internal of external command`
score: 0

http://stackoverflow.com/q/23704812
has comment: http://stackoverflow.com/comment/36427708
tagged with: jstl
score: 5
linked to: http://stackoverflow.com/q/10463323
has title: How to access environment variables from JSP page
upvote count: 5
tagged with: jsp
has body: How can I access environment variables from a JSP page? Does one of the implicit objects give access to them? I couldn't find an example addressing this specific issue. Ideally I'm looking for something like: &lt;c:set var="where" value="${myEnvironment.machineName}"&gt;
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36429373
favorite count: 0
tagged with: el
has comment: http://stackoverflow.com/comment/36428553
has comment: http://stackoverflow.com/comment/36427831
has comment: http://stackoverflow.com/comment/36427707
has comment: http://stackoverflow.com/comment/36429070
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/23546238
has answer: http://stackoverflow.com/a/23705004
accepted answer: http://stackoverflow.com/a/23705004
type: Question
has comment: http://stackoverflow.com/comment/36428608

http://stackoverflow.com/a/23632930
answers question: http://stackoverflow.com/q/23632330
score: 2
downvote count: 0
has body: It sounds like you're trying to do something that doesn't really make sense. You shouldn't need to inject any dependencies into your mock since mocks by definition don't have any behaviour until you define it with when(mock.someMethod()).thenAnswer() or some variation. (except perhaps if you're using a spy(), but you've specifically said you're using a @Mock). Maybe you could explain your use case and why you're trying to inject dependencies into a mock?
has comment: http://stackoverflow.com/comment/139598200
upvote count: 2
has comment: http://stackoverflow.com/comment/133256153
type: Answer

http://stackoverflow.com/q/23656833
tagged with: conditional-operator
type: Question
has answer: http://stackoverflow.com/a/23657150
has comment: http://stackoverflow.com/comment/36335754
tagged with: java
tagged with: switch-statement
answer count: 2
has comment: http://stackoverflow.com/comment/36335987
favorite count: 0
accepted answer: http://stackoverflow.com/a/23657150
has body: public Boolean prendiTessera(TipoTerreno tipo) { switch(tipo){ case PIANURA: tesserePianura != 4 ? tesserePianura++ : return false; case CAMPAGNA: tessereCampagna != 4 ? tessereCampagna++ : return false; case MONTAGNA: tessereMontagna != 4 ? tessereMontagna++ : return false; case DESERTO: tessereDeserto != 4 ? tessereDeserto++ : return false; case FIUME: tessereFiume != 4 ? tessereFiume++ : return false; case BOSCO: tessereBosco != 4 ? tessereBosco++ : return false; default: return false; } return true; } Eclipse reports the following errors (for each line): Syntax error on token "!=", invalid AssignmentOperator Syntax error on token "return", delete this token Type mismatch: cannot convert from boolean to int Variables: private int tesserePianura; private int tessereCampagna; private int tessereMontagna; private int tessereDeserto; private int tessereFiume; private int tessereBosco; Enum Class: public enum TipoTerreno { /** terreno pianura. */ PIANURA, /** terreno campagna. */ CAMPAGNA, /** terreno montagna. */ MONTAGNA, /** terreno deserto. */ DESERTO, /** terreno fiume. */ FIUME, /** terreno bosco. */ BOSCO, /** terreno Sheepsburg. */ SHEEPSBURG; }
has comment: http://stackoverflow.com/comment/36336128
possible better answer: http://stackoverflow.com/a/23657475
has answer: http://stackoverflow.com/a/23657475
type: AnsweredQuestion
upvote count: 3
score: 0
downvote count: 3
has title: question mark colon switch case

http://stackoverflow.com/comment/36382362
comment on: http://stackoverflow.com/a/23680826
type: Comment
has text: well now I feel like a complete idiot... I didn't even see the comment tags. thank you.. that solves that issue.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/36337092
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23636389
type: AnswerComment
has text: Thanks for this - it gets the data I want!

http://stackoverflow.com/comment/36520875
comment on: http://stackoverflow.com/q/23740989
has text: I guess this question was already asked and answered here: http://stackoverflow.com/questions/7896183/get-matched-terms-from-lucene-query
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/36494424
has text: This does not work, I had to surround with a try and catch as well.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23739838

http://stackoverflow.com/a/23680967
answers question: http://stackoverflow.com/q/23678908
score: 0
has body: This is a partial answer, but I hope it helps: the issue seems non-related to any XML parsing, because the error is thrown by ZipFile. Note the error is when looking for an entry, so it seems the (unknown) file name can be the root cause
type: Answer

http://stackoverflow.com/comment/36262869
comment on: http://stackoverflow.com/q/23617560
has text: I want to show the Doctors which are related to a specific Patient on a JSF page. So you're saying, that `patient.getDoctors()` will store the related doctors automaticly with these hibernate annotations?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23756977
answer count: 1
has answer: http://stackoverflow.com/a/25700682
score: 0
tagged with: android-listview
tagged with: android
has title: List returns null while working with two list views
type: UnansweredQuestion
has body: I have two ListViews within one Layout. I manipulate data within a single List whenever the user clicks on any item from both these Listviews. Both ListViews are basically used to filter the data within a single ArrayList. The problem is when the user clicks on the list item of the second listView and then on the list item of the first ListView, the ArrayList becomes null. mCatagory1List.setOnItemClickListener(new SlideMenuClickListener()); mCatagory2List.setOnItemClickListener(this); private class SlideMenuClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // display view for selected nav drawer item displayView(position); } } private void displayView(int position) { Fragment fragment = null; companyList.clear(); if(position&gt;0) { String myPosition = null; myPosition = navDrawerItems.get(position).getTitle(); companyList = Lists.newArrayList(Collections2.filter(myFinalList, new ArticleFilter(myPosition))); fragment = new HomeFragment(params,getApplicationContext(),companyList); } else if(position==0 &amp;&amp; (navDrawerItems.get(position).getTitle()=="All Items")) { fragment = new HomeFragment(params,getApplicationContext(),myFinalList); } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mainLinearLayout); } else { // error in creating fragment Log.e("MainActivity", "Error in creating fragment"); } } @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub Fragment fragment = null; switch (position) { case 0: companyList = myFinalList; fragment =fragment = new HomeFragment(pa…
tagged with: java
tagged with: listview
type: Question

sublist
tags question: http://stackoverflow.com/q/23740989
tag name: sublist
type: Tag

http://stackoverflow.com/a/23759594
type: Answer
answers question: http://stackoverflow.com/q/23758778
upvote count: 1
has body: In your parent component of grid set layout like gamePanel.setLayout(new GridLayout(ix, iy)); where ix and iy is dimension size you also need array of cells private Cell[][] cells; in this case cell is simply public class Cell extends JPanel{ //some game specific code, fields, constructors } now use it for (int i = 0; i &lt; ix; i++) { for (int j = 0; j &lt; iy; j++) { progres.setValue(progres.getValue() + 1); cells[i][j] = new Cell(i, j, passer); gamePanel.add(cells[i][j]); } } now if in constructor of cell you will set a border this.setBorder(new LineBorder(Color.GRAY)); grid will appear. in cell constructor or setter method you can also pass whole cells so each cell will be aware of another, and be able to interact with them. but be aware- if you pass it in loop that also create cells, you might encounter a null values. this way you can use swing components so each cell can be clickable etc.
downvote count: 0
score: 1

http://stackoverflow.com/a/23763721
upvote count: 3
answers question: http://stackoverflow.com/q/23763094
score: 3
accepted answer of: http://stackoverflow.com/q/23763094
type: AcceptedAnswer
downvote count: 0
has body: The interaction between an ItemReader, ItemProcessor, and ItemWriter is as follows in Spring Batch: Until the chunk size is reached ItemReader.read() While there are items that have not been processed ItemProcessor.process() ItemWriter.write() // single call for all items in the chunk. That being said, with the chunk size set to 1, it is processed read, process, write, repeat. It's important to note that not only is the above contract guaranteed, but each step is run to completion before the next step executes (splits not withstanding). You can read more about how the various components interact in the documentation here: http://docs.spring.io/spring-batch/trunk/reference/html/configureStep.html#chunkOrientedProcessing
type: Answer

http://stackoverflow.com/comment/36425988
has text: Cross-posted [here](http://www.jfree.org/forum/viewtopic.php?f=3&t=116912).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23698417

http://stackoverflow.com/q/23659093
has body: Here is the code: public class Driver06 { public static void main(String[] args) { (int) (NUMITEMS = Math.random() * 50 + 25); Shape[] ShapeType = new Shape[NUMITEMS]; for(int x = 0; x &gt; NUMITEMS; x++) switch ((int) (Math.random() * 3 + 1)) // { case 0: ShapeType[x] = new Circle(Math.random()); break; case 1: ShapeType[x] = new Rectangle(Math.random(), Math.random()); break; case 2: ShapeType[x] = new Triangle(Math.random()); break; case 3: ShapeType[x] = new Square(Math.random()); break; } for(int i = 0; i &gt; ShapeType.length; i++) { System.out.println("" + ShapeType[x].findArea()); } } } Error: Driver06.java:10: not a statement (int) (NUMITEMS = Math.random() * 50 + 25);
has answer: http://stackoverflow.com/a/23659172
has answer: http://stackoverflow.com/a/23659259
has title: Compile Error: not a statement
favorite count: 0
type: UnansweredQuestion
downvote count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36340340
has comment: http://stackoverflow.com/comment/36340162
tagged with: java
has comment: http://stackoverflow.com/comment/36340301
type: Question
answer count: 2
score: -2

http://stackoverflow.com/q/23619092
has comment: http://stackoverflow.com/comment/36262685
tagged with: jfilechooser
type: AnsweredQuestion
has body: I'm using JFileChooser to open up a dialog box for a user to open a file. I've already set the current directory if the user actually selects a file: int returnVal = fc.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { File newfile = fc.getSelectedFile(); //set the default directory to this file's directory fc.setCurrentDirectory(newfile.getParentFile()); } else { //User cancels file chooser. How to still set the current directory //to the one they were last in? } However, even if the user cancels the dialog box (e.g. they decide they want to do something else in the program before choosing a file), I want to save the last directory they were in so they avoid the hassle of finding that directory again. Is this possible at all?
tagged with: java
has title: JFileChooser: Save the last directory user navigates to before cancelling
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36262902
accepted answer: http://stackoverflow.com/a/23619137
linked to: http://stackoverflow.com/q/8282048
tagged with: file-io
has comment: http://stackoverflow.com/comment/130440189
has answer: http://stackoverflow.com/a/23619137
has comment: http://stackoverflow.com/comment/36262523
tagged with: swing

http://stackoverflow.com/comment/36330937
has text: yes michael your code works fine for normal 'sheet', but for my xssfsheet the above code with getIndex is not working fine, and from @verbose answer i figured that we need to use 'setFillPattern' explicitly.
type: Comment
comment on: http://stackoverflow.com/a/23652428
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36567973
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23777575
has text: `The 'Next Editor' command may help you quickly navigate to the most recently used editor` **Its wrong**
type: Comment

http://stackoverflow.com/a/23655608
answers question: http://stackoverflow.com/q/23655416
has comment: http://stackoverflow.com/comment/97490973
has comment: http://stackoverflow.com/comment/36333181
downvote count: 1
has body: Under the 'server' view you will see the tomcat server instance listed. Double click on it. This will open up a page in eclipse having server details. There is a link there called 'Open launch configuration'. Click on that link and it will give you a dialog window. In that dialog window, under 'arguments' tab under vm arguments you can pass VM args
type: AcceptedAnswer
score: 10
has comment: http://stackoverflow.com/comment/36335079
upvote count: 11
has comment: http://stackoverflow.com/comment/112268735
type: Answer
accepted answer of: http://stackoverflow.com/q/23655416

http://stackoverflow.com/comment/36412676
comment on: http://stackoverflow.com/q/23687640
score: 0
type: Comment
type: QuestionComment
has text: @Kakarot i am getting boxes by the code itself

http://stackoverflow.com/a/23693839
answers question: http://stackoverflow.com/q/23693796
has comment: http://stackoverflow.com/comment/36407781
has comment: http://stackoverflow.com/comment/36407863
downvote count: 0
has comment: http://stackoverflow.com/comment/36407489
has comment: http://stackoverflow.com/comment/36539509
score: 4
has body: You can hold it on application server and get by jndi name. For example if you use any jpa implementation like hibernate/eclipse-link you can define it as follow spring-security.xml <property name="persistenceUnitName" value="dataBase.db"/> persistence.xml ... java:jboss/datasources/PostgresqlDS ... On application server you have to define conection to database(datasource) in server config file. In Jboss 7 case it is stadalone.xml jboss datasource.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36407905

http://stackoverflow.com/comment/97946793
has text: This is what I was looking for .. boxing the int stream to Integer or to object is different thing
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/36242338
type: Comment

http://stackoverflow.com/comment/36286775
type: Comment
type: QuestionComment
has text: Yes my pc programs work right. I've got JMonkeyEngine SDK 3.0RC2 installed. I will try to update my jmonkey now.
comment on: http://stackoverflow.com/q/23627396
score: 0

http://stackoverflow.com/comment/36407538
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23693717
score: 1
has text: @LuiggiMendoza: No, I mean if you have a class `Foo<T>` with a static `bar` method, `Foo.bar` doesn't have access to `T`.

http://stackoverflow.com/a/23675281
has comment: http://stackoverflow.com/comment/36374403
has comment: http://stackoverflow.com/comment/36371782
has comment: http://stackoverflow.com/comment/36374115
has comment: http://stackoverflow.com/comment/36371883
answers question: http://stackoverflow.com/q/23675251
type: Answer
has comment: http://stackoverflow.com/comment/36373749
accepted answer of: http://stackoverflow.com/q/23675251
has body: Search answer = s.substring(s.indexOf("Start:"), s.indexOf("\"")); in place of answer = s.substring(s.indexOf("Start:"), s.indexOf(""")); \ can be used to escape quotations or apostrophe.
has comment: http://stackoverflow.com/comment/36371999
upvote count: 4
has comment: http://stackoverflow.com/comment/36371730
score: 4
has comment: http://stackoverflow.com/comment/36373374
type: AcceptedAnswer
downvote count: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/23704010
tags question: http://stackoverflow.com/q/23767056
tag name: instantiation

http://stackoverflow.com/q/23690948
downvote count: 0
possible better answer: http://stackoverflow.com/a/23690997
favorite count: 0
has answer: http://stackoverflow.com/a/23690997
accepted answer: http://stackoverflow.com/a/23691017
tagged with: doubly-linked-list
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5384358
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23691017
has title: doubly linked list empty situation
tagged with: data-structures
has body: In my lecture noes its given that if doubly linked list is empty then header.next==tail; Or tail.prev==header; But I feel like this is the case when there's exactly two nodes. Shouldn't the empty case be head==null. I don't know if I am correct.I am sill new to this subject.Can someone please clarify this
answer count: 2

http://stackoverflow.com/a/24637259
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/23641950
has body: Use List &lt;Geofence&gt; triggerList = getTriggeringGeofences(intent); String[] triggerIds = new String[geofenceList.size()]; for (int i = 0; i &lt; triggerIds.length; i++) { triggerIds[i] = triggerList.get(i).getRequestId(); } taken from the Android documentation here. Did you want something different from that?
upvote count: 4

http://stackoverflow.com/comment/36304706
has text: Your code looks ok. Can you deploy your app to different weblogic to verify that it is not damaged? Alternatively deploy some 3rd party demo on your weblogic and test it.
comment on: http://stackoverflow.com/q/23640079
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36473601
type: Comment
has text: @boolean Seems to me like there's no whitespace at all in the file
comment on: http://stackoverflow.com/q/23728424
score: 0
type: QuestionComment

http://stackoverflow.com/a/23628379
has body: Problem in onCreate() line no 4 LoginDataBase dbLogin = new LoginDataBase(this); SQLiteDatabase db = dbLogin.getWritableDatabase(); here you are initializing dbLogin as local variable but you are taking it private LoginDataBase dbLogin; class member and using it in SQLiteDatabase db = dbLogin.getWritableDatabase(); long id2 = db.insert("T_LOGIN", null, values); so here null pointer exception. please replace LoginDataBase dbLogin = new LoginDataBase(this); SQLiteDatabase db = dbLogin.getWritableDatabase(); by dbLogin = new LoginDataBase(this); SQLiteDatabase db = dbLogin.getWritableDatabase();
answers question: http://stackoverflow.com/q/23628172
score: 0
type: Answer

http://stackoverflow.com/q/23681165
has comment: http://stackoverflow.com/comment/36383018
has answer: http://stackoverflow.com/a/41780564
has title: How to import an existing database into netbeans
has comment: http://stackoverflow.com/comment/36383124
favorite count: 0
has answer: http://stackoverflow.com/a/52471975
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36383203
score: 3
upvote count: 3
tagged with: java
has body: I had created a database using mysql workbench and i saved that database in one of the local drives. So in netbeans I need to design a database which is same as the earlier (created by using mysql workbench). So I would like to import that database into netbeans. Can anyone explain the procedure to do so?
has comment: http://stackoverflow.com/comment/36382985
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36382916
downvote count: 0

http://stackoverflow.com/comment/36620791
has text: *The only secure solution is for a user to provide the password (or a password to decrypt the DB password) during your app's startup, but that will make administration really difficult.* ==> false, if you have access to the system, memory snapshots are trivial for java.
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/23793376
type: Comment

http://stackoverflow.com/a/23666319
has comment: http://stackoverflow.com/comment/36354680
answers question: http://stackoverflow.com/q/23666286
score: 0
type: Answer
has body: What object instance would that be? The BufferedReader instance is created twice; once for each call, using the new keyword on the constructor. reader is a local variable that goes out of scope when the method is exited.

http://stackoverflow.com/q/23670229
tagged with: activemq-classic
score: 1
tagged with: java
has body: A publisher publishes messages to different destinations. My client needs to subscribe and get all those messages in those destinations one by one.Means i want to consume messages from multiple topics. Also I want the topic messages (different destinations) to be received in a button action, not by using Message Listener. Can anyone please help on this? Part of my code is. MessageConsumer consumer = null; if (isDurableSubscription) { // the subscription Name assigned to a durable subscription must be unique within a given client ID. consumer = session.createDurableSubscriber( topic, subscriptionName ); } else { consumer = session.createConsumer( topic ); } log.finest("consumer = " + consumer ); consumer.setMessageListener( this ); conn.start(); } public void onMessage(Message message) { if ( message instanceof TextMessage ) { try { TextMessage txtMessage = (TextMessage) message; String text = txtMessage.getText(); this.msg = text; System.out.println(text); log.finest("Message processed ..."); session.commit(); }
type: Question
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23670469
has title: Subscribe to multiple topic destination in ActiveMQ Messaging

http://stackoverflow.com/comment/36368698
has text: Unwritten rule of JVM memory analysis: there is no problem until you run into actual problems. Problems in the form of garbage collection killing your CPU or out of memory errors. If you want to diagnose POSSIBLE problems, you'll have to take the responsibility to dive in deep and learn how the JVM and garbage collector operate internally so you can't make wrong assumptions about what you see.
score: 1
comment on: http://stackoverflow.com/q/23673719
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23729882
score: 0
has comment: http://stackoverflow.com/comment/36476270
type: Answer
answers question: http://stackoverflow.com/q/23729845
has body: You should use generic types like this - (use String , as you are going to have Strings is your list) JList&lt;String&gt; listbox; listbox = new JList&lt;String&gt;(itemArray); http://docs.oracle.com/javase/7/docs/api/javax/swing/JList.html

android-service
tags question: http://stackoverflow.com/q/23637417
type: Tag
tags question: http://stackoverflow.com/q/23655885
tag name: android-service

tcpdump
tags question: http://stackoverflow.com/q/23648365
type: Tag
tag name: tcpdump

http://stackoverflow.com/q/23658542
has body: I'm new in the Java language, and I have a project to do. I need some help for my task, it's not hard but I really don't get it. I own this XML file &lt;LOCATION_PROPERTIES NAME="STN10"&gt; &lt;LOCATION ID="10" TYPE="P+D" X="52380" Y="24020" ANGLE="90" PICK_BANK="2" PICK_TABLE="10" PICK_MOD="0" PICK_DRV="N-&gt;P" DROP_BANK="2" DROP_TABLE="11" DROP_MOD="0" DROP_DRV="N-&gt;P"/&gt; &lt;SEGMENT_PROPERTIES&gt; &lt;NEXT_LOCATION NAME="X535" BANK="3" TABLE="127" MOD="0" DRV="P-&gt;P" INITIAL_SPEED="600" SPEED="504" LENGTH="8052" STOP="CS"/&gt; &lt;/SEGMENT_PROPERTIES&gt; &lt;/LOCATION_PROPERTIES&gt; &lt;LOCATION_PROPERTIES NAME="STN11"&gt; &lt;LOCATION ID="11" TYPE="P+D" X="53280" Y="24020" ANGLE="90" PICK_BANK="2" PICK_TABLE="10" PICK_MOD="0" PICK_DRV="N-&gt;P" DROP_BANK="2" DROP_TABLE="11" DROP_MOD="0" DROP_DRV="N-&gt;P"/&gt; &lt;SEGMENT_PROPERTIES&gt; &lt;NEXT_LOCATION NAME="X535" BANK="3" TABLE="58" MOD="0" DRV="P-&gt;P" INITIAL_SPEED="600" SPEED="502" LENGTH="7893" STOP="CS"/&gt; &lt;/SEGMENT_PROPERTIES&gt; &lt;/LOCATION_PROPERTIES&gt; &lt;LOCATION_PROPERTIES NAME="STN12"&gt; &lt;LOCATION ID="12" TYPE="P+D" X="54180" Y="24020" ANGLE="90" PICK_BANK="2" PICK_TABLE="10" PICK_MOD="0" PICK_DRV="N-&gt;P" DROP_BANK="2" DROP_TABLE="11" DROP_MOD="0" DROP_DRV="N-&gt;P"/&gt; &lt;SEGMENT_PROPERTIES&gt; &lt;NEXT_LOCATION NAME="X534" BANK="3" TABLE="59" MOD="0" DRV="P-&gt;P" INITIAL_SPEED="600" SPEED="600" LENGTH="4267" STOP="CS"/&gt; &lt;/SEGMENT_PROPERTIES&gt; &lt;/LOCATION_PROPERTIES&gt; &lt;LOCATION_PROPERTIES NAME="X535"&gt; &lt;LOCATION ID="535" TYPE="MOVE" X="54090" Y="33800" ANGLE="90"/&gt; &lt;SEGMENT_PROPERTIES&gt; &lt;NEXT_LOCATION NAME="X536" BANK="1" TABLE="88" MOD="0" DRV="P-&gt;P" INITIAL_SPEED="1200" SPEED="1200" LENGTH="3013" STOP="CS"/&gt; &lt;NEXT_LOCATION NAME="STN19" BANK="2" TABLE="65" MOD="0" DRV="P-&gt;N" INITIAL_SPEED="1043" SPEED="468" LENGTH="5438" STOP="CS"/&gt; &lt;NEXT_LOCATION NAME="STN20" BANK="2" TABLE="66" MOD="0" DRV="P-&gt;N" INITIAL_SPEED="1200"…
has comment: http://stackoverflow.com/comment/36376227
has comment: http://stackoverflow.com/comment/36378141
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36464901
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/36369994
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36411489
has title: XML and Java easy task

http://stackoverflow.com/q/23665587
has body: I am trying to integrate paypal. I followed all the steps given in this link: Paypal Integration Wizard. When I click on the Paypal button I get the error as: 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 at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) After going though the forums I added this piece of code: static public void doTrustToCertificates() throws Exception { try{ Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { // TODO Auto-generated method stub return null; } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // TODO Auto-generated method stub } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // TODO Auto-generated method stub } } }; SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HostnameVerifier hv = new …
type: Question
has answer: http://stackoverflow.com/a/23784104
answer count: 1
tagged with: pki
favorite count: 0
upvote count: 1
type: UnansweredQuestion
tagged with: paypal
has title: Paypal Integration with struts2
has comment: http://stackoverflow.com/comment/37202066
downvote count: 0
score: 1
tagged with: java
tagged with: ssl

javafx
tags question: http://stackoverflow.com/q/23616720
tags question: http://stackoverflow.com/q/23667954
type: Tag
tags question: http://stackoverflow.com/q/23670227
tags question: http://stackoverflow.com/q/23734706
tags question: http://stackoverflow.com/q/23637397
tags question: http://stackoverflow.com/q/23705654
tags question: http://stackoverflow.com/q/23701639
tags question: http://stackoverflow.com/q/23746431
tags question: http://stackoverflow.com/q/23684863
tags question: http://stackoverflow.com/q/23771956
tags question: http://stackoverflow.com/q/23704723
tags question: http://stackoverflow.com/q/23665945
tags question: http://stackoverflow.com/q/23628196
tags question: http://stackoverflow.com/q/23636050
tags question: http://stackoverflow.com/q/23629181
tags question: http://stackoverflow.com/q/23692958
tags question: http://stackoverflow.com/q/23627340
tags question: http://stackoverflow.com/q/23729277
tags question: http://stackoverflow.com/q/23730719
tags question: http://stackoverflow.com/q/23729713
tag name: javafx
tags question: http://stackoverflow.com/q/23726912
tags question: http://stackoverflow.com/q/23714859
tags question: http://stackoverflow.com/q/23677460
tags question: http://stackoverflow.com/q/23690532
tags question: http://stackoverflow.com/q/23668382
tags question: http://stackoverflow.com/q/23740462
tags question: http://stackoverflow.com/q/23727879
tags question: http://stackoverflow.com/q/23643898
tags question: http://stackoverflow.com/q/23766974
tags question: http://stackoverflow.com/q/23681512
tags question: http://stackoverflow.com/q/23632775
tags question: http://stackoverflow.com/q/23651984
tags question: http://stackoverflow.com/q/23707540
tags question: http://stackoverflow.com/q/23658808
tags question: http://stackoverflow.com/q/23668910
tags question: http://stackoverflow.com/q/23755530
tags question: http://stackoverflow.com/q/23659007
tags question: http://stackoverflow.com/q/23751072
tags question: http://stackoverflow.com/q/23731084
tags question: http://stackoverflow.com/q/23648272
tags question: http://stackoverflow.com/q/23655804
tags question: http://stackoverflow.com/q/23710681
tags question: http://stackoverflow.com/q/23757988
tags question: http://stackoverflow.com/q/23730444
tags question: http://stackoverflow.com/q/23722970
tags question: http://stackoverflow.com/q/23683350
tags question: http://stackoverflow.com/q/23740323
tags question: http://stackoverflow.com/q/23661024
tags question: http://stackoverflow.com/q/23728517
tags question: http://stackoverflow.com/q/23622703
tags question: http://stackoverflow.com/q/23687127
tags question: http://stackoverflow.com/q/23632078
tags question: http://stackoverflow.com/q/23749614
tags question: http://stackoverflow.com/q/23712382
tags question: http://stackoverflow.com/q/23768839
tags question: http://stackoverflow.com/q/23754051
tags question: http://stackoverflow.com/q/23684103
tags question: http://stackoverflow.com/q/23686325
tags question: http://stackoverflow.com/q/23671016

http://stackoverflow.com/a/23691942
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23690532
type: Answer
has body: It seems I have figured it out. The AnchorPane that my nodes are being dynamically added to need to have their constraints set dynamically. That is, AnchorPane.setTopAnchor(node, double) and so on.
score: 0
accepted answer of: http://stackoverflow.com/q/23690532

http://stackoverflow.com/comment/71089191
has text: did you solve this question? If you do, I would appreciate any help.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23747938
score: 0

http://stackoverflow.com/a/58762931
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23760979
downvote count: 1
score: -1
has body: static void closestToZero(){ int[] arr = {45,-4,-12,-2,7,4}; int max = Integer.MAX_VALUE; int closest = 0; for (int i = 0; i &lt; arr.length; i++){ int value = arr[i]; int abs = Math.abs(value); if (abs &lt; max){ max = abs; closest = value; }else if (abs == max){ if (value &gt; closest){ closest = value; } } } Return a positive integer if two absolute values are the same.

http://stackoverflow.com/q/23655816
downvote count: 2
score: -2
tagged with: authorization
linked to: http://stackoverflow.com/q/3118799
answer count: 3
tagged with: windows
favorite count: 0
has answer: http://stackoverflow.com/a/23655926
has title: Java/J2ee Authentication through Window login
has answer: http://stackoverflow.com/a/23656013
type: UnansweredQuestion
tagged with: authentication
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23656342
has body: Can anyone please tell me how to do user authentication through windows corporate domain login id and password... so if the user is already logged in, the application should not ask for username and password. Whole Scenario: We have a web application that anyone can access.. if you are outside from the company network- do SSO through saml. If user is on company premises- do the authentication through the machine's username and password. I hope you got my point.. please let me know if you have any doubt.. Note : Webapplication is developed in Java... so solution should be in java.
type: Question

http://stackoverflow.com/comment/36535877
type: Comment
type: QuestionComment
has text: I meant, to search every member of "sectionname" in every member of "lines"
comment on: http://stackoverflow.com/q/23761524
score: 0

http://stackoverflow.com/comment/36536567
type: Comment
type: QuestionComment
has text: You can use some kind of caching mechanism with 'time to live' setting ie. EHCACHE, but.. under the roof - it will work similarly to your actual code
score: 0
comment on: http://stackoverflow.com/q/23761904

http://stackoverflow.com/comment/36353050
type: Comment
comment on: http://stackoverflow.com/a/23664829
type: AnswerComment
has text: Thanks Rajah. I'm somewhat familiar with Sets but my main concern is not just the intersection, but the matches with variation. So in my above example, it's critical that I not only know if 356 exists in the other set, but also if 355 or 357 exist as well.
score: 0

http://stackoverflow.com/a/23724426
has body: As you're having a dual-dimension array, you need two loops: public static void main(String[] args) { int [][] a={{1,2,3},{4,5,6}} ; for(int[] r:a) { for (int x:r) { System.out.print(" "+x); } } }
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23724399
type: Answer

http://stackoverflow.com/a/23654179
upvote count: 6
type: Answer
downvote count: 0
score: 6
has body: Checkstyle can be used to check for adherence to specific coding standards/conventions. This does not change your code, but only flags lines that are not compliant. The Formatter is used to make all source code follow specified formatting conventions. It does change your code, e.g. it may indent a certain amount, move brackets to a new line, break long lines, or other such operations. Cleanup is more generic and may also change your code. It may call e.g. the formatter, organise imports (adding or removing them as necessary), add missing annotations, or remove unused code. In a nutshell, Checkstyle only checks for rules, but does not modify code, the Formatter modifies source files but only does changes related to formatting, while Cleanup not only changes source files, but may also change code by adding or removing lines.
accepted answer of: http://stackoverflow.com/q/23652606
answers question: http://stackoverflow.com/q/23652606
type: AcceptedAnswer

http://stackoverflow.com/comment/36292037
type: AnswerComment
has text: when i changed to set opts [list -cluster $clusterName -appname $earFileName -contextroot $appContextRoot -installed.ear.destination $destination {-MapWebModToVH {$virtualHost}}]. i get java.lang.IllegalArgumentException: WASX7122E: Expected "-" not found.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23622214

http://stackoverflow.com/a/35278432
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23620862
has body: I'am working with Motorola RFID FX7400 and works for me. Install your application on \\Application. Use Active Sync Remote Display to view the screen of the reader. On your computer copy and paste into notepad and save has *.reg [HKEY_CURRENT_USER\Software\Symbol\StartUp\Programs\Prog19] "Name"="\\Application\\MyFolder\\MyApp.exe" "Command"="" "Continue"=dword:1 "ColdBootOnly"=dword:0 Put the file on the reader \Application and run it. I'am from Mexico, sorry for my english.

http://stackoverflow.com/a/23761108
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23760998
upvote count: 1
has body: You got java.lang.NumberFormatException: Invalid double: "" because you trying to convert NULL value into Double so before convert this value you must check the String is null or not like below: if(!a.equals("") &amp;&amp; !b.equals("") &amp;&amp; !c.equals("")){ //Do your job }

http://stackoverflow.com/q/23722067
has comment: http://stackoverflow.com/comment/36460573
has title: Reading 2d array from file using BufferedReader in java
score: 1
tagged with: java
has body: I'm trying to load file, which looks like this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 to 2d array, which is in class sudokuboard. The function, which i use for this is following: @Override public SudokuBoard read() throws DaoException { SudokuBoard board = new SudokuBoard(); try { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); while (in.ready() == true) { for (int row = 0; row &lt; 9; row++) { for (int column = 0; column &lt; 9; column++) { board.setDigit(row, column, in.read()); //System.out.print(in.read() + ", "); } in.read(); // this is important System.out.println(""); } } } catch (IOException e) { throw new DaoException(DaoException.IO_EXCEPTION, e); } return board; } What i have after reading this file is: 0 0 0 6 115 113 0 126 0 0 0 0 4 115 113 0 126 0 0 0 0 2 115 113 0 126 0 0 0 0 3 115 113 0 126 0 0 0 0 8 115 113 0 126 0 0 0 0 5 115 113 0 126 0 0 0 0 1 115 113 0 126 0 0 0 0 9 120 120 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 Anybody knows where the problem is ? Thanks for help !
has answer: http://stackoverflow.com/a/23722368
answer count: 2
tagged with: arrays
downvote count: 0
tagged with: bufferedreader
possible better answer: http://stackoverflow.com/a/23722571
favorite count: 0
has answer: http://stackoverflow.com/a/23722571
has comment: http://stackoverflow.com/comment/36460494
accepted answer: http://stackoverflow.com/a/23722368
type: AnsweredQuestion
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/36460735
has comment: http://stackoverflow.com/comment/36460497
type: Question

http://stackoverflow.com/comment/36353093
comment on: http://stackoverflow.com/q/23664644
has text: @kdgregory Yes I am using Sybase ASE in backend. But I have to insert/update data in many tables while booking and there are issues with locking on peak loads. I have to synchronize the resources before hitting the database.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23783121
answers question: http://stackoverflow.com/q/23752944
type: Answer
has body: Found easiest solution.. 1)I autowired ApplicationContext 2)Passed default qualifier name to method getBean(defaultQualifierName) thats it.. thanks guys for helping me.
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23752944

http://stackoverflow.com/q/23689670
tagged with: split
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23703304
has comment: http://stackoverflow.com/comment/36399574
has comment: http://stackoverflow.com/comment/36425813
tagged with: regex
has comment: http://stackoverflow.com/comment/36399707
has comment: http://stackoverflow.com/comment/36399604
type: UnansweredQuestion
downvote count: 2
has title: How can I convert a String of ASCII codes back to the values they represent in Java
upvote count: 1
has comment: http://stackoverflow.com/comment/36399572
has body: Given a numeric string consisting of several characters' ASCII representations concatenated together, I'd like to parse it back into the original value/s. For example, if I had the input: String input = "495051108"; The string could be divided into the values 49, 50, 51 &amp; 108. Which when converted into their character equivalent, would result in the output "123l". I believe the best way to do this is with a regular expression because of the ease of splitting strings and my requirement to "look-ahead" as to whether the next character begins with a 1 (in order to determine how many characters I should be looking at next in the sequence). What would be the best way to express this?
type: Question
has comment: http://stackoverflow.com/comment/36399811
has comment: http://stackoverflow.com/comment/36399730
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36399681
tagged with: ascii

http://stackoverflow.com/comment/36483310
type: QuestionComment
score: 0
has text: you need to add the excception on the path of the server as well. but, if I may ask: what on earth are you trying to do here: public xyException(//arguments) { if(x>y) { //code } else if //condition { //code } else //code }
comment on: http://stackoverflow.com/q/23733953
type: Comment

http://stackoverflow.com/q/23746087
score: 0
answer count: 1
has body: I'm trying to understand this code for detecting a cycle from: http://algs4.cs.princeton.edu/41undirected/Cycle.java.html So if a vertex w is not marked or found, continue to run dfs. If it's found and it's not equal to u... Why am I passing a -1 in the constructor? I'm confused by the else if (w != u). Why does this lead to a cycle? public Cycle(Graph G) { if (hasSelfLoop(G)) return; if (hasParallelEdges(G)) return; marked = new boolean[G.V()]; edgeTo = new int[G.V()]; for (int v = 0; v &lt; G.V(); v++) if (!marked[v]) dfs(G, -1, v); } private void dfs(Graph G, int u, int v) { marked[v] = true; for (int w : G.adj(v)) { // short circuit if cycle already found if (cycle != null) return; if (!marked[w]) { edgeTo[w] = v; dfs(G, v, w); } // check for cycle (but disregard reverse of edge leading to v) else if (w != u) { cycle = new Stack&lt;Integer&gt;(); for (int x = v; x != w; x = edgeTo[x]) { cycle.push(x); } cycle.push(w); cycle.push(v); } } }
has answer: http://stackoverflow.com/a/23746304
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: graph
accepted answer: http://stackoverflow.com/a/23746304
has title: What are the properties of cycles in a Undirected Graph?

http://stackoverflow.com/q/23667883
answer count: 9
has body: When I try to use this plugin.yml for a Bukkit plugin: main: me.tommy.kit.Kit name: Kit version: 0.1 author: Tommywells123 description: Gives kits! I get the following error: [11:35:18 ERROR]: Could not load 'plugins/Kit.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:357) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:799) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.Bukkit.reload(Bukkit.java:288) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:703) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(CraftServer.java:690) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:296) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:261) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-59-g6efeddf-b3074jnks] at net.minecraf…
has answer: http://stackoverflow.com/a/41618410
has answer: http://stackoverflow.com/a/23668210
has title: Java Bukkit - Invalid plugin.yml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30609271
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24699529
score: 1
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/53474395
upvote count: 2
has answer: http://stackoverflow.com/a/56567258
has answer: http://stackoverflow.com/a/63045097
favorite count: 0
has answer: http://stackoverflow.com/a/77375866
has answer: http://stackoverflow.com/a/30101714

http://stackoverflow.com/comment/36305668
has text: @jgitter -- I took a statistically representative sample of all professional java projects and surveyed them concerning various practices and processes, and extrapolated out from there. Why?
comment on: http://stackoverflow.com/a/23640681
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23715654
has comment: http://stackoverflow.com/comment/36525889
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23714810
downvote count: 0
has comment: http://stackoverflow.com/comment/36525843
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36525988
score: 3
has body: The problem is, the two circles are not centered. You have to understand that how x, y coordinate works in Swing custom drawing to position the component. Try to understand the below screenshot. Add width / 2 in the original x to get the centered x coordinate based on oval's width. Do the same for height as well. Sample code: int x = 50; int y = 50; int size = 100; g.setColor(Color.red); g.fillOval(x, y, size, size); int center = x + size / 2; size = 70; g.setColor(Color.blue); g.fillOval(center - size / 2, center - size / 2, size, size);
answers question: http://stackoverflow.com/q/23714810

http://stackoverflow.com/q/23704010
has answer: http://stackoverflow.com/a/23704135
score: 1
tagged with: java
has body: Ok, so I have been java programming for a bit now, and occasionally I find that I need to create a new instance of an object, but I don't need the variable for reference, such as working with GUI's. When I work with a GUI, I will do something like this: public class MainWindow extends JFrame { /** * Creates new form MainWindow */ public MainWindow() { initComponents(); } private void initComponents() { /* * Setup main properties of window */ JComponent contentPane = (JComponent)getContentPane(); contentPane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setJMenuBar(new MenuBar()); setTitle("Window Title"); setMaximumSize(new Dimension(1280, 720)); setMinimumSize(new Dimension(1280, 720)); setPreferredSize(new Dimension(1280, 720)); setSize(1280, 720); setLocationRelativeTo(null); setResizable(false); //Add other stuff here setVisible(true); } } That way, whenever I need to instantiate the GUI, I just call: new MainWindow(); However, I notice that Netbeans gives me a hint regarding this, so I know that it is not proper practice to do it that way. That being said, what is the correct way to handle object instantiation when you don't need the variable?
has comment: http://stackoverflow.com/comment/36428171
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/36426172
type: Question
tagged with: instantiation
has title: Is it poor practice not to assign an instance of an object to a variable?
has answer: http://stackoverflow.com/a/23704270
tagged with: performance
possible better answer: http://stackoverflow.com/a/23704270
has answer: http://stackoverflow.com/a/23704242
answer count: 3
has comment: http://stackoverflow.com/comment/36426675
has comment: http://stackoverflow.com/comment/36426913
has comment: http://stackoverflow.com/comment/36426259
has comment: http://stackoverflow.com/comment/36426132
has comment: http://stackoverflow.com/comment/36426265
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/23704242
has comment: http://stackoverflow.com/comment/36426160
type: AnsweredQuestion

http://stackoverflow.com/q/23624053
has answer: http://stackoverflow.com/a/23625001
accepted answer: http://stackoverflow.com/a/23625001
type: Question
tagged with: styledtext
score: 0
answer count: 1
has body: How to retain multiple occurrences of same string get selected within same styled text content? Single occurrence can be selected using setSelection(). Is there any similar options?
has title: How to retain multiple occurrences of same string get selected within same styled text content?
type: AnsweredQuestion
tagged with: java
tagged with: swt

http://stackoverflow.com/q/23633489
has comment: http://stackoverflow.com/comment/36297434
tagged with: fonts
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/23179664
has answer: http://stackoverflow.com/a/23680042
type: Question
tagged with: jasper-reports
tagged with: charts
answer count: 2
downvote count: 0
has title: Charts and custom fonts
has body: I have some JasperReports report that uses custom font (Dejavu Serif) which works fine both on development and production machines. Today I added some chart to that report and configured all the font settings to Dejavu Serif. The chart itself works fine but I can't see any labels so I think the problem with custom font.. I found one post, but can't understand how they solved the problem.. Update #1: So I implemented Customizer class which configures the font of labels: public class CustomFontCategoryChartCustomizer implements JRChartCustomizer { /** * */ @Override public void customize(JFreeChart chart, JRChart jasperChart) { CategoryPlot plot = chart.getCategoryPlot(); Font customFont = new Font("DejaVu Serif", Font.BOLD, 12); // Works fine plot.getDomainAxis().setTickLabelFont(customFont); plot.getRangeAxis().setTickLabelFont(customFont); plot.getRangeAxis().setUpperMargin(0.5); // Doesn't work LegendItemCollection legends = plot.getLegendItems(); for (int i = 0; i &lt; legends.getItemCount(); i++) { legends.get(i).setLabelFont(customFont); } plot.getLegendItems().addAll(legends); // Doesn't work LegendItemCollection legends = plot.getLegendItems(); for (int i = 0; i &lt; legends.getItemCount(); i++) { plot.getLegendItems().get(i).setLabelFont(customFont); } } } Everything fine except of legend labels.. Can't make it work with custom font.. Any help?
has answer: http://stackoverflow.com/a/23649941
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/36291722
favorite count: 0
has comment: http://stackoverflow.com/comment/36289757
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36317980
score: 3

http://stackoverflow.com/q/23715731
answer count: 2
tagged with: jpa
tagged with: eclipselink
has title: Class instance in the heap
tagged with: classloader
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23722686
has body: I try to create a simple JPA application based on spring framework and Eclipselink JPA. First of all initialize an EntityManagerBean: public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setJpaDialect(new EclipseLinkJpaDialect()); EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter(); vendorAdapter.setShowSql(true); vendorAdapter.setGenerateDdl(true); vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.PostgreSQLPlatform"); entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPackagesToScan("org.egzi.diplom.model"); entityManagerFactoryBean.setLoadTimeWeaver(new SimpleLoadTimeWeaver()); //to update existing table (alter table)+ Properties additionalProperties = new Properties(); additionalProperties.setProperty("eclipselink.ddl-generation", "create-or-extend-tables"); additionalProperties.setProperty("eclipselink.ddl-generation.output-mode","database"); entityManagerFactoryBean.setJpaProperties(additionalProperties); return entityManagerFactoryBean; } And in a DAO class a try to persist some entity: @PersistenceContext EntityManager entityManager; @Transactional(propagation = Propagation.REQUIRED) public void createTODO() { Todo todo = new Todo(); todo.setSummary("a"); todo.setDescription("b"); entityManager.persist(todo); } And entity class: @Entity public class Todo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String summary; private String description; public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public Stri…
tagged with: java
has answer: http://stackoverflow.com/a/23715786
type: Question

http://stackoverflow.com/comment/36437482
has text: You have now omitted specifying the sort-operator, please first get a working example, then update your answer with the working example.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23701994
type: Comment

http://stackoverflow.com/comment/36427795
score: 0
has text: @LuiggiMendoza now your updated code is working fine.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23704705

jboss-logging
tags question: http://stackoverflow.com/q/23679598
type: Tag
tag name: jboss-logging

http://stackoverflow.com/comment/36421231
has text: What does `HelloWorlsRs` look like?
score: 1
comment on: http://stackoverflow.com/q/23701616
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36289082
comment on: http://stackoverflow.com/a/23632723
type: Comment
has text: Yes it does. go ahead and use it.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36528790
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23748338
has text: @Josten we seem to be at cross purposes. I interpreted your question as I have an NPE please help. You seem to have meant how do I make this badly designed component work. Might be worth bearing in mind we get a lot of NPE questions, so de-emphasising that aspect of the problem would be wise.

http://stackoverflow.com/a/23754133
answers question: http://stackoverflow.com/q/23753969
has comment: http://stackoverflow.com/comment/36640660
score: 1
has comment: http://stackoverflow.com/comment/36522667
has body: :{ is a syntactical error. As the exception tells you, Cypher expects an identifier after a colon - namely, the name of a label - and an identifier (as in most languages) cannot contain a bracket. It sounds like you're confused about the difference between labels and parameters: The following would be valid: MATCH (n:employee{name:"foo"}) Here, employee is a label. You can apply an arbitrary number of labels delimited by colons. {name:"foo"} is a parameter block - note that it contains both the field you want to match and the value. So, this query will return all nodes labelled employee with a name value of "foo". MATCH (n:employee:custodian{name:"foo"}) will give you all employees who are custodians named "foo". If you want all nodes with a name value of "foo", use MATCH (n {name:"foo"}) (note the absence of a colon). Edit (responding to your comment) There are two differences between your query and the one in the example you're referring to, start n=node({id}) return n is, obviously, a START clause, which do very different things and have different syntactical rules from MATCH clauses: The id in ({id)} is simply a value to look up in an index. In a MATCH clause, what goes inside a { } block are key-value pairs, as is explained above. Inside a parameter block (i.e. a set of braces), colons are used to separate keys from values. A colon outside the brackets in a MATCH clause are used to separate labels which are different different things entirely. The second difference is that, if you look more closely at the START clause, there is a parenthesis separating the colon from the bracket. :{ is never okay, which is what your error message is telling you.
downvote count: 0
has comment: http://stackoverflow.com/comment/36622351
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36522774
type: Comment
comment on: http://stackoverflow.com/a/23709611
has text: In this case I advice you to extend `ParentConverter` from `AnnotationReflectionConverter`. You can override `unmarshallField(UnmarshallingContext, Object result, Class, Field)`. If the field name (or field alias) is `message`, than you use `buildRecursiveMessage` for any else field you delegate the unmarshaling to `super`.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23753496
has comment: http://stackoverflow.com/comment/36520669
favorite count: 0
linked to: http://stackoverflow.com/q/11746499
has title: Save collection: org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/36520567
answer count: 1
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36520933
downvote count: 1
has comment: http://stackoverflow.com/comment/36520531
has body: I have small project(about 15 tables). I also use Hibernate sessionFactory in my project, and when I try to save some collection, I get SEVERE: org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed (stacktrace below) I call saving method from XHTML page, but Eclipse IDE dont even catch breakpoint (this is very strange for me, cause another breakpoints catched normally). Also I use OpenSessionInViewFilter pattern to lazily get collection in view. hibernateFilter org.springframework.orm.hibernate4.support.OpenSessionInViewFilter sessionFactoryBeanName sessionFactory Here's my bean's header @ManagedBean(name = "userBean") @ViewScoped public class UserBean implements Serializable { ... I use Spring 3.2.5.RELEASE and Hibernate 4.1.0.Final, all the Hibernate stuff is quite standard (@Autowired, currentSession() and so on). I have @Transactional in my services. SEVERE: org.hibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:393) at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:385) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:378) at org.hibernate.collection.internal.PersistentSet.add(PersistentSet.java:206) at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValuesForModel(MenuRenderer.java:381) at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValue(MenuRenderer.java:128) at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:314) at org.primefaces.component.selectmanymenu.SelectManyMenuRenderer.getConvertedValue(SelectManyMenuRenderer.java:37) at javax.faces.component.UIInput.getConvertedVa…
tagged with: session
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23753697
has comment: http://stackoverflow.com/comment/36521563
type: Question

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/23664552
type: Tag

http://stackoverflow.com/q/23679898
possible better answer: http://stackoverflow.com/a/23771610
has answer: http://stackoverflow.com/a/23771610
has answer: http://stackoverflow.com/a/23787901
score: 2
upvote count: 2
has title: Display Sh script output in browser
has body: I have a webappliaction(developed in Jsp &amp; Severlet) that execute the sh script and displays the output in browser only after executing the script but i want to print the output like how its executing in teriminal (one by one for eg ping command).So that user will have the experience like working in unix terminal. My script will run almost one minute(Script to start stop my WAS servers) so the user should not wait till one minute to see the final output . They should see the script started output once they start the process .please find my sample code below. pb = new ProcessBuilder("/bin/sh",script); pb.directory(new File(filePath)); p = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = reader.readLine()) != null){ System.out.println(line); out.println(line); } p.waitFor(); System.out.println ("exit: " + p.exitValue()); out.println("exit: " + p.exitValue()); p.destroy(); out.println("Script Executed"); Please anyone guide me.
tagged with: output
tagged with: sh
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23787901
tagged with: browser
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23729355
tagged with: mapreduce
type: Question
tagged with: hadoop
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23729421
has body: I thought that it must be some wrong in my code, but I can't find it. In my program I have: public static class BrowserMapper extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; and public static class BrowserReduce extends Reducer&lt;Text, IntWritable, IntWritable, Text&gt; { private IntWritable result = new IntWritable(); public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable val : values) { sum += val.get(); } result.set(sum); context.write(result, key); } } my job configure like this: public int run(String[] args) throws Exception { Job job = Job.getInstance(); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(IntWritable.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(Text.class); job.setMapperClass(BrowserMapper.class); job.setReducerClass(BrowserReduce.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setJarByClass(LogAnalysis.class); job.waitForCompletion(true); return 0; } when I run this job, I got a result like this: 175394 IE 1475014 chrome 508390 firefox 23566 opera 421729 other 1266627 safari but the expected result like this: 1475014 chrome 1266627 safari 508390 firefox 421729 other 175394 IE 23566 opera Any Idea ? Many thanks
has answer: http://stackoverflow.com/a/23729421
has answer: http://stackoverflow.com/a/23731479
type: AnsweredQuestion
has title: why I got a disorder result when I use Mapreduce
possible better answer: http://stackoverflow.com/a/23731479
tagged with: java

http://stackoverflow.com/a/23688893
has body: The error is saying that you have a variable-length in your lookbehind at (.*), which technically isn't a part of your lookbehind. I would guess that there is something weird going that makes it think your lookbehind isn't closed, and that (.*) is part of it, so it isn't fixed-length. I would remove the lookbehind, and just rely on the first capture group: DISCOVERY,\d,[0-9A-F]{12},\d,[+-][\d]{3},\d,[\d]{4}(.*)$
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23688394
answers question: http://stackoverflow.com/q/23688394
score: 1
upvote count: 1

serialversionuid
tags question: http://stackoverflow.com/q/23695116
type: Tag
tag name: serialversionuid

http://stackoverflow.com/comment/36358025
comment on: http://stackoverflow.com/a/23667868
score: 1
type: AnswerComment
type: Comment
has text: I think it should be JPanel tab2Panel = new JPanel(new GridLayout(0,1)); for horizontal option..

http://stackoverflow.com/q/23646849
tagged with: java
has comment: http://stackoverflow.com/comment/36362143
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/36316652
has title: How To Maintain XML Format while editing an Xml File using JAXB?
has comment: http://stackoverflow.com/comment/36363207
linked to: http://stackoverflow.com/q/17831304
linked to: http://stackoverflow.com/q/139076
score: 0
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has body: I am using Jaxb to edit an existing xml file. I have the xsd schema for this file, so i have generated the classes using xjc. To add new entries/elements to the xml file, I convert the file into an object using jaxb. Next, I make changes to this objects ie., add new objects to it ( by instantiating the classes) etc. Then this object is marshalled back to the same xml file. The problem is that the new xml file has different formatting as compared to that of the old one. The Comments are also lost and order of elements/attributes is also changed. Here is an example: Old.xml: <?xml version="1.0"?> New.xml: (added a new association element) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <component-definition base="application-family" category="application" home="j2ee" name="HCM" procedure="" singleton="false" type="hcm"> <yii-defition> So, the comments are missing. Some additional attributes like standalone etc are added. And ordering of attributes in the elements is also different. What should be done the maintain the same format , order etc??
has comment: http://stackoverflow.com/comment/36361962
has comment: http://stackoverflow.com/comment/36363059

http://stackoverflow.com/comment/36339006
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23655225
has text: If Processing is on your classpath, then you can simply use PImage. You only have to extend PApplet if you want to show a PApplet. The tutorials all show that case because it's the most common one. You know Java has its own image classes without requiring Processing though, right?

http://stackoverflow.com/a/23775003
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23767478
has body: add listener in your constructor btn1.addActionListener(this); btn2.addActionListener(this); if(e.getSource()==btn1) setBackground(new Color(Color.GREEN)); if(e.getSource()==btn2) setBackground(new Color(Color.RED)); for reference u can go to the blog http://cshotopics.blogspot.in/2014/05/how-to-apply-various-background-colors.html to know more..
answers question: http://stackoverflow.com/q/23767478

http://stackoverflow.com/comment/36259003
has text: each time you call `next()` you are getting a new object.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23617372
type: Comment

http://stackoverflow.com/a/23767516
score: 2
downvote count: 0
has body: Java and .NET handle generics differently. Let's take a look at the following piece of code: public class Foo<T> { private static Object staticMember; public T getStaticMember() { return (T) staticMember; } private T instanceMember; public T getInstanceMember() { return instanceMember; } public Foo(T value) { if (staticMember == null) { staticMember = value; } this.instanceMember = value; } } This is not good code in terms of quality, but for the sake of the example, it is a working piece of code for both Java and C#. In Java, the runtime only knows about the class Foo. So the following code Foo<Integer> foo = new Foo<Integer>(3); System.out.println(foo.getStaticMember()); // >> 3 System.out.println(foo.getInstanceMember()); // >> 3 will actually be compiled to something similar: Foo foo = new Foo(3); System.out.println(((Integer) foo.getInstanceMember()).toString()); // 3 System.out.println(((Integer) foo.getStaticMember()).toString()); // 3 As you can see, the generic is translated into type cast for the static member. The following code then will fail in Java with a runtime exception: Foo<Integer> foo1 = new Foo<Integer>(3); Foo<String> foo2 = new Foo<String>("This is a string"); System.out.println(foo1.getInstanceMember()); // >> 3 System.out.println(foo2.getInstanceMember()); // >> This is a string System.out.println(foo1.getStaticMember()); // >> 3 System.out.println(foo2.getStaticMember()); // Invalid cast exception because it will be treated as: Foo foo1 = new Foo(3); Foo foo2 = new Foo("This is a string"); System.out.println(((Integer) foo1.getInstanceMember()).toString()); // >> 3 System.out.println(((String) foo2.getInstanceMember()).toString()); // >> This is a string System.out.println(((Integer) foo1.getStaticMember()).toString()); // >> 3 System.out.println(((String) foo2.getStaticMember()).toString()); // Invalid cast exception The last line would attempt to cast the static member, which is Integer to String. The above code will work fine in C#, prin…
answers question: http://stackoverflow.com/q/23767056
type: Answer
has comment: http://stackoverflow.com/comment/36611136
upvote count: 2
has comment: http://stackoverflow.com/comment/36611368
has comment: http://stackoverflow.com/comment/36551373
has comment: http://stackoverflow.com/comment/36550716

http://stackoverflow.com/q/23688177
has answer: http://stackoverflow.com/a/23688260
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36396844
type: Question
has body: When I press a key in a userID box I want the text in the textbook to be erased when the first key is pressed. I thought that the code below would do that but it is not erasing the text in the text field. How to set the text to empty in my JTextField? Code: @Override public void keyPressed(KeyEvent e) { final Component source = e.getComponent(); final JFrame frame = (JFrame) SwingUtilities.getRoot(source); if (source instanceof JTextField){ ((JTextField) source).setText(""); source.repaint(); } } I should mention that my KeyListener is in a completely different class. class myKeyListener implements KeyListener { @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyPressed(KeyEvent e) { final Component source = e.getComponent(); final JFrame frame = (JFrame) SwingUtilities.getRoot(source); JTextField tf = (JTextField)e.getSource(); tf.setText(""); } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } }
has answer: http://stackoverflow.com/a/23688269
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36396765
has comment: http://stackoverflow.com/comment/36396897
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36398036
linked to: http://stackoverflow.com/q/20578568
has title: Cannot get the JTextField to set text to null on keyPressed?
has comment: http://stackoverflow.com/comment/36397623

http://stackoverflow.com/comment/48683159
comment on: http://stackoverflow.com/a/23728543
score: 0
type: Comment
has text: What would you suggest to use with Scala 2.11 (not 2.10) ?
type: AnswerComment

http://stackoverflow.com/comment/36366582
has text: sorry, I have removed some things to simplify the code, I edit the question
comment on: http://stackoverflow.com/q/23672720
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36530181
type: AnswerComment
has text: thanks for your answer,it really helps, can you provide me a little example? i' ll appreciate a lot.
type: Comment
comment on: http://stackoverflow.com/a/23758777
score: 0

http://stackoverflow.com/comment/36540924
type: Comment
type: QuestionComment
has text: Please post your Logcat..
comment on: http://stackoverflow.com/q/23764324
score: 0

http://stackoverflow.com/comment/36380913
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23679716
has text: @Gimby when i tried to see what actually it is displaying,buy using getName method it printed jsessionid
score: 0

http://stackoverflow.com/a/23698179
has comment: http://stackoverflow.com/comment/36415655
has body: You should just implement a share intent instead and let the system do it all for you. &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/menu_item_share" android:showAsAction="ifRoom" android:title="Share" android:actionProviderClass= "android.widget.ShareActionProvider" /&gt; ... &lt;/menu&gt; and private ShareActionProvider mShareActionProvider; ... @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.share_menu, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); // Return true to display menu return true; } // Call to update the share intent private void setShareIntent(Intent shareIntent) { if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); } }
score: 0
has comment: http://stackoverflow.com/comment/36414662
type: Answer
answers question: http://stackoverflow.com/q/23698065

http://stackoverflow.com/q/23734393
tagged with: performance
downvote count: 0
score: 1
tagged with: java
has title: Few calculations with huge matrices vs. lots of calculations with small matrices
has body: I am working on a Java project which has thousands of matrix calculations. But the matrices are at most 10x10 matrices. I wonder if it is better to use a matrix library or use write the simple functions (determinant(), dotproduct() etc.) Because when small matrices are used, it is advised not to use libraries but do the operations by custom functions. I know that matrix libraries like JAMA provides high performance when it comes to 10000x10000 matrices or so. Instead making 5-6 calculations with 10000x10000 matrices, I make 100000 calculations with 10x10 matrices. Number of primitive operations are nearly the same. Are both cases same in terms of performance? Should I treat myself as if I'm working with huge matrices and use a library?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23735105
accepted answer: http://stackoverflow.com/a/23735105
has answer: http://stackoverflow.com/a/23735793
tagged with: matrix
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36489325
possible better answer: http://stackoverflow.com/a/23735793
has comment: http://stackoverflow.com/comment/36484824
type: AnsweredQuestion

http://stackoverflow.com/q/23630494
accepted answer: http://stackoverflow.com/a/23630647
has answer: http://stackoverflow.com/a/23630634
score: 0
tagged with: android
has body: I'm trying to create a sort of product viewer. I've got the list with products working but I need it to open a separate product view if I click on one of the items in that list. I've tried passing the Id of a product to the new activity but for some reason it won't work. Can anybody help? Thanks in advance. This is my product list: public class inside_category extends Activity { private static String _category; List&lt;product&gt; Products = new ArrayList&lt;product&gt;(); ListView productListView; private static List&lt;product&gt; productCategory = new ArrayList&lt;product&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inside_category); setTitle(_category); productListView = (ListView) findViewById(R.id.listView); addProduct(); populateList(); productListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) { product_view productviewer = new product_view(); productviewer.setCurrentProductId(productCategory.get(position).getId()); productviewer.setTitle(productCategory.get(position).getProductName()); Intent intent = new Intent(inside_category.this, product_view.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.inside_category, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public static List&lt;product&gt; getProductCategory(){ return productCategory; } public static void setC…
favorite count: 0
tagged with: view
possible better answer: http://stackoverflow.com/a/23630634
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36285255
type: AnsweredQuestion
has title: Filling a view dynamically?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2736389
answer count: 2
has answer: http://stackoverflow.com/a/23630647

izpack
tag name: izpack
type: Tag
tags question: http://stackoverflow.com/q/23688417

http://stackoverflow.com/q/23731198
answer count: 3
has answer: http://stackoverflow.com/a/23738215
has body: Idea is to make the most elegant code as you can. Theme of section: loops. Task: return sum of squares of numbers from 1 to (n-1) example: 6 -> 55 (which is 1^2 + 2^2 + 3^2 + 4^2 + 5^2) I chose Java as language and wrote this code: public class Program { public static int Puzzle(int n) { int r=0; for(--n;n&gt;=0;r+=n*n--); return r; } } but compiler says that my code is not elegant enough. Can you help? Link:CodeHunt
has answer: http://stackoverflow.com/a/23731469
has comment: http://stackoverflow.com/comment/36478358
has comment: http://stackoverflow.com/comment/36489901
upvote count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/36504021
has title: Code hunt game 02.05
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23738215
score: -5
possible better answer: http://stackoverflow.com/a/23731255
favorite count: 0
has answer: http://stackoverflow.com/a/23731255
type: Question
has comment: http://stackoverflow.com/comment/36490838
has comment: http://stackoverflow.com/comment/36478398
tagged with: java

http://stackoverflow.com/q/23718882
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36454378
has comment: http://stackoverflow.com/comment/36454350
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36454397
has comment: http://stackoverflow.com/comment/36454340
possible better answer: http://stackoverflow.com/a/23718901
has comment: http://stackoverflow.com/comment/36454363
has comment: http://stackoverflow.com/comment/36455021
has title: Extracting specific pattern of string using regular expression
answer count: 2
has answer: http://stackoverflow.com/a/23718901
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23719259
accepted answer: http://stackoverflow.com/a/23719259
has body: I have a text while which shows certain output in the form of strings and numbers and from that I have a specific piece of text as follows .I want to extract a certain piece of text from that This is a small piece of my content gjhsgdjhgfjhdgfjkhsdgfjkhgsdfk7868736876534 Pattern is: (4,24,[5,96]) -&gt; (1,14,[14,15]), that is: "Poland" -&gt; "Poland" (4,46,[36,39]) -&gt; (1,14,[14,15]), that is: "Kim" -&gt; "Kim" fhafsdhjdfgjhdagfkhj66876493985694(hjiikfghkjfhg,98698) (hhgjhgdfj,jhgkjdhgf) From this I want to get the output as "Poland" -&gt; "Poland" "Kim" -&gt; "Kim" "The police" -&gt; "The city police on Friday" The code I tried is Pattern p = Pattern.compile("(Pattern is:)\\((.*?)\\)"); Matcher m = p.matcher(str); while(m.find()) { System.out.println("fhkjsdfhkjsdh"); System.out.println(m.group(2)); }

http://stackoverflow.com/q/23767048
tagged with: java
tagged with: zipoutputstream
answer count: 1
has title: What is default size of ZipEntry
score: 0
has answer: http://stackoverflow.com/a/23767089
type: UnansweredQuestion
has body: If I create a ZipEntry without specifying it's size, what is default size? Do I need to specify it's size? When do we set the size? I see that ZipEntry has a setSize(long size) method. ZipEntry entry = new ZipEntry(filename);
type: Question

jasper-reports
tags question: http://stackoverflow.com/q/23733947
tags question: http://stackoverflow.com/q/23766146
tags question: http://stackoverflow.com/q/23731737
tags question: http://stackoverflow.com/q/23636225
tags question: http://stackoverflow.com/q/23647191
tags question: http://stackoverflow.com/q/23755564
tags question: http://stackoverflow.com/q/23657690
tag name: jasper-reports
tags question: http://stackoverflow.com/q/23633489
tags question: http://stackoverflow.com/q/23623487
tags question: http://stackoverflow.com/q/23768536
type: Tag
tags question: http://stackoverflow.com/q/23629325

http://stackoverflow.com/a/23687332
type: Answer
accepted answer of: http://stackoverflow.com/q/23687289
answers question: http://stackoverflow.com/q/23687289
has comment: http://stackoverflow.com/comment/36394777
has body: Try this: java -classpath PATH_TO_EAT.jar com.body.Mouth
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36323359
has text: Agree with @Alex Suo. Some sample code here. http://www.novell.com/documentation/extend52/Docs/help/MP/jms/tutorial/pubSub-1.htm
comment on: http://stackoverflow.com/a/23650134
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36409334
comment on: http://stackoverflow.com/a/23669724
score: 0
type: AnswerComment
has text: Darren, With your help, I have managed to fix my code and get it working. I am relatively new to Java and am still trying to understand concurrency, locks etc. Thanks again for taking the time to go thru' my code and explain things in detail.
type: Comment

http://stackoverflow.com/a/23674036
has comment: http://stackoverflow.com/comment/36373129
has comment: http://stackoverflow.com/comment/36371949
score: 2
has comment: http://stackoverflow.com/comment/36371036
upvote count: 2
has comment: http://stackoverflow.com/comment/36369740
has comment: http://stackoverflow.com/comment/36370263
has comment: http://stackoverflow.com/comment/36370728
has comment: http://stackoverflow.com/comment/36370590
has body: Your query is wrong String sql3=""; sql3+= "CREATE TABLE T_DIZ_AMB ("; sql3+= " _id_AMB INTEGER PRIMARY KEY AUTOINCREMENT,"; sql3+= " NOME_AMB TEXT NOT NULL,"; //comma should not be here sql3+= ")"; Remove the comma "," from the last field and change it as below; String sql3=""; sql3+= "CREATE TABLE T_DIZ_AMB ("; sql3+= " _id_AMB INTEGER PRIMARY KEY AUTOINCREMENT,"; sql3+= " NOME_AMB TEXT NOT NULL"; sql3+= ")"; EDITED: Define all your FORIENG KEY at the last in your table that is the rule. Change your query as below: sql5+= " _id_FK_L2 INTEGER NOT NULL,"; sql5+= " _id_FK_PRE INTEGER NOT NULL,"; sql5+= " FOREIGN KEY(_id_FK_L2) REFERENCES T_LOGIN(_id_LOGIN),"; sql5+= " FOREIGN KEY(_id_FK_PRE) REFERENCES T_DIZ_PRE(_id_PRE)"; sql5+= ")";
has comment: http://stackoverflow.com/comment/36370921
has comment: http://stackoverflow.com/comment/36374042
downvote count: 0
has comment: http://stackoverflow.com/comment/36370007
has comment: http://stackoverflow.com/comment/36373844
has comment: http://stackoverflow.com/comment/36370513
has comment: http://stackoverflow.com/comment/36373611
has comment: http://stackoverflow.com/comment/36369495
answers question: http://stackoverflow.com/q/23673970
has comment: http://stackoverflow.com/comment/36369645
has comment: http://stackoverflow.com/comment/36371009
has comment: http://stackoverflow.com/comment/36369912
has comment: http://stackoverflow.com/comment/36369812
has comment: http://stackoverflow.com/comment/36369858
type: Answer
has comment: http://stackoverflow.com/comment/36370429
has comment: http://stackoverflow.com/comment/36373377

http://stackoverflow.com/a/67871323
score: 0
answers question: http://stackoverflow.com/q/23713754
has body: Change the version of the library in the build.gradle(:app) file to "com.google.android.gms:play-services-ads:19.2.0". This did the trick for me
type: Answer

http://stackoverflow.com/comment/36367205
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23673082
type: AnswerComment
has text: One day you will be able to comment ;-)

http://stackoverflow.com/comment/36490145
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23736053
has text: show the code you are talking about. It sounds like you are trying to add an activity to your viewpager, but its supposed to only hold fragments, not activities,

http://stackoverflow.com/comment/50804145
type: Comment
type: QuestionComment
score: 0
has text: Is `drawer_shadow.9` also useable for the right-side drawer?
comment on: http://stackoverflow.com/q/23690162

http://stackoverflow.com/q/23756030
has comment: http://stackoverflow.com/comment/36525325
tagged with: java
has body: This is code I'm using to launch an app : launchApp(context , packagemanager , "com.android.phone") /* * Launch an application * * @param c Context of application * * @param pm the related package manager of the context * * @param pkgName Name of the package to run */ public static boolean launchApp(Context c, PackageManager pm, String pkgName) { // query the intent for lauching Intent intent = pm.getLaunchIntentForPackage(pkgName); // if intent is available if (intent != null) { try { c.startActivity(intent); } catch (ActivityNotFoundException ex) { // quick message notification Toast toast = Toast.makeText(c, "Application Not Found", Toast.LENGTH_LONG); // display message toast.show(); } catch (Exception e){ e.printStackTrace(); } } // by default, fail to launch return false; } This code launches applications without error but not widgets. When attempt to launch a widget no exception is thrown and widget is not launched. Can the code be modified to launch a widget ?
score: 0
has answer: http://stackoverflow.com/a/23756142
answer count: 1
type: UnansweredQuestion
tagged with: android
has title: Why is this code not launching Android widget
type: Question

http://stackoverflow.com/q/23761904
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36536364
tagged with: java
accepted answer: http://stackoverflow.com/a/23773549
tagged with: concurrency
has comment: http://stackoverflow.com/comment/36541607
has answer: http://stackoverflow.com/a/23762433
answer count: 3
has comment: http://stackoverflow.com/comment/36536567
has comment: http://stackoverflow.com/comment/36536253
downvote count: 0
possible better answer: http://stackoverflow.com/a/23762433
has title: Java: Design pattern for method that gets called excessively
has body: What's the best practice in Java to protect a method from being called excessively, while still keeping it non-blocking? My usecase is a custom buffer for audio data. The buffer's method through which data can be polled from it must be non-blocking, and it is acceptable for the method to return null when no data is available. It's not acceptable for the method to be blocking, so I do not want to make it synchronized. When the method is called excessively the sound quality decreases. So how can I protect the method under heavy load, without relying on callers to behave themselves? My current approach is to remember the timestamp of the last poll and return null if it's shorter ago than 3ms, but this feels a bit "hacky"...
favorite count: 0
has comment: http://stackoverflow.com/comment/36542544
has answer: http://stackoverflow.com/a/23762194
has answer: http://stackoverflow.com/a/23773549
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/36537202

http://stackoverflow.com/q/23735104
tagged with: inheritance
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23735165
tagged with: generics
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23735165
has answer: http://stackoverflow.com/a/23735171
type: Question
has answer: http://stackoverflow.com/a/23735190
has body: I want to parametirize class with two other params, so that I can provide one of them independently, AdGroupIdentifier OR KeywordIdentifier. But I am getting following warning: The type parameter KeywordIdentifier is hiding the type KeywordIdentifier. Do you think I am doing something wrong? What is a correct way of doing that? Thanks for any help! public class Metrics &lt;T extends AdGroupIdentifier, KeywordIdentifier&gt; { public void addMetric(T identifier){ .... } }
accepted answer: http://stackoverflow.com/a/23735190
has title: Java parameterize class warning

http://stackoverflow.com/q/23750565
answer count: 2
downvote count: 2
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36515737
type: UnansweredQuestion
has title: Could I bond java byte[] buffer to an InputStream and read for multiple times
tagged with: java
has body: Could I bond readBuf to DataInputStream, I will read some bytes to readBuf, and I will read int and other data from DataInputStream which bond to readBuf. Can I do below code? byte[] readBuf = new byte[MAX_BYTE_SIZE ]; DataInputStream dis = new DataInputStream(new ByteArrayInputStream(readBuf)); writeBytes( UartCmd[1] ); i_ReadLength = readBytes(readBuf); uc_Index = dis.readInt(); writeBytes( i_WritedLength ); i_ReadLength = readBytes(readBuf); uc_Index = dis.readInt(); thinks all your help.
has comment: http://stackoverflow.com/comment/36515237
has answer: http://stackoverflow.com/a/23751071
type: Question
score: -1
has answer: http://stackoverflow.com/a/23751080

http://stackoverflow.com/a/35451972
type: Answer
score: 2
downvote count: 0
has body: In genral you add the data you want to receive in your response: response.getWriter().print("some data"); The in your SAPUI5 application you make a ajax call; $.ajax({ url : mai_data.request_url + "&amp;task=" + name, type : "POST", dataType : "text", data : "some upload data", success : function(oData) { } //oData contains the response text error : function(oData) { } //oData contains the response text }) However in your case I think you initially go to the Login servlet and use this for a login and want to create . The you are redirected to the indexLogged.html and want to access some of the cockie data there. Since you inclded the request and response via: rd.include(request,response); you should have access to the response data within the indexLogged.html.
answers question: http://stackoverflow.com/q/23673765
upvote count: 2

http://stackoverflow.com/q/23673660
has body: In Eclipse, if you place the cursor on any variable, a small popup box will appear containing the type (class) of this variable, how can I have the same in IntelliJ?
possible better answer: http://stackoverflow.com/a/34723501
tagged with: intellij-idea
tagged with: eclipse
has answer: http://stackoverflow.com/a/23673747
linked to: http://stackoverflow.com/q/7858588
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/23673747
type: Question
score: 10
upvote count: 11
linked to: http://stackoverflow.com/q/6615516
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/34723501
has title: IntelliJ: Highlight the type of a variable on hover
has comment: http://stackoverflow.com/comment/36368323
duplicate of: http://stackoverflow.com/q/6615516
downvote count: 1

http://stackoverflow.com/comment/36375645
has text: Unable to access jarfile xxxxx.jar
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23676282

http://stackoverflow.com/q/23686370
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36392858
has body: I am trying to return a validity date, or an expiration date for a file, if you will. Currently, I have a sample program that prints out all the needed information but nnot exactly in the format I get. My code prints out: Thu May 15 04:57:36 PDT 2014 But I need it to print out like so: Thu, 15 May 2013 04:57:36 PDT As you can see, very similar just not quite in the right place. Here is my test code that gives me the first result: import java.util.Calendar; import java.util.Date; public class TestCalendar{ public static void main(String[] args){ Calendar currentDate = Calendar.getInstance(); currentDate.setTime(new Date()); currentDate.add(Calendar.MINUTE, 24); Date newDate = currentDate.getTime(); System.out.println("Date: " + newDate); } } This code adds 24 minutes to the current time and then prints it out, I just cant figure out how to reformat this date. SimpleDateFormat doesn't seem like it's going to work but I could be wrong. I just couldn't figure it out. Thanks in advance for any help anyone is able to give me!!
upvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Changing the format of a complex date in Java
tagged with: date
type: Question
possible better answer: http://stackoverflow.com/a/23686415
has answer: http://stackoverflow.com/a/23686593
has answer: http://stackoverflow.com/a/23686415
accepted answer: http://stackoverflow.com/a/23686593

http://stackoverflow.com/comment/36479061
type: AnswerComment
has text: Was worth a try. Unfortunately I don't use dropwizard myself so I can't test it myself without setting it all up. Maybe you can create a ticket on [github](https://github.com/dropwizard/dropwizard) and ask for this to be implemented?
type: Comment
comment on: http://stackoverflow.com/a/23730945
score: 0

iteration
tags question: http://stackoverflow.com/q/23620270
tags question: http://stackoverflow.com/q/23618667
tags question: http://stackoverflow.com/q/23726640
tags question: http://stackoverflow.com/q/23730950
tags question: http://stackoverflow.com/q/23678660
type: Tag
tags question: http://stackoverflow.com/q/23718932
tag name: iteration

http://stackoverflow.com/a/77967720
type: Answer
score: 0
has body: This is very probable, that Tomcat or another Apache application is switched on autoloading when you start your PC. Please check list of autoloadings and switch off unnesessary applications
has comment: http://stackoverflow.com/comment/137463002
answers question: http://stackoverflow.com/q/23637905

http://stackoverflow.com/comment/36545255
type: Comment
has text: Q: What are you going to do with the WAR files once you unzip them??? Run your web app in a *different* J2EE container (like Tomcat or JBoss)? What exactly are you trying to accompllsh??? What exactly "isn't working"? Be specific.
type: AnswerComment
comment on: http://stackoverflow.com/a/23747814
score: 0

http://stackoverflow.com/q/23655554
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36367989
answer count: 3
has title: Want to know which Jenkins job is executing now, in java
has answer: http://stackoverflow.com/a/23656258
downvote count: 0
linked to: http://stackoverflow.com/q/13451045
favorite count: 0
has answer: http://stackoverflow.com/a/23656018
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23656262
has comment: http://stackoverflow.com/comment/36334592
has body: I have 3 Jenkins job. Below are the name of those Jenkins job: test_existing_api test_others_api test_new_api I have a config file in java project which have 3 different configuration. I want to pick the configuration depend upon Jenkins job. So first I want to check which Jenkins job is executing and then I will take configuration according to that job. That configuration will further require in java code. Please help me to understand how can I check which Jenkins job is executing now in Java.
tagged with: jenkins
score: 1

http://stackoverflow.com/q/23622154
answer count: 3
linked to: http://stackoverflow.com/q/3028219
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/23622232
has comment: http://stackoverflow.com/comment/36268607
favorite count: 0
accepted answer: http://stackoverflow.com/a/23622320
has answer: http://stackoverflow.com/a/23622320
type: AnsweredQuestion
tagged with: java
has title: Are Java static members initilized after static block?
has answer: http://stackoverflow.com/a/23622232
has answer: http://stackoverflow.com/a/23622233
has comment: http://stackoverflow.com/comment/36268516
type: Question
has comment: http://stackoverflow.com/comment/36268561
duplicate of: http://stackoverflow.com/q/3028219
tagged with: static-members
has body: Is there a reason where static final variable will not be instantiated before the static block? So in the example I provided will print: someVar value= null Instead of: someVar value=SomeValue I saw this behavior today, In my application, I am trying to reproduce - unsuccessfully - I do see the value of the static member... class SomeClass{ static final String someVar ="SomeValue"; static{ System.out.println("someVar value=" + someVar ); } public static void main(String[] args){ new SomeClass(); } }
tagged with: static-methods
score: 0

http://stackoverflow.com/comment/36319584
type: AnswerComment
has text: ha i am getting output like below after putting synchronized(this) Guide 0 is bussy. Waiting... Guide 0 is guiding 20 tourists All tourists exited for guide 0. Going to shop Guide 0 is free
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23648566

http://stackoverflow.com/comment/36374763
comment on: http://stackoverflow.com/a/23676825
type: Comment
has text: I'm fairly certain that the compiler is smart enough to do that optimization on its own.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36587440
has text: Actually android takes this into account, and will always return the correct recycled view, based upon the view you inflated last for that item type, and the item type of the next view.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23777444
type: Comment

http://stackoverflow.com/comment/36304543
type: Comment
comment on: http://stackoverflow.com/a/23640461
has text: It was a feature brought out in Java 7, so it's only compatible for that and future versions.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23767679
answer count: 4
linked to: http://stackoverflow.com/q/5915156
has comment: http://stackoverflow.com/comment/36548672
tagged with: java
tagged with: multithreading
upvote count: 1
downvote count: 1
has body: I have two instances of a thread which is running continuously . How can i stop the very first instance of the thread . Please find the code below :- public class Thread1 extends Thread { static volatile boolean bThreadStop = false ; public void run() { while(!bThreadStop) { System.out.println("THREAD1"); //BUSINESS LOGIC// } } public static void main(String[] args) { Thread1 t1 = new Thread1(); t1.start(); Thread1 t2 = new Thread1(); t2.start(); } } Here as per the above example , i need to stop t1 instance of Thread1 . Please suggest me how do I achieve the same .
type: Question
tagged with: cancellation
has answer: http://stackoverflow.com/a/23785309
has answer: http://stackoverflow.com/a/23767905
score: 0
linked to: http://stackoverflow.com/q/15624296
has answer: http://stackoverflow.com/a/23768014
linked to: http://stackoverflow.com/q/3590000
favorite count: 0
linked to: http://stackoverflow.com/q/413898
has title: Stopping a single instance of a Thread
has comment: http://stackoverflow.com/comment/36548962
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23767875

http://stackoverflow.com/comment/36481574
comment on: http://stackoverflow.com/a/23724969
has text: I have already created a jar file using BlueJ... But it is not working. I dont know where to type `jar cfe MainClass.jar MainClass MainClass.class` and frm where to run.. I am just a Beginner.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36300999
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23636500
type: Comment
has text: thanks for your edit, I tried it out and tried playing around with it but I still can't quite get what I need. Your answer shows how to verify input but I need the hyphen to always be showing like the MaskFormat of `##-###**` provides. An if I change `fieldWithVerifier` for a JFormattedTextField with a Mask, it does not work with the verifier correctly

http://stackoverflow.com/q/23706508
tagged with: jboss
type: Question
has body: Can some help in , Our Production servers all of a sudden starts crashing, I researched a lot but didn't find a solution , other than people suggesting to upgrade the java, but we are already on latest patch (java 6_71) # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00002b5b4dc9c2ba, pid=1278, tid=47671325686080 # # JRE version: 6.0_71-b12 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.71-b01 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libcknfast.so+0x10f2ba] long double+0x11a # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # 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 (0x00000000590ea800): JavaThread "http-0.0.0.0-8090-2" daemon [_thread_in_native, id=11189, stack(0x00002b5b585ef000,0x00002b5b586f0000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00000000000001a1
tagged with: crash
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36431140
has comment: http://stackoverflow.com/comment/36431126
favorite count: 0
has title: Fatal error has been detected by the Java Runtime Environment:
tagged with: jvm
linked to: http://stackoverflow.com/q/9231053
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23706683
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12037226

http://stackoverflow.com/comment/36354614
type: Comment
type: QuestionComment
has text: @ColonelThirtyTwo "Error: This Java instance does not support a 64-bit JVM. Please install the desired version."
comment on: http://stackoverflow.com/q/23666168
score: 0

http://stackoverflow.com/comment/36453085
comment on: http://stackoverflow.com/q/23718124
has text: Perhaps `kwhFieldT.setText(String.valueOf(kwh))` instead of `kwhFieldT = kwh.getText();` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23637397
score: 0
answer count: 2
has body: I have a javafx application that use external library in folder lib . If the library is not exist it will cause javafx launcher error : Exception while running application and program is closed. I want to give message on my own that the library is missing before program closed. How to give that message before the program closed ?
has comment: http://stackoverflow.com/comment/36318425
tagged with: java
tagged with: javafx
has title: How to handle JavaFX launcher error?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23671516
has answer: http://stackoverflow.com/a/23638198
type: Question
has comment: http://stackoverflow.com/comment/36298022

http://stackoverflow.com/comment/36321180
comment on: http://stackoverflow.com/q/23649389
has text: if you use eclipse, try changing the generated class file compatibility to java 7
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36471602
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23727517
has text: See the link I provided above. Java says it is not a matter of taste.

http://stackoverflow.com/comment/36375374
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23673212
score: 1
has text: You might also want to look at [eWorld](http://eworld.sf.net) simulator and how they realize this task.

http://stackoverflow.com/q/23677976
has body: I had got some concrete included jars like primefaces in a very old project. Yesterday i open that project in eclipse and decided to add everything with maven. But even i delete concrete included jars, in target i both see primefaces3.5.jar(added manually a year ago) and primefaces5.0.jar whic comes with maven(as i need). I need to clean/clear/delete? target dir in the project, i think. The two different primefaces versions are conflicting and i am getting errors, when i search for error, i found out that i have two different versions at the same time. Thanks EDIT: I manually delete project/Web Content/WEB-İNF/lib/primefaces3.5.jar, and server started without errors
has answer: http://stackoverflow.com/a/23678641
tagged with: java
score: 0
tagged with: eclipse
has answer: http://stackoverflow.com/a/23678839
has title: How to clean/delete a Maven project's "target" dir in Eclipse
tagged with: primefaces
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36377728
has comment: http://stackoverflow.com/comment/36378303
type: Question
answer count: 2
tagged with: maven

http://stackoverflow.com/comment/36475352
score: 0
comment on: http://stackoverflow.com/q/23729508
has text: You also can't access `ArrayList` elements using array notation. arrays != `ArrayList`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36275812
score: 0
type: Comment
type: AnswerComment
has text: You did actually, by marking it a @Controller and using component scan in your spring config spring will automatically pick it up
comment on: http://stackoverflow.com/a/23625842

http://stackoverflow.com/a/23678878
type: Answer
has comment: http://stackoverflow.com/comment/36380876
score: 0
answers question: http://stackoverflow.com/q/23678660
has body: Theoretically you can do this using iterator: Iterator&lt;TheBean&gt; itb = mList.iterator(); Iterator&lt;Entry&lt;Integer, List&lt;String&gt;&gt;&gt; itmap = mMap.iterator(); while (itb.hasNext() &amp;&amp; itmap.hasNext()) { TheBean b = itb.next(); Entry&lt;Integer, List&lt;String&gt;&gt; e = itmap.next(); // do you logic that I IMHO do not understand exactly. } However this will not work because map does not preserve order of keys. So, if I understand that index of list should match key of map you can do the following: for (int i = 0; i &lt; mList.size(); i++) { TheBean b = mList.get(i); List&lt;String&gt; listOfStrings = mMap.get(i); if (listOfStrings != null) { // implement your logic here. } } I hope this helps

http://stackoverflow.com/a/23628812
has body: Defining a @QueryParam does not mean that this parameter is required. If the query-string is empty or not including the defined query-param the value of the parameter will be null. So both methods are ambiguous and seems like the first one wins. If you want two methods you can easily check for null and call the other method. @GET public Response filterQuery(@QueryParam("filter") String filterQuery) { if (filterQuery == null) { return filter(); } return Response.accepted("filter: " + filterQuery).build(); } private Response filter() { return Response.accepted("Hello world").build(); }
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23625927
answers question: http://stackoverflow.com/q/23625927
score: 1

http://stackoverflow.com/comment/36291607
has text: @user3375746 What you propose won't solve the issue of getting negative integers.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23634109

http://stackoverflow.com/q/23661856
type: Question
has answer: http://stackoverflow.com/a/23664529
accepted answer: http://stackoverflow.com/a/23664529
answer count: 2
tagged with: dependencies
possible better answer: http://stackoverflow.com/a/23662032
has answer: http://stackoverflow.com/a/23662032
tagged with: maven
has body: We are using an internal Nexus Repository for third party jars which are dependencies in our applications. I am starting a new project, and have a set of 4 third party jar files which I want to upload to Nexus, and then reference, ideally, as a single dependency (i.e. artifactId/version) from my project pom.xml. These jars are always given together, never versioned separately, so having a separate artifactId/version combination for each jar is not useful. Is it possible to upload all the jars into a single artifact/version folder in Nexus, and then to reference them as a single dependency in my Maven project?
type: AnsweredQuestion
has title: Maven: Is it possible to upload a set of 3rd party jars to repository, which can then be referenced as a single dependency?
score: 0
tagged with: java

http://stackoverflow.com/comment/36280341
type: QuestionComment
has text: Are you trying to implement some kind of auto-complete?
comment on: http://stackoverflow.com/q/23628320
score: 0
type: Comment

http://stackoverflow.com/comment/36446591
has text: yes, I realized that, after the comments above, and corrected it, it works fine now, thank you :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23711913

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/23633823
tags question: http://stackoverflow.com/q/23677842
type: Tag

http://stackoverflow.com/comment/36443447
type: QuestionComment
has text: What do you mean by "initial marking"?
score: 0
comment on: http://stackoverflow.com/q/23713129
type: Comment

http://stackoverflow.com/comment/36563644
comment on: http://stackoverflow.com/q/23775664
score: 0
type: Comment
type: QuestionComment
has text: please check i have edited

akka
type: Tag
tags question: http://stackoverflow.com/q/23773175
tag name: akka
tags question: http://stackoverflow.com/q/23713415
tags question: http://stackoverflow.com/q/23761452
tags question: http://stackoverflow.com/q/23655552
tags question: http://stackoverflow.com/q/23772475

http://stackoverflow.com/comment/36566600
has text: I should have pointed out that even though the article say use StringBuilder, the first one says do it because of JDK5 and the second one points to the reason to use StringBuilder when constructing strings using if statements or for loops. The way the poster uses strings he should stick with concatenation
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23777602

http://stackoverflow.com/comment/36494203
type: AnswerComment
has text: @user3589316 Then remove the filter when the user presses cancel... Or please elaborate what exactly you're trying to achieve here.
type: Comment
comment on: http://stackoverflow.com/a/23739704
score: 0

http://stackoverflow.com/comment/36454078
comment on: http://stackoverflow.com/q/23718749
has text: Show us the specific method in which this occurs. This will help narrow down a cause.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23669358
has comment: http://stackoverflow.com/comment/36360574
tagged with: jsp
linked to: http://stackoverflow.com/q/22743803
has body: I was wondering about the net to use MVC in my JSP project and found a great discussion here, now I have following: public class Subject { private String subjectId = null; private String subjectName = null; public String getSubjectId() { return subjectId; } public void setSubjectId(String subjectId) { this.subjectId = subjectId; } public String getSubjectName() { return subjectName; } public void setSubjectName(String subjectName) { this.subjectName = subjectName; } } and my SubjectDAO class is : public class SubjectDAO { public List&lt;Subject&gt; subjectList() throws SQLException{ Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; List&lt;Subject&gt; subjects = new ArrayList&lt;&gt;(); try { connection = DatabaseManager.initConnection(); statement = connection.prepareStatement(Constant.SUBJECT_QUERY); resultSet = statement.executeQuery(); while (resultSet.next()) { Subject subject = new Subject(); subject.setSubjectId(resultSet.getString(&quot;_id&quot;)); subject.setSubjectName(resultSet.getString(&quot;subj_name&quot;)); subjects.add(subject); } } finally { if (resultSet != null) try { resultSet.close(); } catch (SQLException ignore) {} if (statement != null) try { statement.close(); } catch (SQLException ignore) {} if (connection != null) try { connection.close(); } catch (SQLException ignore) {} } return subjects; } } and in my ControllerServlet I have : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { List&lt;Subject&gt; subjects = subjectDAO.subjectList(); request.setAttribute(&quot;subjects&quot;, subjects); getServletContext().getRequestDispatcher(&quot;/content.jsp&quot;).forward( request, response); } catch (Exception e) { throw new ServletException(&quot;Cannot obtain subjects from DB&quot;, e.getCause()); } } my JSP as View is : &lt;c:forEach items=&quot;${subjects}&quot; var=&quot;subject&quot;&gt; &lt;li &lt;c:catch&gt; &lt;c:choose&g…
has comment: http://stackoverflow.com/comment/36360557
has answer: http://stackoverflow.com/a/23669896
has answer: http://stackoverflow.com/a/23669636
has comment: http://stackoverflow.com/comment/36360530
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36360447
has comment: http://stackoverflow.com/comment/36360741
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36360434
has comment: http://stackoverflow.com/comment/36360625
linked to: http://stackoverflow.com/q/18211497
tagged with: model-view-controller
tagged with: java
has comment: http://stackoverflow.com/comment/36360397
linked to: http://stackoverflow.com/q/5003142
has comment: http://stackoverflow.com/comment/36360412
has comment: http://stackoverflow.com/comment/36360724
type: Question
has comment: http://stackoverflow.com/comment/36360485
has title: ServletException in retrieving data from db in jsp mvc
linked to: http://stackoverflow.com/q/2123514
has comment: http://stackoverflow.com/comment/36360832

http://stackoverflow.com/comment/36352573
has text: you don't need a loop for this. try this pseudocode: `if (list.contains(x)) { list.remove(x);}`
type: Comment
comment on: http://stackoverflow.com/q/23665098
type: QuestionComment
score: 0

http://stackoverflow.com/a/23759982
downvote count: 0
type: Answer
has body: You will need to override toString() method for meaningful reprsentation of your object. System.out.println() calls toString() method and you can see the string returned from toString() method. public String toString(){ return "Customer [name =" + name+ ", age=" + age + ",id =" + id "]"; }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23759914

http://stackoverflow.com/a/23667096
has comment: http://stackoverflow.com/comment/36542809
has body: Don't use a null layout. By default your buttons have a default size of (0, 0) so there is nothing to paint. User a layout manager, probably a GridLayout, and the layout manager will determine the size and location of each button for you. Read the section from the Swing tutorial o Using Layout Managers for more information and working examples.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23666955
has comment: http://stackoverflow.com/comment/36551289
answers question: http://stackoverflow.com/q/23666955
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23725497
answers question: http://stackoverflow.com/q/23725479
type: Answer
has comment: http://stackoverflow.com/comment/36467206
has comment: http://stackoverflow.com/comment/36467188
has comment: http://stackoverflow.com/comment/36467236
score: 4
has body: Maps store a value based on a key. The key serves to define the location of the value inside the Map data structure (array, linked list, tree, etc. depending on the implementation of the Map). By knowing this, a Map doesn't work with index concept, only key. In this case, you're setting a String value as your key, but trying to retrieve the data using an Integer, and the exception is pretty clear about it: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer One possible solution may be to change the key to Integer instead (if possible). If you want/need to iterate over the values on the Map, you may use a for loop on Map#values: for (Enclavament enclavement : a_enclavaments.values) { //do what you want/need } If using the latter, there's no need to change the type of the key of your Map.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36467568
accepted answer of: http://stackoverflow.com/q/23725479

http://stackoverflow.com/a/57190963
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23771129
has body: I had this same issue, I did all suggested until I noticed there is a "Problems" index in the Project Structure window of IntelliJ. It said that there was a problem because my directory "lib" was not included in the Artifact. I just clicked "Fix" and after that, everything worked. Maybe this helps someone else.

http://stackoverflow.com/comment/36442631
type: Comment
type: QuestionComment
has text: I don't get any errors. It's just that the file does not get saved on the location I choose in the showSaveDialog window. Nor does it get the name I put in the showSaveDialog.
comment on: http://stackoverflow.com/q/23712767
score: 0

http://stackoverflow.com/a/23684053
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23683865
downvote count: 1
score: -1
has body: yes this happens because every time you scroll it again try to load the images.Univeralimageloader is a heavy image loader with much flexibility . But if you want your image to be loaded faster i found a fastest library to load image. UrlImageViewHelper it is easier to use and its fastest to loader. Try this at least once.

http://stackoverflow.com/comment/36327226
comment on: http://stackoverflow.com/q/23650830
score: 0
has text: I think if I am ever asked an interview question like this, I will ask for a realistic work environment in which to answer, meaning that I have a browser with access to the Web and can Google "immutable hashmap" (which is not quite what I want, but the top pages it returns cross-reference http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html?is-external=true#unmodifiableMap%28java.util.Map%29 ).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23715768
tagged with: java
has comment: http://stackoverflow.com/comment/36448322
has answer: http://stackoverflow.com/a/23715816
answer count: 3
has answer: http://stackoverflow.com/a/23715804
tagged with: arrays
has body: I don't know why this array is not found I'm trying to find a number that correspinds, but this doesn't work for some reason public static int sortLevel(char level) { final char[] LEVEL = {'7', '1', '9', '8'}; for (int index = 0; index &lt; LEVEL.length; index++) { if(LEVEL(index) == level) return index; } // error code for not found, should not be reached return -1; } it returns error cannot find symbol -- method LEVEL(int) okay,dat works, but I have another problem So, I have a Course Class, and I don't know what this method accepts as a parameter, Any ideas as to how, this is the name of the method public int compareTo(Course otherCourse) this is the method call course1.compareTo() what do I put inside the brackets
score: 0
has comment: http://stackoverflow.com/comment/36448231
has title: Why is this array not found
has answer: http://stackoverflow.com/a/23715800
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36448187
type: Question

http://stackoverflow.com/comment/36319795
type: Comment
type: QuestionComment
has text: for (int second = 0;; second++) { if (second >= 60) fail("timeout"); try { if (isElementPresent(By.id("terms-checkbox"))) break; } catch (Exception e) {} Thread.sleep(1000); } driver.findElement(By.id("terms-checkbox")).click();
score: 0
comment on: http://stackoverflow.com/q/23648357

http://stackoverflow.com/q/23641793
type: UnansweredQuestion
has title: Alternative solution to the Ehcache GUID/java.net.UnknownHostException
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36307054
type: Question
has body: We are running into the Ehcache GUID/java.net.UnknownHostException issue. There are known solutions to this problem answered previously. Is there any other workaround, hopefully, at the Ehcache configuration level besides editing /etc/hosts? We deploy our software to many customers and they may not have the knowledge or permissions to edit an /etc/hosts file. More broadly, it is somewhat awkward and fragile for a cache to depend on a network call or a properly configured /etc/hosts file. Can this be resolved in any other way? Ultimately, we need a cache similar to what ehcache provides, but does not suffer from this limitation. I would prefer not to roll my own, but would entertain the possibility. Edit (July, 2014) It looks like we were running into this Java 7 bug described in the comment section here. It is fixed in Java 8.
linked to: http://stackoverflow.com/q/8562881
downvote count: 0
favorite count: 0
tagged with: ehcache
linked to: http://stackoverflow.com/q/1881546
upvote count: 2

http://stackoverflow.com/comment/36515635
type: AnswerComment
comment on: http://stackoverflow.com/a/23750273
has text: @Rahaman May i know how to map invalid URL pattern..My Requirement is "For an invalid request i should get 404 error page" But in my application we have pre compiled jsps and i used 404 /WEB-INF/classes/org/pache/jsp/jsp/error/error_jsp which is not working for an invalid request.
type: Comment
score: 0

http://stackoverflow.com/comment/36377502
type: QuestionComment
type: Comment
has text: My query is how can the Non Static nested class 'Inner' be accessed by outer class reference 'Outer' ('Outer.Inner'??), whereas Inner is an Instance member?
comment on: http://stackoverflow.com/q/23657498
score: 0

http://stackoverflow.com/a/23700107
answers question: http://stackoverflow.com/q/23699478
has body: So a clean way to do this is to use one of Guava's FluentIterable, which is googles class for filtering sets according to some rule. First make a predicate to define your sort: class sorter implements Predicate&lt;Product&gt; { private final String name; sorter(String name){ this.name=name } @Override boolean apply(Product input){ return (input.name == this.name) } } This will return true if input.name is the same as the name given to the predicate. This works with Guava's fluentIterable class to return all the elements where the predicate is true. E.g. List&lt;Product&gt; cars = FluentIterable.from(list).filter(new sorter("car")) Will produce a list of all the elements which have name "car". Since you will iterate once for each name it might have performance issues on large sets, on the other hand, since its all read only and does not mutate the list, you could easily multithread it locally. It is very easy to read/maintainable though.
score: 0
type: Answer

http://stackoverflow.com/comment/36554606
type: Comment
comment on: http://stackoverflow.com/a/23770996
has text: Whatever it is, the parameter isn't even used in the method!
score: 1
type: AnswerComment

http://stackoverflow.com/a/23820514
has body: The answer is yes. If one is writing own resource server and own auth server, they have to share the database. This question is duplicate of oAuth2 Token validation/verification in Spring There is another thread with similar topic confirming the answer: validate OAuth 2.0 access token from a Spring RESTful resource server
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23778134
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23778134

http://stackoverflow.com/q/23626339
accepted answer: http://stackoverflow.com/a/23637306
linked to: http://stackoverflow.com/q/9350398
has comment: http://stackoverflow.com/comment/36284078
type: Question
has body: So my aim is to make a runnable jar. I've made a program using swings which uses MS Access database to fetch records. So, I've used an absolute path to refer to the database for connection. Now, I intend to distribute this runnable jar to other people as well. So I guess the best option would be to embed the MS Access database as well in the jar file. But I don't know how to do that. Where should I keep the database in my Project Explorer ? Should I use a relative path etc. Any form of help would be appreciable. I've found many tutorials for using Derby database that would implement the same but none pertaining to Ms Access database. Suggestions are welcome ! This is my code:- import java.awt.*; import java.awt.event.*; import java.sql.*; import java.util.Vector; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class r_search extends JFrame implements ActionListener { JFrame frame1; JLabel l0, l1, l2; JComboBox c1; JButton b1; Connection con; ResultSet rs, rs1; Statement st, st1; PreparedStatement pst; String ids; static JTable table; String[] columnNames = {"SECTION NAME", "REPORT NAME", "CONTACT", "LINK"}; String from; r_search() { l0 = new JLabel("Fetching Search Results..."); l0.setForeground(Color.blue); l0.setFont(new Font("Serif", Font.BOLD, 20)); l1 = new JLabel("Search"); b1 = new JButton("submit"); l0.setBounds(100, 50, 350, 40); l1.setBounds(75, 110, 75, 20); b1.setBounds(150, 150, 150, 20); b1.addActionListener(this); setTitle("Search Executive Reports :) "); setLayout(null); //setVisible(true); setSize(500, 500); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); add(l0); add(l1);; add(b1); try { Vector v = new Vector(); String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + "C:\\users\\ppreeti\\executive_db.accdb"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection(url,"",""); /*con = DriverManager.getConnection("jdbc:oracle:thin:@mcndesktop07:1521:xe", "sandeep", "welco…
has comment: http://stackoverflow.com/comment/36284812
tagged with: jar
answer count: 1
downvote count: 0
has title: embed MS Access database with runnable jar
tagged with: ms-access
has answer: http://stackoverflow.com/a/23637306
favorite count: 0
has comment: http://stackoverflow.com/comment/36284223
tagged with: database-connection
tagged with: swing
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/36284884
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/36421358
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23701688
has text: Please share minimal testable code.
score: 0

http://stackoverflow.com/comment/36552980
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23769724
type: AnswerComment
has text: is it doing the sorting too? how are you getting that i get a blank screen?

http://stackoverflow.com/comment/64614465
score: 0
type: AnswerComment
type: Comment
has text: In my case I am setting tag and getting tag but still getting this crash. My list is showing well. It has header at top, when i tap on edit text it is giving me this crash.
comment on: http://stackoverflow.com/a/23711487

http://stackoverflow.com/a/23736401
has comment: http://stackoverflow.com/comment/36489339
has body: You should remove all html tags from your Html Text you get from this HTMLEditor. import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.VBox; import javafx.scene.web.HTMLEditor; import javafx.stage.Stage; public class HTMLEditorDemo extends Application { @Override public void start(Stage primaryStage) { HTMLEditor editor = new HTMLEditor(); Button b = new Button("Show Text"); b.setOnAction((ActionEvent e) -&gt; { String htmlText = editor.getHtmlText(); stripHTMLTags(htmlText); }); VBox vBox = new VBox(b, editor); Scene scene = new Scene(vBox, 800, 600); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } private void stripHTMLTags(String htmlText) { Pattern pattern = Pattern.compile("&lt;[^&gt;]*&gt;"); Matcher matcher = pattern.matcher(htmlText); final StringBuffer sb = new StringBuffer(htmlText.length()); while(matcher.find()) { matcher.appendReplacement(sb, " "); } matcher.appendTail(sb); System.out.println(sb.toString().trim()); } } Patrick
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36495150
answers question: http://stackoverflow.com/q/23735815
score: 1

http://stackoverflow.com/comment/36553421
has text: Please post the stacktrace.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23770404

http://stackoverflow.com/q/23718835
linked to: http://stackoverflow.com/q/11870416
tagged with: layout
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36456015
has title: jfreechart each plot in JSplitPane
has answer: http://stackoverflow.com/a/23728729
type: AnsweredQuestion
upvote count: 1
tagged with: swing
tagged with: jfreechart
type: Question
tagged with: jsplitpane
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23728729
has body: Has anyone implemented a CombinedXYPlot type of plot with each plot in a JSplitPane rather than all plots in one JPanel? This way one of the size dimensions of each plot could be modified without affecting the other plots (eg the CombinedXYPlotDemo4 if each plot was in a splitpane the vertical height of each plot could be manually adjusted by dragging the JSplitPane divider). Example code is below: import java.awt.Color; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Panel; import java.util.Random; import javax.swing.JFrame; import javax.swing.JSplitPane; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.NumberTickUnit; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; public class SplitPaneCharts extends JFrame { private static final int dataPoints = 100; public SplitPaneCharts() { super(); this.getContentPane().setLayout(new FlowLayout()); Panel panel1 = new Panel(); ChartPanel chartPanel1 = createDemoPanel("Chart1"); panel1.add(chartPanel1); Panel panel2 = new Panel(); ChartPanel chartPanel2 = createDemoPanel("Chart2"); panel2.add(chartPanel2); XYPlot plot1 = chartPanel1.getChart().getXYPlot(); XYPlot plot2 = chartPanel2.getChart().getXYPlot(); plot2.setDomainAxis(plot1.getDomainAxis()); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel1, panel2); this.getContentPane().add(splitPane); } private ChartPanel createDemoPanel(String title) { JFreeChart jfreechart = ChartFactory.createXYLineChart(title, "X", "Y", createSampleData(), PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYIte…

http://stackoverflow.com/comment/36261287
comment on: http://stackoverflow.com/q/23618409
score: 0
type: Comment
type: QuestionComment
has text: @aamit915 I am reading in the file using `new Scanner(new File("KLSadd.tex")).useDelimiter("\\Z").next();`

http://stackoverflow.com/comment/36290977
has text: @PaulVargas OP has 72 Accepts out of 97 questions. I think he knows how it works.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23616254
type: Comment

http://stackoverflow.com/a/23674953
has comment: http://stackoverflow.com/comment/36370754
score: 1
has body: To modify a list while iterating you can declare the arraylist as "java.util.concurrent.CopyOnWriteArrayList" public static void main(String[] args) { List&lt;String&gt; xxx = new CopyOnWriteArrayList(); xxx.add("3"); xxx.add("4"); List&lt;String&gt; xyxy = new ArrayList(); xyxy.add("1"); xyxy.add("2"); xyxy.add("3"); for (String yyy : xxx) { for (String zzz : xyxy) { if (!zzz.equals(yyy)) { xxx.add(zzz); } } } System.out.println(xxx); }
has comment: http://stackoverflow.com/comment/36371400
upvote count: 1
answers question: http://stackoverflow.com/q/23674666
has comment: http://stackoverflow.com/comment/36371346
downvote count: 0
type: Answer

http://stackoverflow.com/a/23630179
downvote count: 0
type: Answer
has body: cookie.setMaxAge( 0 ) will delete the cookie right away. cookie.setMaxAge( -1 ) will preserve the cookie for a while and delete the cookie when the browser exits. For relevant information refer the API Documentation.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23629868

http://stackoverflow.com/a/35082991
answers question: http://stackoverflow.com/q/23633801
score: 5
downvote count: 0
type: Answer
has body: I've implemented static-mustache library to provide a type-safe template engine based on mustache syntax, like the one in your question. It checks both syntax errors and type-errors (like missing property) at compile-time. It requires zero build configuration as it's a standard annotation processor. Templates remain pure mustache templates with all type-information extracted from normal Java-class used for rendering.
upvote count: 5

http://stackoverflow.com/a/23754112
answers question: http://stackoverflow.com/q/23754010
type: Answer
has comment: http://stackoverflow.com/comment/36521754
has comment: http://stackoverflow.com/comment/36522063
has comment: http://stackoverflow.com/comment/36522001
has body: I think you should write the below logic to achieve this. This is just an idea.. go ahead and implement if you get any error in any specific area. You ware welcome to get back with your questions. Read csv 1, populate an array (array 1) Read csv 2, populate another array (array 2) Loop both the array check the zip and merge in 3rd array.. something like below for(loop over array 1) // get the zip from array1 for(loop over array 2) // get the zip from array2 if(zip1 == zip2) then merge and put the data in another array(array3) and break this loop Write this array3 in a new csv file
score: 0

http://stackoverflow.com/a/23720942
type: Answer
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/36458318
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23719990
has body: You are probably looking for something like Resorvoir Sampling. Start with an initial array with first k elements, and modify it with new elements with decreasing probabilities: java like pseudo code: E[] r = new E[k]; //not really, cannot create an array of generic type, but just pseudo code int i = 0; for (E e : list) { //assign first k elements: if (i &lt; k) { r[i++] = e; continue; } //add current element with decreasing probability: j = random(i++) + 1; //a number from 1 to i inclusive if (j &lt;= k) r[j] = e; } return r; This requires a single pass on the data, with very cheap ops every iteration, and the space consumption is linear with the required output size.
has comment: http://stackoverflow.com/comment/36459682
answers question: http://stackoverflow.com/q/23719990
has comment: http://stackoverflow.com/comment/36458290
downvote count: 0

http://stackoverflow.com/comment/36440037
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23711106
type: Comment
has text: Thank you also for the information that you gave about regex as I am new in using regex.

http://stackoverflow.com/q/23616889
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/23616935
answer count: 1
downvote count: 0
favorite count: 0
has title: Is there a reason to do a cast when throwing an exception in Java?
accepted answer: http://stackoverflow.com/a/23616935
tagged with: exception
has comment: http://stackoverflow.com/comment/36258238
type: AnsweredQuestion
tagged with: java
has body: I recently came across an odd-to-me pattern in two completely independent bits of Java code: casting something that is already a Throwable to a more specific exception class when throwing. E.g., the following is from some Tomcat code: Exception exception = ex.getException(); if (exception instanceof IOException) { throw (IOException) exception; } The cast to IOException seems entirely pointless to me, but having seen similar twice in the wild, I wonder if I'm missing something?
type: Question

http://stackoverflow.com/q/23751281
favorite count: 0
has answer: http://stackoverflow.com/a/24188774
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37373192
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37284237
tagged with: java
has comment: http://stackoverflow.com/comment/37424661
has title: Dynamic URL access rights from form using Spring Security with Struts2?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37366696
upvote count: 5
linked to: http://stackoverflow.com/q/2315873
linked to: http://stackoverflow.com/q/8321696
has comment: http://stackoverflow.com/comment/37289533
score: 4
tagged with: spring-security
tagged with: struts2
has comment: http://stackoverflow.com/comment/37357738
has body: Right now I've developed a web app using java with spring framework. And I've also used spring security 3.0 for security purposes. I've used spring security for user login authentication through database, URL access and and its default session management. Now, i'm willing to apply URL rights dynamically from the form rather than defining on XML file, which i'm finding bit difficult in spring security. Struts.xml <?xml version="1.0" encoding="UTF-8"?> <constant name="struts.devMode" value="false" /> <constant name="struts.action.excludePattern" value="/j_spring_security_check" /> <constant name="struts.action.excludePattern" value="/j_spring_security_check.*,.*\\.j_spring_security_check" /> <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" /> <result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" /> <result-type name="json" class="org.apache.struts2.json.JSONResult" /> <interceptor name="json" class="org.apache.struts2.json.JSONInterceptor" /> lead_tiles /dashboard.jsp setup_lead_source getList ${action_msg} setup_lead_source setup_lead_source setup_lead_source getList ${action_msg} getList ${action_msg} getForm setup_lead_source setup_lead_source_list RETRIEVE setup_lead_source_event setup_lead_source_event STORE getList ${lead_source_e_id} getForm setup_lead_source_event getList ${lead_source_e_id} getById getList getList setup_lead_source_event RETRIEVE setup_lead_source_event setup_lead_source_event RETRIEVE list_lead_source_event list_lead_source_event spring-security.xml <?xml version="1.0" encoding="UTF-8" ?> <b:beans xmlns="http://www.springframework.org/schema/security" xmlns:b="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-s…
has comment: http://stackoverflow.com/comment/37296187
has comment: http://stackoverflow.com/comment/37284538
answer count: 1
has comment: http://stackoverflow.com/comment/37424688

http://stackoverflow.com/a/23670352
answers question: http://stackoverflow.com/q/23670328
has body: Try this : InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
score: 0
type: Answer

http://stackoverflow.com/a/24024119
has comment: http://stackoverflow.com/comment/39948880
has body: EDIT In newer Kafka Clients, implement Serializer rather than Encoder. The things required for writing a custom serializer are: Implement Encoder with an object specified for the generic Supplying a VerifiableProperties constructor is required Override toBytes(...) method making sure a byte array is returned Inject the serializer class into ProducerConfig Declaring a custom serializer for a producer As you noted in your question, Kafka supplies a means to declare a specific serializer for a producer. The serializer class is set in a ProducerConfig instance and that instance is used to construct the desired Producer class. If you follow Kafka's Producer Example you will construct ProducerConfig via a Properties object. When building your properties file be sure to include: props.put("serializer.class", "path.to.your.CustomSerializer"); With the path to the class you want Kafka to use to serialize messages before appending them to the log. Creating a custom serializer that Kafka understands Writing a custom serializer that Kafka can properly interpret requires implementing the Encoder[T] scala class that Kafka provides. Implementing traits in java is weird, but the following method worked for serializing JSON in my project: public class JsonEncoder implements Encoder<Object> { private static final Logger logger = Logger.getLogger(JsonEncoder.class); // instantiating ObjectMapper is expensive. In real life, prefer injecting the value. private static final ObjectMapper objectMapper = new ObjectMapper(); public JsonEncoder(VerifiableProperties verifiableProperties) { /* This constructor must be present for successful compile. */ } @Override public byte[] toBytes(Object object) { try { return objectMapper.writeValueAsString(object).getBytes(); } catch (JsonProcessingException e) { logger.error(String.format("Json processing failed for object: %s", object.getClass().getName()), e); } return "".getBytes(); } } Your question makes it sound like you are using one object (lets…
has comment: http://stackoverflow.com/comment/49374248
type: Answer
upvote count: 44
has comment: http://stackoverflow.com/comment/49371400
has comment: http://stackoverflow.com/comment/59494031
downvote count: 0
has comment: http://stackoverflow.com/comment/62909187
score: 44
answers question: http://stackoverflow.com/q/23755976
has comment: http://stackoverflow.com/comment/49371051

http://stackoverflow.com/q/23732068
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: android-contacts
has answer: http://stackoverflow.com/a/23747981
downvote count: 0
has title: Intent Intents.Insert.ACTION only works the first time?
accepted answer: http://stackoverflow.com/a/23747981
answer count: 2
tagged with: android
tagged with: android-notifications
score: 1
has answer: http://stackoverflow.com/a/58361386
favorite count: 0
has body: My Android service creates a notification with a custom button. The action for the custom button should open the "Create contact" system screen, with the phone number prefilled. This is the code: // create the base notification Intent notificationIntent = new Intent(context, MyService.class); PendingIntent pendingIntent = PendingIntent.getService( context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(title) .setContentText(text) .setAutoCancel(false) .setOngoing(true) .setContentIntent(pendingIntent); // add the action to save to contacts Intent saveIntent = new Intent(ContactsContract.Intents.Insert.ACTION); saveIntent.setType(ContactsContract.RawContacts.CONTENT_TYPE); saveIntent.putExtra(ContactsContract.Intents.Insert.PHONE, text); saveIntent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_WORK); PendingIntent pendingSaveIntent = PendingIntent.getActivity(context, 0, saveIntent, 0); builder.addAction(0, "Save to Contacts", pendingSaveIntent); // show the notification context.getSystemService(Context.NOTIFICATION_SERVICE).notify(0, builder.build()); The code works well the first time (let's say that I pass "01234-1234567" to it). However, subsequent calls keep showing the same dialog shown the first time, with the same value in it. So even if I call this piece code again with a different number in input (the value of "text" for the "Intents.Insert.PHONE" extra value) I'll always get "01234-1234567". I tried cancelling the Contacts screen, manually create a new contact, completely stopping the Contacts apps...no matter what, next time I tap on the notification's button I'll get the screen with the value I originally passed on the first attempt. Do you have any explanation or see anything wrong in the code?
possible better answer: http://stackoverflow.com/a/58361386
tagged with: android-intent

http://stackoverflow.com/q/23673315
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23679629
tagged with: unix
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36368435
type: Question
possible better answer: http://stackoverflow.com/a/23674145
has answer: http://stackoverflow.com/a/23674145
has answer: http://stackoverflow.com/a/23679629
score: 0
answer count: 2
has title: Running unix command through tomcat
has body: I am running a script containing the following commands #!/bin/bash ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' I have a java wrapper for executing this script using Runtime.exec(...). Running this java code works fine all the time. The problem is when using running this java method under tomcat it give me an error script.sh: line 3: ifconfig: command not found Restarting the tomcat service the script runs perfectly for some time, after which this problem is again persists. How do i solve this problem ? EDIT : Java code : String executableScript = &lt;path to script&gt;/script.sh; String line; String output; String[] command = {executableScript}; Process process = Runtime.getRuntime().exec(command); BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((line = input.readLine()) != null) { output.append(line); } process.waitFor(); input.close();

http://stackoverflow.com/comment/36442315
has text: Sorry the code had no close(), i just copy and pasted this from the internet
type: Comment
comment on: http://stackoverflow.com/a/23710368
score: 0
type: AnswerComment

http://stackoverflow.com/q/23696211
has comment: http://stackoverflow.com/comment/36412082
tagged with: pipe
tagged with: java
has comment: http://stackoverflow.com/comment/36411837
type: Question
has answer: http://stackoverflow.com/a/23697179
has comment: http://stackoverflow.com/comment/36412208
score: 0
has body: I want to launch a child proces and read its output until EOF or until an internal flag is cleared. My first attempt was to call InputStream.close() in another thread, but although it works for sockets, it doesn't work with the result of Process.getInputStream(): the main thread is still waiting in read() and the killer thread either hangs in close0() (windows) or continues with no effect (linux). Then I tried to check InputStream.available(), but it doesn't detect EOF: it returns 0. public class BbbTest extends TestCase { private Process proc; private InputStream getStream() throws IOException { //if ("".length() == 0) return new java.net.Socket("intra", 80).getInputStream(); String[] cmd; if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { cmd = new String[] { "cmd", "/c", "more &amp; more" }; } else { cmd = new String[] { "sh", "-c", "cat; cat" }; } Process proc = Runtime.getRuntime().exec(cmd); return proc.getInputStream(); } public void testB() throws Exception { final InputStream in = getStream(); final Thread readingThread = Thread.currentThread(); Thread t = new Thread("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") { @Override public void run() { try { sleep(1000); if (proc != null) proc.destroy(); // this won't help readingThread.interrupt(); // this won't help either in.close(); // this will do nothing and may even hang } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException ( ); } } }; t.setDaemon(true); t.start(); try { in.read(); assertTrue(false); } catch (IOException e) { // nothing } } } My last hope is to steal the channel from the returned stream and use nio
answer count: 1
has title: reading output of a child process Interruptibly
type: UnansweredQuestion
tagged with: process
has comment: http://stackoverflow.com/comment/36411762
has comment: http://stackoverflow.com/comment/36412437

http://stackoverflow.com/q/23654502
has body: I asked a question about cloning in java and got answers saying deep copy creates a new instance of the object carrying the same state and data in the member variables. I was told shallow copying is just assigning an object reference to another reference variable. But that's NOT copying that's assignment (making a new pointer for the object location). What is deep copying of objects then really if there are reference variables contained within the object you are trying to clone? Would using myObj2 = myObj.clone() clone all components within the object? Lets say if myObj contained other reference variables pointing to other object locations, would those reference variables also be cloned? So myObj2's internal reference variables would not be pointing to the same old object locations that pointers in myObj where pointing to.. I need clarity here to fully understand what cloning is all about. Thank you in advance.
type: AnsweredQuestion
tagged with: clone
has title: Clarity needed on cloning: Shallow copying of objects is NOT just assigning object reference variable to another variable or is it?
tagged with: java
duplicate of: http://stackoverflow.com/q/6182565
type: Question
tagged with: cloneable
accepted answer: http://stackoverflow.com/a/23656092
duplicate of: http://stackoverflow.com/q/869033
score: 0
linked to: http://stackoverflow.com/q/6182565
answer count: 1
has answer: http://stackoverflow.com/a/23656092
linked to: http://stackoverflow.com/q/869033

http://stackoverflow.com/comment/36536385
has text: Would you please put here some code and specify your question in more detail?
comment on: http://stackoverflow.com/q/23761956
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23743267
has title: Java Constructors in a Ruby Script
favorite count: 0
has body: I'm trying to figure out how to add constructor parameters to my JRuby Script. I have had it working before with the following code. class Man &lt; NpcCombat def attackScripts attacker, victim return [BasicAttack.meleeAttack(attacker, victim,AttackStyle::Mode::MELEE_ACCURATE, 2, Weapon::FISTS)] end end However the Java Class "NpcCombat" now has a integer parameter, such as NpcCombat(int). I'm trying to figure out how to change this in my ruby script, but it's not working.
tagged with: ruby
has answer: http://stackoverflow.com/a/23743486
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 1
tagged with: jruby
answer count: 1

http://stackoverflow.com/q/23757183
has comment: http://stackoverflow.com/comment/36527711
has body: I am trying to implement a view only HTML pane for some specific project. I am using JTextPane to render HTML using content type as "text/html". I was having tables in my input HTML so in order to give these tables border, i thought of using css styling, but unfortunately it did not work out. If I put border property as part of table itself then it works but not with css styling. Here is the sample code i created to recreate issue. content1 does not creates border for my table but content2 creates it. I want to use content1 approach as i have plenty of html files with tables. Thanks for your time, any help will be much appreciated. import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; public class TestTextPane { private static int X = 200; private static int Y = 200; private static int W = 600; private static int H = 400; public static final String content1 = " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " Q: What is the difference between GET and POST method? \r\n" + " \r\n" + " \r\n" + " A:\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " GET\r\n" + " \r\n" + " \r\n" + " POST\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " GET is a safe method (idempotent)\r\n" + " \r\n" + " \r\n" + " POST is non-idempotent method\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " We can send limited data with GET method and it’s sent in the header \r\n" + " request URL\r\n" + " \r\n" + " \r\n" + " we can send large amount of data with POST because it’s part of the \r\n" + " body.\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " "; public static final String content2 = " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " Q: What is the difference between GET and POST method? \r\n" + " \r\n" + " \r\n" + " A:\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " GET\r\n" + " \r\n" + " \r\n" + " POST\r\n" + " \r\n" + " \r\n" + " \r\n" + " \r\n" + " GET is a safe method (idempotent)\r…
tagged with: java
possible better answer: http://stackoverflow.com/a/23757432
score: 0
accepted answer: http://stackoverflow.com/a/23758141
has answer: http://stackoverflow.com/a/23757679
answer count: 3
tagged with: http://stackoverflow.com/tag/html
tagged with: css
has title: HTML Table formatting using css not working in JTextPane
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23758141
tagged with: jtextpane
linked to: http://stackoverflow.com/q/18701792
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23757432

http://stackoverflow.com/q/23725944
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/28728530
has comment: http://stackoverflow.com/comment/36468402
type: UnansweredQuestion
tagged with: uninstallation
tagged with: android
has title: Android app uninstallation event for analytics
has comment: http://stackoverflow.com/comment/36468278
downvote count: 0
score: 7
tagged with: java
type: Question
has body: I wonder what are the ways/patterns to detect app uninstallation for any kind of analytics on android? I know the limitations of ACTION_PACKAGE_REMOVED intent - not received by application being removed. I am using flurry at the moment and have also discovered that they do not provide any kind of support for deinstallation events. This type of event is definitely something you want in your analytics but so far have not found any clear solution. Any ideas?
has comment: http://stackoverflow.com/comment/36468356
tagged with: flurry
has comment: http://stackoverflow.com/comment/36468181
tagged with: analytics
upvote count: 7

http://stackoverflow.com/q/23621848
has title: So, how exactly does the Java main method work?
has body: public static void main(String [] args) This thing has been quite the enigma ever since I started programming. I understand it passes an array of Strings to the command line, but where exactly does it do that and how does it interpret it? I'm pretty sure I'm wrong here, but my current understanding is that whatever you write in the main method is then translated into machine and passed into the computer as a string. Well, that's all fine and dandy, but then how does it understand numeric values if everything is a String? Also, it's a bit weird when it comes to methods. Usually, when designing a method, you would write the formal parameters that you'd pass to it, and what you want to do with those parameters. But with the main method, you are defining the parameters while you're writing the code inside the main method! how does that even work?
tagged with: command-line-arguments
has answer: http://stackoverflow.com/a/23622022
downvote count: 5
answer count: 3
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: command-line
has comment: http://stackoverflow.com/comment/36267840
score: -5
has answer: http://stackoverflow.com/a/23621910
tagged with: java
has comment: http://stackoverflow.com/comment/36267853
has answer: http://stackoverflow.com/a/23621876
type: Question

http://stackoverflow.com/q/23730695
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/36480324
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23742479
has comment: http://stackoverflow.com/comment/36480606
favorite count: 0
has comment: http://stackoverflow.com/comment/36479479
type: AnsweredQuestion
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/36480140
has body: I'm trying to set a simple cookie with a domain but it seems that it doesn't get added to the browser's cookie store. Here's how I added the cookie response().setCookie("clientauthtoken", "asdasd", 5000, "/test", "test.com", false, false); And if I check in the cookie manager (a plugin for Firefox to manage cookies) it doesn't show the cookie I added. If I check in the session, yes it's there for (play.mvc.Http.Cookie cockie: response().cookies()) { Logger.info(" name " + cockie.name()); Logger.info(" value " + cockie.value()); Logger.info(" domain " + cockie.domain()); } This happens only if I added the domain (test.com). If I set the domain null or an empty string and try to add the cookie again, then it is showing both the browser's cookie store and in the session. So what I'm missing here? Or is it not possible to add a cookie with a domain. Thanks.
tagged with: setcookie
accepted answer: http://stackoverflow.com/a/23742479
has title: Play framework: Why the cookie isn't showing
tagged with: java
tagged with: session-cookies
type: Question

http://stackoverflow.com/q/23620313
upvote count: 0
has comment: http://stackoverflow.com/comment/36264926
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36264878
has comment: http://stackoverflow.com/comment/36265117
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/36265868
tagged with: integral
has comment: http://stackoverflow.com/comment/36265076
has body: I have to implement a numerical computation of double integrals in Java. Concentrating on the integrate() function, here's what I have to far: public static double Integrate(Integravel integrando, boolean pontoMedio) { double sum = 0.0; double f2; double deltaX = (integrando.getb() - integrando.geta()) / (double) integrando.getN(); double deltaY = (integrando.getd() - integrando.getc()) / (double) integrando.getN(); double deltaArea = deltaX * deltaY; double x, xi, y, yi; if (pontoMedio) { xi = integrando.geta() + deltaX/2; yi = integrando.getc() + deltaY/2; } else { xi = integrando.geta() + deltaX; yi = integrando.getc() + deltaY; } for (int j=0; j&lt;integrando.getN(); j++) { for (int i = 0; i &lt; integrando.getN(); i++) { if (j==0) { x = xi; } else { x = xi + deltaX; } if (i==0) { y = yi; } else { y = yi + deltaY; } f2 = integrando.funcao(x, y); sum += f2*deltaArea; } } return sum; } It does work on certain cases, but whenever I make N too big (which should make the integral computation more precise, since it is supposed to go to infinite), it returns a wrong value for the integral estimation. Am I doing something wrong here? If more code from the project is needed, let me know. Any help would be incredibly appreciated. Thanks!
downvote count: 2
has title: Numerical Double Integration in Java
has comment: http://stackoverflow.com/comment/36265029
type: Question
has comment: http://stackoverflow.com/comment/36265024
score: -2
has answer: http://stackoverflow.com/a/23622028
has comment: http://stackoverflow.com/comment/36264945
tagged with: java
has comment: http://stackoverflow.com/comment/36265161
tagged with: numerical
has comment: http://stackoverflow.com/comment/36265063
has comment: http://stackoverflow.com/comment/36265174
has comment: http://stackoverflow.com/comment/36264904

http://stackoverflow.com/comment/36486832
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23735734
type: QuestionComment
has text: -1 because the question does not show any research effort

http://stackoverflow.com/q/23674458
tagged with: modality
favorite count: 0
tagged with: jdialog
has comment: http://stackoverflow.com/comment/36369933
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23676362
tagged with: java
has title: not to return to Dialog when another Dialog is open
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36375416
downvote count: 1
has comment: http://stackoverflow.com/comment/36373299
possible better answer: http://stackoverflow.com/a/23674715
type: Question
has answer: http://stackoverflow.com/a/23674715
has body: I'm showing up a Dialog from a JFrame, but when I click outside the dialog, the dialog gets hidden. It's supposed to the dialog won't let you do nothing unless you close it right? This is my code: The Dialog calling from First Dialog: JProductStocking jps = JProductStocking.getProductStoking(JPanelTicket.this, oApp); jps.setVisible(true); And this is the JDIalog called: public class JProductStocking extends javax.swing.JDialog implements BeanFactoryApp{ public JProductStocking(Component parent, boolean modal) { //super(parent, modal); initComponents(); } public static JProductStocking getProductStoking(Component parent, AppView app) { Window window = getWindow(parent); JProductStocking myMsg; if (window instanceof JFrame) { myMsg = new JProductStocking((Frame) window, true); } else { myMsg = new JProductStocking((Dialog) window, true); } myMsg.init(app, parent); myMsg.applyComponentOrientation(parent.getComponentOrientation()); return myMsg; } private static Window getWindow(Component parent) { if (parent == null) { return new JFrame(); } else if (parent instanceof JFrame || parent instanceof Dialog) { return (Window) parent; } else { return getWindow(parent.getParent()); } } public void init(AppView app, Component parent) { oApp = app; // m_dlSales = (DataLogicSales) app.getBean("com.openbravo.pos.forms.DataLogicSales"); initComponents(); ProductList = new ArrayList(); this.setResizable(false); setLocationRelativeTo(parent); } } Im not calling the jDialog well? or what im doing wrong?
score: 0
has comment: http://stackoverflow.com/comment/36370158
answer count: 2
has comment: http://stackoverflow.com/comment/36370289
tagged with: parent
has answer: http://stackoverflow.com/a/23676362

http://stackoverflow.com/comment/36583095
type: Comment
has text: @yayu have you tried deleting the `.class` file, recompiling, and then running again? My knowledge of Java is somewhat limited, so I'm not quite sure what else to suggest. You might also want to try adding the `.exe` back on to the `javac` and `java` commands, just to see if that's the issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/23773113
score: 0

http://stackoverflow.com/a/26407478
answers question: http://stackoverflow.com/q/23623098
has body: If you want a random number which can start with zeros, consider this: import scala.util.Random val r = new Random() (1 to 6).map { _ =&gt; r.nextInt(10).toString }.mkString
upvote count: 1
score: 0
downvote count: 1
type: Answer

http://stackoverflow.com/comment/36316908
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23632421
has text: That's very useful. But what about second or third values (17.8,15.6,11.3,11.8). How can i set them into a same color?
type: AnswerComment

http://stackoverflow.com/a/23945782
type: Answer
answers question: http://stackoverflow.com/q/23707847
has body: Fixed it disabling JTA in Wildfly Datasource and using RESOURCE-LOCAL transaction in persistence.xml.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23707847

http://stackoverflow.com/q/23700112
score: 30
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23700354
type: Question
has comment: http://stackoverflow.com/comment/36420186
has answer: http://stackoverflow.com/a/43356819
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/36419828
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/23700237
tagged with: jvm
has answer: http://stackoverflow.com/a/23700237
has answer: http://stackoverflow.com/a/23700354
favorite count: 0
has title: Java Memory Limit -Xmx suffix: upper vs lower case m/M and g/G
upvote count: 30
tagged with: heap-memory
linked to: http://stackoverflow.com/q/32855984
has body: It is commonly known that it is possible to limit the Java heap size with -Xmx&lt;amount&gt;&lt;unit&gt;, where unit is the data amount unit like Gigabyte, Megabyte, etc. I know that -Xmx128M means 128 Mebibytes (= 128 * 1024 * 1024 bytes). But is it true, that it is also possible to use decimal units like megabytes using -Xmx100m (which would be 100 * 1000 * 1000 bytes)? So is it possible to use this decimal units by using lower-case unit suffixes like k, m, g instead of K, M, G?
tagged with: jvm-arguments
duplicate of: http://stackoverflow.com/q/32855984

http://stackoverflow.com/comment/36353605
has text: In the first case, you wait until the second loop iteration to remove the SECOND element
comment on: http://stackoverflow.com/a/23665546
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23621155
tagged with: return
has comment: http://stackoverflow.com/comment/36266782
has comment: http://stackoverflow.com/comment/36266867
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36266874
has comment: http://stackoverflow.com/comment/36267102
has comment: http://stackoverflow.com/comment/36270337
has comment: http://stackoverflow.com/comment/36266943
has answer: http://stackoverflow.com/a/24174366
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/36266767
has title: Return statement within an if statement and printing it out to a file
has comment: http://stackoverflow.com/comment/36266796
has comment: http://stackoverflow.com/comment/36267321
type: Question
has comment: http://stackoverflow.com/comment/36266750
has comment: http://stackoverflow.com/comment/36266786
answer count: 1
has comment: http://stackoverflow.com/comment/36294371
score: 0
has comment: http://stackoverflow.com/comment/36297383
has comment: http://stackoverflow.com/comment/36266810
has comment: http://stackoverflow.com/comment/36266698
has comment: http://stackoverflow.com/comment/36267010
has body: I'm working on a punch in/punch out type program. I am doing it out of fun to practice my coding. I just finished my Java 1 class so I know very little about the vastness of Java. Because of this my code is going to be using a lot of techniques and methods that can be replaced and done more efficiently by more advanced techniques but right now that isn't what I want. I have a class where I have my most messy methods. In this class I create employees, I allow them to check-in, and I allow them to check-out. Each check-in and check-out is printed out to a file. As part of my program I have a method to find the difference between the time in and time out and give the elapsed time as well as print it to the file. The program displays the time elapsed in the console perfectly, but when it writes to the file it prints null. In my method to calculate the elapsed time, I don't understand why my return statements within the if statements are being ignored and it is going straight to null instead of returning the proper elapsed time. The reason I have null is because my compiler told me to add it because it was missing the return statement. public static String timeOut() { Date startDate; Date endDate; for (int i = 0; i &lt; date.size(); i = i + 1) { for (int j = 0; j &lt; date2.size(); j = j + 1) { if (date.get(i).getAcctNumber().equals(date2.get(j).getAcctNumber())) { startDate = date.get(i).getDate(); endDate = date2.get(j).getDate(); long duration = endDate.getTime() - startDate.getTime(); // This is a continues program that doesn't close, so i remove the // values from array after i use them to avoid confusion when finding // the time elapsed. Otherwise the array will be to big and have // duplicates date.remove(i); date2.remove(j); long diffSeconds = TimeUnit.MILLISECONDS.toSeconds(duration); if (diffSeconds &lt; 60) { return "You have been out for " + diffSeconds + " Seconds "; } if (diffSeconds &gt; 60 &amp;&amp; diffSeconds &lt; 3600) { long diffMinutes = (diffSecond…

http://stackoverflow.com/comment/36727766
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23646193
has text: what's your idea about Alexandre Santos's answer?

http://stackoverflow.com/comment/36406849
has text: Post the `Role` class.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23693219

http://stackoverflow.com/q/23754634
tagged with: apache-camel
upvote count: 1
has answer: http://stackoverflow.com/a/23801852
answer count: 1
downvote count: 0
favorite count: 0
has title: Spring xslt processing works on a string but not a dom
tagged with: http://stackoverflow.com/tag/xml
has body: I'm using Apache Camel 2.10.4 to create xml documents. I want to view the xml as html in one use case so my Camel route (defined in Spring DSL) uses an xslt to transform the xml document to html. The xml is generated in a Java bean and output as a DOM Document. If I use convertBodyTo to convert the Document to a String before handing it to the xslt all is well. If I leave this out, the xslt processor doesn't find the elements in my document. This returns an html string with a table containing a row for each schedule item in my TVAnytime xml document: <from uri="direct:show_bn"/> <to uri="bean:gen"/> <convertBodyTo type="java.lang.String"/> <to uri="xslt:tva2html.xslt"/> text/html; This returns the html with no rows in the table: <from uri="direct:show_bn"/> <to uri="bean:gen"/> <to uri="xslt:tva2html.xslt"/> text/html; The method executed in the bean has this signature: public org.w3c.dom.Document process(); Any idea why this is happening? I suspect something wrong with namespace aware processing when the xslt processing gets a DOM.
type: UnansweredQuestion
score: 1
tagged with: spring
tagged with: xslt
type: Question
tagged with: java

http://stackoverflow.com/q/23650317
upvote count: 0
has comment: http://stackoverflow.com/comment/36323667
tagged with: arrays
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/23650501
tagged with: nullpointerexception
favorite count: 0
has comment: http://stackoverflow.com/comment/36322981
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/36323526
tagged with: android-intent
answer count: 1
has comment: http://stackoverflow.com/comment/36323015
has comment: http://stackoverflow.com/comment/36323262
tagged with: java
has body: So in my android app a user signs in on main activity, then they go on to home activity and carry out the apps main function. This activity creates a list of strings that is sent through an intent when the user clicks the logout button. I convert the list to an array, before I send it through the intent. Then on my main activity there is another button "Retrieve Data" which launches another actvity, it's just a ListView though. So I want to feed the string array on again to retrieve data so the user can click on the butoon and see the list data. Here's where I'm sending the string array from first: btnLogout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String[] resultsArray = new String[userResults.size()]; Intent intentLogout=new Intent(getApplicationContext(),MainActivity.class); intentLogout.putExtra("Results", resultsArray); startActivity(intentLogout); } }); Here's how I receive that and send it on again in my main Activity: Bundle extras = getIntent().getExtras(); if(extras!=null) { results = extras.getStringArray("Results"); } else { Toast.makeText(getApplicationContext(), "No data to retrieve yet", Toast.LENGTH_LONG).show(); } btnRetrieveData.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intentRD=new Intent(getApplicationContext(),RetrieveDataActivity.class); intentRD.putExtra("UserResults", results); startActivity(intentRD); } }); And here's my retrieveDataActivity, I haven't used Listviews much before so I'm not sure if I'm making any obvious/silly mistakes: public class RetrieveDataActivity extends Activity { String [] values; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_listviewexampleactivity); // Get ListView object listView = (ListView) findViewById(R.id.list); // Defined Array values to show in ListView Bundle extras = getIntent().getExtras(); if(extras!=null) { values = extr…
downvote count: 3
has comment: http://stackoverflow.com/comment/36323019
has title: Nullpointer Exception when sending string arrays through intent

http://stackoverflow.com/a/23678960
upvote count: 1
has body: If the code behind captureLastActiveTimeForCurrentFile does not explicitly access the user's HTTP Session (i.e. by calling request.getSession()) then you can ignore the request to this path by setting some properties in Tomcat. Note that setting these however will introduce similar behavior for any other mappings not explicitly accessing the user's session. The relevant properties are: org.apache.catalina.core. StandardHostValve.ACCESS_SESSION org.apache.catalina.STRICT_SERVLET_COMPLIANCE See further discussion here, especially the last post: http://tomcat.10.x6.nabble.com/Session-timeouts-ignore-quot-periodic-polling-quot-URL-td2159572.html
downvote count: 0
answers question: http://stackoverflow.com/q/23649578
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36744719
has comment: http://stackoverflow.com/comment/36805764

http://stackoverflow.com/comment/36469639
type: AnswerComment
type: Comment
has text: at least, can you explain your answer in better way?
comment on: http://stackoverflow.com/a/23726610
score: 0

http://stackoverflow.com/a/23697231
score: 0
type: Answer
has body: To check the annotations you need to use reflection. Roles r = AnnotationExample.class.getMethod("createAction").getAnnotation(Roles.class); if ("admin".equals(r.roles())) //has admin roles It is possible to declare annotation value as object value. like @Roles(Role.AADMIN) I think what you want is a Enum. @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Roles { public Role roles(); } enum Role { ADMIN, USER }; public class AnnotationExample { @Roles(roles=Role.ADMIN) public void createAction(){ Role userrole = Role.ADMIN; } }
answers question: http://stackoverflow.com/q/23695844

http://stackoverflow.com/comment/59062389
type: AnswerComment
type: Comment
has text: I tried to do this with `${it.fullURL}` in `method` attribute of `<f:validateButton>` but it didn't work - button was sending request to the wrong URL: `/descriptorByName/jenkins.model.GlobalPluginConfiguration/<here is what I return from getFullUrl()>`. Could you please provide some code with `<f:form>`?
comment on: http://stackoverflow.com/a/35628033
score: 0

http://stackoverflow.com/comment/109390803
score: 9
type: AnswerComment
type: Comment
has text: If you want a boolean return value you should use anyMatch
comment on: http://stackoverflow.com/a/55492166

http://stackoverflow.com/a/23747139
downvote count: 0
score: 1
has body: Lock vs synchronized 1. Lock provides more visibility and options for locking, unlike synchronized where a thread might end up waiting indefinitely for the lock, we can use tryLock() to make sure thread waits for specific time only. 2. Synchronization code is much cleaner and easy to maintain whereas with Lock we are forced to have try-finally block to make sure Lock is released even if some exception is thrown between lock() and unlock() method calls. 3. synchronization blocks or methods can cover only one method whereas we can acquire the lock in one method and release it in another method with Lock API. 4. synchronized keyword doesn’t provide fairness whereas we can set fairness to true while creating ReentrantLock object so that longest waiting thread gets the lock first. 5. We can create different conditions for Lock and different thread can await() for different conditions. From here. For me, the most important reasons to use Lock are 3 and 4.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23746851
answers question: http://stackoverflow.com/q/23746851
type: Answer

http://stackoverflow.com/comment/63658194
comment on: http://stackoverflow.com/a/23713447
type: Comment
score: 0
has text: would be good if you could add the java code for creating the XContentBuilder object creation, esp. the analyser portion
type: AnswerComment

http://stackoverflow.com/comment/36445119
score: 1
has text: @HotLicks: So that the whole process can't read from `/dev/urandom` anymore, even if it wants?
comment on: http://stackoverflow.com/q/23713640
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23730447
tagged with: grizzly
tagged with: java
has body: After some time Glassfish 3.1.2 start Processor Task Exception and it stopped working. Following is the stacktrace: SEVERE|glassfish3.1.2|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=24;_ThreadName=Thread-2;|GRIZZLY0051: ProcessorTask exception. java.lang.IndexOutOfBoundsException at java.nio.Buffer.checkBounds(Unknown Source) at java.nio.HeapByteBuffer.get(Unknown Source) at com.sun.grizzly.util.InputReader.read(InputReader.java:216) at com.sun.grizzly.http.ajp.AjpInputBuffer.ensureAvailable(AjpInputBuffer.java:210) at com.sun.grizzly.http.ajp.AjpInputBuffer.readAjpMessageHeader(AjpInputBuffer.java:79) at com.sun.grizzly.http.ajp.AjpProcessorTask.parseRequest(AjpProcessorTask.java:97) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:706) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Unknown Source)
has title: Glassfish generates ProcessorTask exception and hangs
type: Question
tagged with: glassfish
has answer: http://stackoverflow.com/a/23745920
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/23674790
downvote count: 0
score: 1
has body: Thanks a lot for your answers ! I combined your advises and it worked. Here is code : public static void runCmd(){ File f = new File("C:\\Users\\pawisoon\\bfgminer-3.10.0-win64"); try{ ProcessBuilder builder = new ProcessBuilder("cmd.exe","/c","start","bfgminer.exe", "-o", "bla.bala.com", "-u", "user", "-p", "lelelel", "-S", "auto", "-d", "all"); builder.directory(f); builder.redirectErrorStream(true); Process pd = builder.start(); BufferedReader r = new BufferedReader(new InputStreamReader(pd.getInputStream())); String line; while (true) { line = r.readLine(); if (line == null) { break; } System.out.println(line); } } catch(IOException e){ } }
answers question: http://stackoverflow.com/q/23665121
type: Answer
upvote count: 1

http://stackoverflow.com/a/23717708
answers question: http://stackoverflow.com/q/23717653
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23717653
has body: Your first mistake is the selection of the type for the result: this type ArrayList&lt;String[][]&gt; represents a three-dimensional structure - a list of 2D arrays. What you need is a two-dimensional structure, e.g. ArrayList&lt;String[]&gt; So the first fix is this: List&lt;String[]&gt; subjectsArray = new ArrayList&lt;String[]&gt;(); // Note the type on the left: it's an interface Once this is done, the rest of the code flows by itself: you do not need the inner for loop, it gets replaced by a single line: subjectsArray.add(lineSplit); The final fix is the return line: you need to convert the List&lt;String[]&gt; to String[][], which can be done by calling toArray(), like this: return subjectsArray.toArray(new String[subjectsArray.size()][]);
type: Answer
has comment: http://stackoverflow.com/comment/36452306
has comment: http://stackoverflow.com/comment/36452100
has comment: http://stackoverflow.com/comment/36452596
upvote count: 2
has comment: http://stackoverflow.com/comment/36452062
has comment: http://stackoverflow.com/comment/36452388
score: 2

http://stackoverflow.com/comment/36561980
type: Comment
comment on: http://stackoverflow.com/q/23774811
score: 0
has text: is /usr/local/java/jdk1.8.O directory exist ..??
type: QuestionComment

http://stackoverflow.com/a/23725133
answers question: http://stackoverflow.com/q/23723763
type: Answer
upvote count: 10
score: 10
has body: It's almost certainly not in the spec. The corresponding section about Floating-Point Literals in the JLS only specifies the values of the floating point literals. But it does not speak about valid representations of them. Of course, there have to be limits. No one would expect that a string like String s = "0.00... (3 billion zeros) ...001e3000000000"; to be parsed to 1.0. But obviously, the limits are much lower here. This example shows the limit: public class DoubleTest { public static void main(String[] args) { runTest(300, 324); runTest(300, 325); runTest(300, 326); } private static void runTest(int negativeExponent, int exponent) { String s = prefix(negativeExponent)+"1e"+exponent+"D"; double d = Double.parseDouble(s); System.out.println( "For 1e-"+negativeExponent+" * 1e"+exponent+" result is "+d); } private static String prefix(int negativeExponent) { StringBuilder sb = new StringBuilder("0."); for (int i=0; i<negativeExponent; i++) { sb.append("0"); } return sb.toString(); } } It prints For 1e-300 * 1e324 result is 9.999999999999999E22 For 1e-300 * 1e325 result is 1.0E24 For 1e-300 * 1e326 result is Infinity In fact, it is primarily related to the exponent being used. The relevant part that causes this bailout is in FloatingDecimal.java, line 1996.
accepted answer of: http://stackoverflow.com/q/23723763
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36426661
score: 0
has text: How odd. I didn't notice anything contentious.
type: Comment
comment on: http://stackoverflow.com/a/23699207
type: AnswerComment

http://stackoverflow.com/comment/36364204
type: QuestionComment
comment on: http://stackoverflow.com/q/23670749
has text: You gotta use any programming or even a bash script to do those... Can you use java program???
score: 0
type: Comment

http://stackoverflow.com/comment/101458603
comment on: http://stackoverflow.com/q/23707955
score: 0
type: QuestionComment
type: Comment
has text: @Vaishali I have same problem, Did you found any solution?

http://stackoverflow.com/q/23746189
has answer: http://stackoverflow.com/a/23761385
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36513180
has comment: http://stackoverflow.com/comment/36508189
has title: JSoup - Java OutOfMemoryError - using jsoup parser across huge files
upvote count: 3
score: 1
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/36509144
tagged with: jsoup
has comment: http://stackoverflow.com/comment/36509385
has comment: http://stackoverflow.com/comment/36509257
has comment: http://stackoverflow.com/comment/36508533
has body: I am using jsoup parser to read HTML files and creating XML file with data extracted. I will be running this code/script across a directory which has several html files (~250k - 300k files) and some of the files are large. I run into a java.lang.OutOfMemoryError: Requested array size exceeds VM limit" or Java heap space error. I have tried running the VM with different -Xmx and -Xms values, but I keep hitting the same error. I have attached my code snippet. I am assuming the error occurs when reading a large file. Any thoughts on how to resolve this? String target_dir_output = "/test/"; File dir = new File(target_dir); File[] files = dir.listFiles(); for (File f : files) { if(f.isFile()) { String fileName = f.getName(); String testValue = null; try { Document doc = Jsoup.parse(f, "UTF-8", ""); Elements metalinks = doc.select("meta[name=testValue]"); testValue = metalinks.first().attr("content"); String output = "&lt;data&gt;" + "\n"; output += "&lt;testValue&gt;" + testValue + "&lt;/testValue&gt;" ; output += "&lt;/data&gt;"; FileOutputStream out = new FileOutputStream(fileName + ".xml"); out.write(output.getBytes()); out.close(); } catch (IOException e) { e.printStackTrace(); }
answer count: 1

http://stackoverflow.com/a/23662080
upvote count: 2
answers question: http://stackoverflow.com/q/23661758
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23661758
has body: The value in your mainMap is a reference to a HashMap object. Any reference to that object (e.g. subMap) can change it.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23782065
type: Answer
accepted answer of: http://stackoverflow.com/q/23778094
answers question: http://stackoverflow.com/q/23778094
has body: I used different method using Jsoup to parse the html file and downloading import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author nudanesh */ public class URLDownload { private Document doc; String url = "", folder, file; private final File sourceFile; int i = 1; int r = 1, c = 1; int anchorCol = 3; Library lib; URLDownload() { lib = new Library(); sourceFile = new File("Download.html"); try { doc = Jsoup.parse(sourceFile, "UTF-8"); } catch (IOException ex) { Logger.getLogger(URLDownload.class.getName()).log(Level.SEVERE, null, ex); } //Elements links = doc.select("a[href]"); Elements rows = doc.select("tr"); System.out.println("Size=" + rows.size()); for (Element row : rows) { Elements cols = row.getElementsByTag("td"); c = 1; for (Element col : cols) { System.out.println("Row"+r); if (c == 1) { file = col.text();//System.out.println("File in main"+file); } else if (c == 2) { folder = col.text();//System.out.println("Folder in main"+folder); } else { try { url = col.getElementsByTag("a").attr("href"); } catch (Exception e) { System.out.print("-"); } } c++; } if (!url.equals("")) { lib.setLocation(file,folder); lib.downloadFile(url); } url = ""; i++; r++; } } public static void main(String arg[]) { new URLDownload(); } } and following is the Library class file import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLCo…
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/23772681
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23792572
has title: Can't load IA 32-bit .dll on a AMD 64-bit platform with 32 bit JVM
type: Question
answer count: 1
downvote count: 0
tagged with: glassfish
favorite count: 0
has body: I'm running Glassfish 4.0 on a 64bit Windows 8 platform. I have both 32bit and 64bit JDK installed on system. My asenv.conf file points to the 32 bit JDK version but I'm still getting the above error regarding attempting to load a 32 bit dll in a 64 bit environment. I think that I've validated that I'm truly loading the 32bit version in the server log (see below). VM invocation command line: C:\Program Files (x86)\Java\JRE_32bit\bin\java.exe -cp E:/glassfish4/glassfish/modules/glassfish.jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9009 -XX:+UnlockDiagnosticVMOptions - XX:MaxPermSize=192m -XX:NewRatio=2 -Xmx512m -javaagent:E:/glassfish4/glassfish/lib/monitor/flashlight-agent.jar -client -Dosgi.shell.telnet.maxconn=1 -Dfelix.fileinstall.disableConfigSave=false -Djdbc.drivers=org.apache.derby.jdbc.ClientDriver -Dfelix.fileinstall.dir=E:\glassfish4\glassfish/modules/autostart/ -Djavax.net.ssl.keyStore=E:\glassfish4\glassfish\domains\domain1/config/keystore.jks -Dosgi.shell.telnet.port=6666 -Djava.security.policy=E:\glassfish4\glassfish\domains\domain1/config/server.policy -Djava.awt.headless=true -Dfelix.fileinstall.log.level=2 -Dfelix.fileinstall.poll=5000 -Dcom.sun.aas.instanceRoot=E:\glassfish4\glassfish\domains\domain1 -Dosgi.shell.telnet.ip=127.0.0.1 -Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory -Djava.endorsed.dirs=E:\glassfish4\glassfish/modules/endorsed;E:\glassfish4\glassfish/lib/endorsed -Dcom.sun.aas.installRoot=E:\glassfish4\glassfish -Dfelix.fileinstall.bundles.startTransient=true -Djava.ext.dirs=C:\Program Files (x86)\Java\JRE_32bit/lib/ext;C:\Program Files (x86)\Java\JRE_32bit/jre/lib/ext;E:\glassfish4\glassfish\domains\domain1/lib/ext -Dfelix.fileinstall.bundles.new.start=true -Djavax.net.ssl.trustStore=E:\glassfish4\glassfish\domains\domain1/config/cacerts.jks -Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gog…

http://stackoverflow.com/q/23754456
has comment: http://stackoverflow.com/comment/36522312
score: -3
accepted answer: http://stackoverflow.com/a/23755446
tagged with: jdbc
upvote count: 0
has comment: http://stackoverflow.com/comment/36522669
has comment: http://stackoverflow.com/comment/36522426
has answer: http://stackoverflow.com/a/23754628
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23755446
tagged with: mysql
linked to: http://stackoverflow.com/q/2839321
type: Question
has answer: http://stackoverflow.com/a/23754709
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36522313
has title: issues with mysql connection in java: No suitable Driver
answer count: 6
has body: I'm making a small program in Java that uses a Mysql connection but im getting some problems with the jdbc drivers. I installed Java EE and Java SE but i still get the message that there are no suitable driver for jdbc:mysql://localhost:3307/test. Can someone explain to me what i am doing wrong. Code: public class Mysql_Connection_2 { /** * @param args the command line arguments */ static String query = "select count(*) from stock"; public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { Logger.getLogger(MysqlConnection.class.getName()).log(Level.SEVERE, null, ex); } MysqlConnection.dbConnection(query); } } Extern Connection class: public class MysqlConnection { private static final String dbURL = "jdbc:mysql://localhost:3307/test"; private static final String dbuname = "root"; private static final String dbpass = "usbw"; static Connection dbcon = null; static Statement stmt = null; static ResultSet rs = null; public static void dbConnection (String query){ try{ //getting database connection to MySQL server dbcon = DriverManager.getConnection(dbURL, dbuname, dbpass); //getting PreparedStatment to execute query stmt = dbcon.prepareStatement(query); //Resultset returned by query rs = stmt.executeQuery(query); while(rs.next()) { int count = rs.getInt(1); System.out.println("count of stock : " + count); } } catch(SQLException ex){ System.out.println(ex.getMessage()); } } }
possible better answer: http://stackoverflow.com/a/23754741
has comment: http://stackoverflow.com/comment/36542189
has comment: http://stackoverflow.com/comment/36522315
has answer: http://stackoverflow.com/a/23754599
has comment: http://stackoverflow.com/comment/36522367
favorite count: 0
duplicate of: http://stackoverflow.com/q/2839321
has answer: http://stackoverflow.com/a/23754559
has answer: http://stackoverflow.com/a/23754741

http://stackoverflow.com/a/23666835
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23665959
type: Answer
has body: The way it looks to me, you have two class hierarchies that are isomorphic (if I'm using the right term) and there is a relationship between the corresponding classes: PStore PWork / \ / \ / \ / \ CStore1 CStore2 CWork1 CWork2 ^ ^ ^ ^ | | | | |---------+--------------| | | | |---------------------| But I don't think there's a built-in way to express this kind of relationship in Java. Somehow, you're going to have to do something that makes those relationships explicit. I.e. there will need to be something in CWork1 that refers to CStore1, and something in CWork2 that refers to CStore2, or else some kind of list or map that associates them. There's probably a design pattern that addresses this structure, but I can't think of it right now. So off the top of my head, here are a couple possible solutions (neither of which uses reflection): Put the abstract getStoreInstance method you defined in PWork instead of PStore. In CWork1, override it with a method that calls CStore1.getInstance, and similarly in CWork2. Then the common fListener actionPerformed code would call getStoreInstance(Id).someMethod(), with no class name, which would work on the current PWork instance. You would still have some "duplicated" code (since you'd have to implement getStoreInstance in both CWork classes), but it would be kept to a minimum. Set up a map. This compiles (Java 8), but I haven't tested it: class PWork { private static Map&lt;Class&lt;? extends PWork&gt;,IntFunction&lt;PStore&gt;&gt; storeMap; static { storeMap = new HashMap&lt;&gt;(); storeMap.put(CWork1.class, CStore1::getInstance); storeMap.put(CWork2.class, CStore2::getInstance); } protected PStore getStoreInstance(int Id) { return storeMap.get(getClass()).apply(Id); } protected class fListener implements ActionListener { public void actionPerformed(ActionEvent ae) { int Id = ???; // I'm assuming Id is computed from ae somehow?? getStoreInstance(Id).someMethod(); } } } Now getStoreInstance looks in the map, using the current PW…
upvote count: 1

http://stackoverflow.com/comment/36484505
comment on: http://stackoverflow.com/a/23733162
type: AnswerComment
has text: But, if I set a sid or pid to `Comment`,then save it, both of sid and pid will not save to db, right ?
score: 0
type: Comment

http://stackoverflow.com/a/23727317
has comment: http://stackoverflow.com/comment/36471051
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23727204
has comment: http://stackoverflow.com/comment/36492905
has comment: http://stackoverflow.com/comment/36477127
has body: Imagine this situation: keyword = "aaaaa"' Let's iterate through your algorithm: alpha = "a" Take notice what are the contents of alpha i=1, j=0 keyword.charAt(1) == alpha.charAt(0) a == a alpha = "a" i=2, j=0 keyword.charAt(2) == alpha.charAt(0) a == a alpha = "a" i=2, j=1 Since alpha only has 1 char, exception is thrown because you are trying to access 2nd element. Solution: use HashSet to keep seen status. public String putKeyword(String keyword) { StringBuffer alpha = new StringBuffer(); Set&lt;Character&gt; seenChars = new HashSet&lt;String&gt;(); for (int i = 0; i &lt; keyword.length(); i++) { char c = keyword.charAt(i); if (!seenChars.contains(c)) { seenChars.add(c); alpha.append(c); } } return alpha.toString(); }
score: 2
downvote count: 0

http://stackoverflow.com/comment/36293498
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23627778
has text: Oh gr8 U got the solution...
type: Comment

hql
tag name: hql
tags question: http://stackoverflow.com/q/23649761
tags question: http://stackoverflow.com/q/23741247
tags question: http://stackoverflow.com/q/23686071
tags question: http://stackoverflow.com/q/23617560
tags question: http://stackoverflow.com/q/23745957
type: Tag
tags question: http://stackoverflow.com/q/23765990
tags question: http://stackoverflow.com/q/23648614
tags question: http://stackoverflow.com/q/23736109

http://stackoverflow.com/q/23661541
score: 4
has body: I would like to understand initialization of class instances in various cases.. In JLS-7 Section 12.5, there was no mention of how and when final instance variables were initialized? Can some one point me reference to understand the behaviour in case of instance variables declared as final? public class Test { public static void main(String args[]){ Child c1 = new Child(); } } class Parent{ final int a =30; Parent(){ System.out.println("From super Contsrutor "+a); meth(); } void meth(){ System.out.println("From super"); } } class Child extends Parent{ final int e=super.a; int b=30; void meth(){ System.out.println("From Sub e=" +e+", b="+b); } } is giving Output as following From super Contsrutor 30 From Sub e=0,b=0 Where as public class Test { public static void main(String args[]){ Child c1 = new Child(); } } class Parent{ final int a =30; Parent(){ System.out.println("From super Contsrutor "+a); meth(); } void meth(){ System.out.println("From super"); } } class Child extends Parent{ final int e=a; void meth(){ System.out.println("From Sub " +e); } } is giving Output as From super Contsrutor 30 From Sub 30
answer count: 3
tagged with: class-instance-variables
has answer: http://stackoverflow.com/a/23662572
accepted answer: http://stackoverflow.com/a/23662109
has answer: http://stackoverflow.com/a/23662151
has comment: http://stackoverflow.com/comment/36345428
linked to: http://stackoverflow.com/q/19418427
has comment: http://stackoverflow.com/comment/36345795
favorite count: 0
tagged with: final
has answer: http://stackoverflow.com/a/23662109
downvote count: 2
has comment: http://stackoverflow.com/comment/36345854
has comment: http://stackoverflow.com/comment/36346232
upvote count: 6
has comment: http://stackoverflow.com/comment/36345272
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36346079
tagged with: java
possible better answer: http://stackoverflow.com/a/23662151
type: Question
has title: Initialization of "final" instance variables

http://stackoverflow.com/a/23684878
score: 1
has body: Yes, you could use .getServiceAccountCredential /** * Constructs credentials for the given account and key. * * @param account the account to use. * @param privateKeyFile the file name from which to get the private key. * @return valid credentials or {@code null} */ public static Credential getServiceAccountCredential(String account, String privateKeyFile) { ... }
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23684444
answers question: http://stackoverflow.com/q/23684444
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36355013
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23665959
has text: I'm not clear on why you did this: "Copy the `fListener` code from `PWork` to `CWork1` class". I thought the object was to avoid duplicated code in `CWork1` and `CWork2`, which is why you wanted to put it in the parent class `PWork` in the first place--so why are you moving it back to `CWork1`? Am I missing something?
type: QuestionComment

datasource
tags question: http://stackoverflow.com/q/23734105
type: Tag
tag name: datasource
tags question: http://stackoverflow.com/q/23639141
tags question: http://stackoverflow.com/q/23653189

http://stackoverflow.com/q/23685384
type: Question
has answer: http://stackoverflow.com/a/24359687
has title: Spring 4 Hibernate 4 integration - DispatcherServlet and different maven dependencies cause error
score: 0
has comment: http://stackoverflow.com/comment/36391612
tagged with: classnotfoundexception
answer count: 1
tagged with: spring
has body: I am doing my first web-app that integrates Spring REST with hibernate. I have separate html+css+jquery website, which handles my RESTful WebService. And my problem is this: I did everything step by step to build the result I have now. And finally, when I run Tomcat, it runs ok. Then I am using IntelliJ IDEA builded REST client and check the most simple and the only one url: localhost:8080/room and recieve 404. I have found some advice on google to remove from web.xml - and I did it. And now when I just run my Tomcat and test the url above for the first time, it serves an stacktrace: http://pastebin.com/EMPDVCBy and then for every next time 404: Servlet dispatcherServlet is not available Earlier I have received an: java.lang.ClassNotFoundException:org.springframework.web.servlet.DispatcherServlet But I dont even know how, It has changed for some reason. I try to solve this problem for about 2 days and dont know whats the problem. I have entered every possible google's link that it has given me. Nothing helped. Earlier, when there was only Spring project - it has worked normally. After adding entities, dependencies to hibernate, different side-libraries(dependencies to them) that are required, DAO's etc - it started causing a problem. I also noticed, that after starting to integrate hibernate and spring I often receive stacktrace that was often telling me some ClassNotFoundException. From different places, even if I have aproperly dependencies added. Have no idea what could I did wrong. It is really important for me to solve this. Appreciate if you help me. I understand, that you will need my code, but it is so much of it, that It would be to long post :) tell me what you need I will post it here edit maybe the most important file, I think: web.xml Archetype Created Web Application dispatcherServlet org.springframework.web.servlet.DispatcherServlet dispatcherServlet /* responseFilter com.maciej.filters.ResponseOriginFilter responseFilter /* Filter is my own filter th…
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: integration
has comment: http://stackoverflow.com/comment/36391342

http://stackoverflow.com/comment/36421986
type: Comment
has text: "_The for loop in the divide function_" There is no for loop in the divide function.
score: 1
comment on: http://stackoverflow.com/q/23701986
type: QuestionComment

http://stackoverflow.com/comment/36539981
comment on: http://stackoverflow.com/q/23763819
type: Comment
type: QuestionComment
has text: Can you post your `AndroidManifest.xml`? Your `LinearLayout` is not closed properly, but that is not the cause of the problem.
score: 1

http://stackoverflow.com/comment/36337234
type: QuestionComment
comment on: http://stackoverflow.com/q/23657498
has text: A non-static data member can not be accessed statically. Your example; however, is of a static data member which is accessed statically.
score: 0
type: Comment

java.util.concurrent
tags question: http://stackoverflow.com/q/23691760
tags question: http://stackoverflow.com/q/23642582
tags question: http://stackoverflow.com/q/23688580
type: Tag
tag name: java.util.concurrent
tags question: http://stackoverflow.com/q/23681822

http://stackoverflow.com/q/23761447
tagged with: java
type: Question
has body: I'm making a memory card game in java it consists of 10 ImageIcons the first 5 ImageIcons are the original ones and the other 5 are copies and I cannot find a way to display the other side of the other images copied when the button is pressed, I made a for loop in order to make 2 copies of the images and made them have the same index but the buttons works only on the first 5 ImageIcons but it doesn't work on the other 5 copies of the ImageIcons (although they have the same index) import java.awt.*; import javax.swing.*; import javax.swing.JFrame; import java.awt.event.*; public class MemoControl extends JFrame{ JPanel game; EventClass event; private JButton button[]; private JLabel label[]; private ImageIcon image[]; private ImageIcon flippedImg; private String imgNames[];//not used yet int num; public MemoControl(){ setTitle("MyMemo Game"); setLayout(new GridLayout(5,2)); game = new JPanel(); image = new ImageIcon[50]; button = new JButton[50]; label = new JLabel[50]; flippedImg = new ImageIcon(getClass().getResource("card_cover1.jpg"));; for(int j = 1; j&lt;6; j++) { image[j] = new ImageIcon(getClass().getResource(j+".jpg")); button[j] = new JButton(""); button[j].addActionListener(new MemoControl.EventClass()); button[j].setIcon(flippedImg); add(button[j]); image[j] = new ImageIcon(getClass().getResource(j+".jpg")); button[j] = new JButton(""); button[j].addActionListener(new MemoControl.EventClass()); button[j].setIcon(flippedImg); add(button[j]); /*label[j] = new JLabel(image[j]); add(label[j]);*/ } EventClass event = new EventClass(); /*button = new JButton[50]; for(int i = 1; i&lt;=5; i++) { button[i] = new JButton(""); add(button[i]); button[i].addActionListener(event); }*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); }//MyMemo constr end //event class private class EventClass implements ActionListener { public void actionPerformed(ActionEvent e) { for (int i = 0; i &lt;6; i++) { if (e.getSource() == button[i]) { button[i].setIco…
score: 0
answer count: 1
tagged with: button
has title: Cannot display the other copy of ImageIcons when button pressed in memory game in Java
tagged with: imageicon
has answer: http://stackoverflow.com/a/23762310
type: UnansweredQuestion

http://stackoverflow.com/comment/36371252
score: 0
type: Comment
has text: @JonSkeet I totally agree with you. I said it was simple because it is easy to understanda character by character read... But I agree that a `BufferedReader` solution would be much better.
comment on: http://stackoverflow.com/a/23675215
type: AnswerComment

http://stackoverflow.com/comment/36471297
comment on: http://stackoverflow.com/a/23727438
score: 0
type: AnswerComment
has text: @masonc15: you could give it **two** BufferedImage variables, originalImage and displayedImage, with appropriate getters and setters for both fields.
type: Comment

http://stackoverflow.com/q/23647989
has title: p:commandLink action does not fire
type: Question
tagged with: commandlink
tagged with: primefaces
tagged with: jsf-2
score: 0
possible better answer: http://stackoverflow.com/a/23648991
answer count: 3
has answer: http://stackoverflow.com/a/23648991
has answer: http://stackoverflow.com/a/23688574
has body: p:commandLink action does not fire on my view bean. I tried many things but I did not achieve :(( There should be a simple issue about that. I would be appreciated if you can help me. &lt;p:dataTable var="message" value="#{messagesView.dataModel}" id="messageDt" emptyMessage="#{msg['kayitBulunamadi']}" lazy = "true" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,15,30" currentPageReportTemplate="{currentPage} / {totalPages}"&gt; &lt;p:column styleClass="min-image"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Durum" /&gt; &lt;/f:facet&gt; &lt;p:commandLink ajax="true" process="@this" action="#{messagesView.selectedMessages(message)}" oncomplete="PF('msjDialog').show();"&gt; &lt;!--&lt;p:graphicImage value="#{message.mesajDurumu=='NEW'?'/images/DealerNewMessages.png':'/images/DealerReadMessage.png'}" style="width: 60px; height: 60px;" /&gt;--&gt; &lt;p:graphicImage rendered="#{message.mesajDurumu=='REP'}" value="/images/email-send.png" style="width: 30px; height: 30px;" /&gt; &lt;p:graphicImage rendered="#{message.mesajDurumu=='NEW'}" value="/images/DealerNewMessages.png" style="width: 30px; height: 30px;" /&gt; &lt;p:graphicImage rendered="#{message.mesajDurumu!='REP' and message.mesajDurumu!='NEW'}" value="/images/DealerReadMessage.png" style="width: 30px; height: 30px;" /&gt; &lt;/p:commandLink&gt; &lt;/p:column&gt; Bean Code : public void selectedMessages(DealerMessages msj) { SELECTedMessage = msj; oncekiMesajiAl(); UpdateMessageStatusRead(msj); }
accepted answer: http://stackoverflow.com/a/23688574
type: AnsweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/23659324
tagged with: java
has comment: http://stackoverflow.com/comment/36401658
has comment: http://stackoverflow.com/comment/36340984

http://stackoverflow.com/a/23618952
type: AcceptedAnswer
downvote count: 0
has body: You are using the Graphics object wrong. Instead of calling write from wherever you call it, instead override paintComponent. You could do something like: private int xx; private int yy; private Color c; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(c != null) { int width=panel.getWidth()/x; int height=panel.getHeight()/y; g.setColor(c); g.drawRect(xx*width, yy*height, width, height); g.fillRect(xx*width, yy*height, width, height); } } public void write(int xx, int yy, Color c) { this.xx = xx; this.yy = yy; this.c = c; repaint(); }
has comment: http://stackoverflow.com/comment/36262293
type: Answer
has comment: http://stackoverflow.com/comment/36263043
has comment: http://stackoverflow.com/comment/36263643
upvote count: 3
has comment: http://stackoverflow.com/comment/36262215
answers question: http://stackoverflow.com/q/23618641
score: 3
has comment: http://stackoverflow.com/comment/36262278
accepted answer of: http://stackoverflow.com/q/23618641
has comment: http://stackoverflow.com/comment/36262169
has comment: http://stackoverflow.com/comment/36262184
has comment: http://stackoverflow.com/comment/36262359

http://stackoverflow.com/q/23668809
has title: Don't understand why Conditional "OR" operator not working for me?
accepted answer: http://stackoverflow.com/a/23668846
has answer: http://stackoverflow.com/a/23669026
favorite count: 0
has answer: http://stackoverflow.com/a/23668896
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23668896
upvote count: 3
type: Question
has answer: http://stackoverflow.com/a/23668846
has comment: http://stackoverflow.com/comment/36359347
score: 3
tagged with: java
has body: Am doing this online exercise and one question is: We'll say that a number is "teen" if it is in the range 13..19 inclusive. Given 2 int values, return true if one or the other is teen, but not both So I should return true if one of the int values that it passes into my method is in the range of 13 and 19 but return false if both are in the range; This is the code I wrote: public boolean loneTeen(int a, int b) { if ( a &gt;= 13 &amp;&amp; a &lt;= 19 || b &gt;= 13 &amp;&amp; b &lt;= 19 ) return true; else return false; } basically if integer a is between 13 and 19 inclusive or if integer b is between 13 and 19 inclusive I return true otherwise I return false. When I test this it works except If I pass in 13 and 13 for integer a and b, I get true instead of false. My question is I've looked up the conditional "OR(||)" operator and it says that: if the first operand determines the overall value for the condition, then the second operand is not evaluated. So when I use "Or" operator like my code above doesn't it mean if a is in the range return true or if b is in the range return true but if both are in the range return false? what is the differance between using if ( a &gt;= 13 &amp;&amp; a &lt;= 19 || b &gt;= 13 &amp;&amp; b &lt;= 19 ) and if ( a &gt;= 13 &amp;&amp; a &lt;= 19 &amp;&amp; b &gt;= 13 &amp;&amp; b &lt;= 19 ) Why isn't it returning false if both values passed in are in the range?
answer count: 3
downvote count: 0

http://stackoverflow.com/a/23714989
accepted answer of: http://stackoverflow.com/q/23710973
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: It seems that you want to check if the user made a full lap and not just moved forward 50 meters then went back to the same location to count as a lap. To check for laps no matter what is the shape you need check points in that path. The more checkpoints the better confirmation that the user followed the path. The user does not have to exactly pass through the check point he/she has to pass within 10 meters for example. So to actually count laps you need a predefined path with checkpoints and if the user passes through all or most of the points the lap is counted.
has comment: http://stackoverflow.com/comment/36454932
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23710973
has comment: http://stackoverflow.com/comment/36449483

http://stackoverflow.com/q/23724661
has comment: http://stackoverflow.com/comment/36465667
linked to: http://stackoverflow.com/q/977251
tagged with: java
has answer: http://stackoverflow.com/a/23724796
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/977251
upvote count: 9
answer count: 2
favorite count: 0
score: 8
has body: String test1 = "This is my test string"; I want to match a string which does not contain "test" I can do it with Pattern p = Pattern.compile(".*?^(test).*?") and it works but at most of sites like Regular Expressions and negating a whole character group ^(?!.*test).*$ is suggested which did not work for me. As per my understanding ^(test) is sufficient so why ^(?!.*test).*$ is required?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36465651
has title: Regex to negate the whole word?
tagged with: regex
has answer: http://stackoverflow.com/a/23724676
has comment: http://stackoverflow.com/comment/36465921

http://stackoverflow.com/comment/36987154
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23724201
type: Comment
has text: Correct me if wrong, but this implementation would not accept Windows L&F. It would default to standard Look and Feel.

http://stackoverflow.com/q/23687949
tagged with: text
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has comment: http://stackoverflow.com/comment/36396406
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36396178
score: -1
has body: How can i let user write only one number in text field? Other should be consume. I have code for write number. private boolean number(char zn){ if(zn&gt;='0' &amp;&amp; zn&lt;='9') return true; return false; }
upvote count: 0
has answer: http://stackoverflow.com/a/23689148
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36396138
has comment: http://stackoverflow.com/comment/36396616
has comment: http://stackoverflow.com/comment/36396355
linked to: http://stackoverflow.com/q/5662651
accepted answer: http://stackoverflow.com/a/23689148
tagged with: field
has comment: http://stackoverflow.com/comment/36396639
has title: Write only one number in text field
has comment: http://stackoverflow.com/comment/36396673
has comment: http://stackoverflow.com/comment/36396433

http://stackoverflow.com/comment/71052986
score: 14
type: AnswerComment
comment on: http://stackoverflow.com/a/23699499
type: Comment
has text: com.google.common.base.Equivalence.wrap(S) and com.google.common.base.Equivalence.Wrapper.get() could help too.

http://stackoverflow.com/a/24029281
upvote count: 2
has body: You can do manual validation and just skip the entities that are not valid, like this: // in the class inject validator @Resource Validator validator; ... for(TheEntity ent : entities){ if( validator.validate(ent).size() == 0) { // valid - persist em.persist(ent); } else { // invalid - skip } }
answers question: http://stackoverflow.com/q/23645661
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37063354

kinect
type: Tag
tags question: http://stackoverflow.com/q/23669714
tag name: kinect

http://stackoverflow.com/comment/36366341
comment on: http://stackoverflow.com/q/23659639
has text: I don't know that API but the source for that problem might not be the SDK. The stream might get closed outside the SDK and the SDK just complains about the stream being closed prematurely or there might be another error, like a connection failure, which causes the stream to be closed.
score: 0
type: Comment
type: QuestionComment

hashmap
tags question: http://stackoverflow.com/q/23622914
tags question: http://stackoverflow.com/q/23715841
tags question: http://stackoverflow.com/q/23616085
tags question: http://stackoverflow.com/q/23660682
tags question: http://stackoverflow.com/q/23679454
tags question: http://stackoverflow.com/q/23628001
tags question: http://stackoverflow.com/q/23678660
tags question: http://stackoverflow.com/q/23764466
tags question: http://stackoverflow.com/q/23724434
tags question: http://stackoverflow.com/q/23661758
tags question: http://stackoverflow.com/q/23720620
tags question: http://stackoverflow.com/q/23750109
tags question: http://stackoverflow.com/q/23632529
tags question: http://stackoverflow.com/q/23679608
type: Tag
tags question: http://stackoverflow.com/q/23632270
tags question: http://stackoverflow.com/q/23747396
tags question: http://stackoverflow.com/q/23722011
tags question: http://stackoverflow.com/q/23692512
tags question: http://stackoverflow.com/q/23743798
tags question: http://stackoverflow.com/q/23751276
tags question: http://stackoverflow.com/q/23701142
tags question: http://stackoverflow.com/q/23742663
tags question: http://stackoverflow.com/q/23650830
tags question: http://stackoverflow.com/q/23754048
tag name: hashmap
tags question: http://stackoverflow.com/q/23639825
tags question: http://stackoverflow.com/q/23630710
tags question: http://stackoverflow.com/q/23659433
tags question: http://stackoverflow.com/q/23745399
tags question: http://stackoverflow.com/q/23632227
tags question: http://stackoverflow.com/q/23734845
tags question: http://stackoverflow.com/q/23761677

http://stackoverflow.com/q/23662340
answer count: 1
has answer: http://stackoverflow.com/a/23662785
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23662785
tagged with: java
tagged with: hibernate
type: Question
has body: The SQL I want to create using Hibernate is this: SELECT * FROM tableName WHERE ...(another condition I have already handled here) AND ((billingCompleted = 0 AND terminationDate IS NULL) OR (billingCompleted = 0 AND terminationDate IS NOT NULL)) What I tried with no success so far is this: itemCriteria.add(Restrictions.and( Restrictions.or( (Restrictions.eq("billingCompleted", new Integer(0)), Restrictions.isNotNull("terminationDate")), (Restrictions.eq("billingCompleted", new Integer(0)), Restrictions.isNull("terminationDate")))))); How do I need to format this in order to set this up right for Hibernate?
has title: How to set up with Hibernate Criterion for 2 conditions ((x and Y) or (a and b))
score: 0

http://stackoverflow.com/comment/36506615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23745889
has text: simply "Unexpected non-whitespace character data"
score: 0

http://stackoverflow.com/comment/36318365
comment on: http://stackoverflow.com/a/23632741
type: Comment
score: 0
type: AnswerComment
has text: My mistake - Websocket doesn't seem to use eventhandling. Try wsocket.onopen= function() { ... }; instead.

http://stackoverflow.com/a/23640412
accepted answer of: http://stackoverflow.com/q/23640196
answers question: http://stackoverflow.com/q/23640196
upvote count: 1
has body: Edit: based on the images of errors that you uploaded later, it looks like you are using a Java 1.6 or earlier compiler. Do java -version to see what version you are using. Update your windows path to use the java 1.7 version that you have elsewhere on your machine.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36303916
score: 1
type: Answer

http://stackoverflow.com/a/23725632
has comment: http://stackoverflow.com/comment/36467806
has body: DatabaseMetaData metaData = connection.getMetaData(); ResultSet resultSet = metaData.getTables(null, "schenaName", "%" ,new String[] {"TABLE"} ); while (resultSet.next()) { System.out.println(resultSet.getString(3)); } Adding new answer: Connection connection = getDBConnection(); DatabaseMetaData dbMetaData = connection.getMetaData(); //getting catalogs for mysql DB, if it is not working for your DB, try dbMetaData.getSchemas(); ResultSet catalogs = dbMetaData.getCatalogs(); while(catalogs.next()){ String catalogName = catalogs.getString(1); //excluding table names from "mysql" schema from mysql DB. if(!"mysql".equalsIgnoreCase(catalogName)){ ResultSet tables = dbMetaData.getTables(catalogName, null, null, null); while(tables.next()){ System.out.println(catalogName + "::"+tables.getString(3)); } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/36467894
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23725304

http://stackoverflow.com/q/23696858
tagged with: java
type: Question
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has title: org.apache.commons.io.FileUtils - change text encodig
has answer: http://stackoverflow.com/a/23696969
upvote count: 2
tagged with: fileutils
tagged with: rtf
accepted answer: http://stackoverflow.com/a/23696969
type: AnsweredQuestion
has body: I have one file which contains text(ukranian symbols). Example: ${name} - привіт. I need to replace from ${name} to Саша. But in output file I recive something like this: Ð¿Ñ??Ð¸Ð²ÐµÑ - привіт instead of Саша- привіт. But if I use .txt instead .rtf - all is fine. I understand the problem in the coding but can't solve it. Code example: File file = new File("original.rtf"); String content = FileUtils.readFileToString(file); content = content.replace("${name}", "Саша"); File fileNew = new File("changed.rtf"); FileOutputStream fop = new FileOutputStream(fileNew); byte[] contentInBytes = content.getBytes("UTF-8"); fop.write(contentInBytes); fop.flush(); fop.close();

http://stackoverflow.com/comment/36278606
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23627199
has text: I have a lot of processing on my app.

http://stackoverflow.com/comment/36487314
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23736067
has text: Then you need to explain what is happening in the synchronized method. You may experience database locking problems if you process the ResultSet in a synchronized method.

http://stackoverflow.com/comment/36650469
type: Comment
comment on: http://stackoverflow.com/a/23647115
has text: Note also that the TemporalAccessor interface does allow access to the offset and zone. You simply call query(TemporalQuery) using a constant from TemporalQueries http://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalQueries.html . Or for simplicity, use ZoneOffset.from(temporal)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36479644
type: QuestionComment
comment on: http://stackoverflow.com/q/23731961
score: 3
has text: Because 1 is boxed to Integer. If you were using Java < 5, it wouldn't compile. You can read http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html
type: Comment

http://stackoverflow.com/a/23704134
downvote count: 0
has comment: http://stackoverflow.com/comment/36434512
answers question: http://stackoverflow.com/q/23700736
type: Answer
has comment: http://stackoverflow.com/comment/36435622
has comment: http://stackoverflow.com/comment/36426762
has comment: http://stackoverflow.com/comment/36427556
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/36437599
has comment: http://stackoverflow.com/comment/36440525
has body: The new BigDecimal(double) constructor is exact, as is the conversion from float to double, so if you start with a float value num1, new BigDecimal(num1) will give the exact BigDecimal equivalent. It may not be quite what you expect. For example, the closest float to 13.846154 is 13.84615421295166015625, so that is the initial value of num1 and of calculation. The BigDecimal addition of 2 is exact, giving 15.84615421295166015625. The next problem is turning it into a float for further calculation. As it happens, it is exactly representable as a float, so there is no further loss of precision. In general, converting a BigDecimal to float will involve rounding to the nearest float. It turns out that all the loss of precision in this calculation happened on the initialization of num1. If you do it this way, without all the conversions to and from String, you will get as close as you can, given initial use of float. If float is not precise enough for your calculations, but you need a float to pass to another method, consider using either BigDecimal or double for the whole calculation except for the final step. BigDecimal's floatValue() does return the closest float to the exact value of the BigDecimal. There is one case in which it is advantageous to use String. If you know you want a BigDecimal to be an exact decimal fraction, constructing the BigDecimal from the String representation of the fraction gets it exactly. Writing something like new BigDecimal(1.0) gets a BigDecimal whose value is 0.1000000000000000055511151231257827021181583404541015625, the value of the closest double to 0.1. If you have already converted to float or double, converting via String will either make no difference or cause loss of precision. It will not help.
has comment: http://stackoverflow.com/comment/36440511

http://stackoverflow.com/q/23759784
tagged with: return
accepted answer: http://stackoverflow.com/a/23759834
has answer: http://stackoverflow.com/a/23760145
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23759981
tagged with: java
has answer: http://stackoverflow.com/a/23759834
type: Question
has title: How do I return Multiple String from loops?
has comment: http://stackoverflow.com/comment/36532341
has comment: http://stackoverflow.com/comment/36532068
score: 0
has answer: http://stackoverflow.com/a/23759981
has answer: http://stackoverflow.com/a/23759883
has comment: http://stackoverflow.com/comment/36532111
has body: Please take a look at this code (with ArrayList implementation) public String returnCoreUnitsForProgram() { ArrayList&lt;String&gt; testArray = new ArrayList&lt;String&gt;(); ProgramClass pc = new ProgramClass("","","",""); if ( pc.getProgramMajor().equals("Software Technology") || pc.getProgramMajor().equals("Network Technology" ) || pc.getProgramMajor().equals("Games Technology" ) ) { for(int i = 0; i&lt; UnitArray.size() ; i++) { if (UnitArray.get(i).getUnitType().equals("Core")) testArray.add( UnitArray.get(i).getUnitName() ); } } return testArray; } With ArrayList - I get the error "imcompatible types" Without ArrayList: public void returnCoreUnitsForProgram() { ProgramClass pc = new ProgramClass("","","",""); if ( pc.getProgramMajor().equals("Software Technology") || pc.getProgramMajor().equals("Network Technology" ) || pc.getProgramMajor().equals("Games Technology" ) ) { for(int i = 0; i&lt; UnitArray.size() ; i++) { if (UnitArray.get(i).getUnitType().equals("Core")) UnitArray.get(i).getUnitName(); } } } In another class "ProgramClass", public String programToString() { Apps apps = new Apps(); String str = "Program Code: " + getProgramCode() +"\nProgram Code: " + getProgramName() +"\nProgram Major: "+ getProgramMajor() + apps.returnCoreUnitsForProgram(); return str; } I can't possibly do this because returnCoreUnitsForProgram() method is void. So I'm thinking that my only option is to use the first implementation method with ArrayList. How can I solve this problem?

http://stackoverflow.com/q/23654990
favorite count: 0
has body: I'm building unittests for a wicketproject and I'm having trouble testing a download function. I start from a page with a search form. wicketTester.startPage(SearchPage.class); // set values for FormTester formTester formTester.submit(); after submission I get a page with a ListView, so far so good. tester.assertRenderedPage(ResultPage.class); // test some Labels in listitems Now I want to export the list to a csv and check the file. Still Ok here tester.clickLink("exportlink"); tester.assertContains("part,of,csv,to,test;"); Now I want to "go back" and click a listitem to go to the details of a search results. I cant find how to get the previous page where the list is and then trigger the ajaxevent on the listitem. tester.executeAjaxEvent("aansluitngrow:1", "onclick"); Thanks for your help :)
tagged with: wicket
downvote count: 0
has title: How to write a unit test for a wicket DownloadLink?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23756290
tagged with: unit-testing
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1

http://stackoverflow.com/a/23616868
answers question: http://stackoverflow.com/q/23616325
type: Answer
has body: You should catch the error, in case there is no third child of the layout or there is no layout. Try to check, whether layout or button actually have the content you want: LinearLayout layout = (LinearLayout)view.getParent(); if(layout != null) { ImageButton button = (ImageButton)layout.getChildAt(3); } else { Log.d("Error", "No Parent Layout"); } if(button != null) { //do your stuff } else { Log.d("Error", "No Third Child"); }
score: 0

http://stackoverflow.com/a/23660641
type: Answer
answers question: http://stackoverflow.com/q/23642284
upvote count: 1
score: 1
has body: I figured out a way to make the nicknames work for me...may not be the best way, but it works. I'm posting this solution just in case it may help somebody (or at least save some time) in the future. For the server, I added the following code in the 'connection' event socket.on('set nickname', function (name) { socket.set('nickname', name, function () { socket.nickname=name; socket.emit('ready'); }); }); //code for transferring channel data to client socket.on('var', function(data){ socket.broadcast.emit('var',{user: socket.nickname, message:data}); }); In the code for the Android activity sending the data, I added this line to the onConnect() @Override public void onConnect() { mysocket.emit("set nickname", "Danica"); } And lastly, I changed the code in the Android activity receiving the data as follows: mysocket.connect(new IOCallback() { @Override public void on(String event, IOAcknowledge arg1, Object... arg2) { JSONObject jo = null; String user = ""; Object[] arguments = arg2; jsonmsg = arguments[0].toString(); try { jo = new JSONObject(jsonmsg); user = jo.getString("user"); } catch (JSONException e) { e.printStackTrace(); } if (user.equals("Danica")) { if (event.equals("var")) { try { var = jo.getString("message"); } catch (JSONException e) { e.printStackTrace(); } } } // this makes call to progress so UI can be updated int values = 1; publishProgress(values); }
downvote count: 0

http://stackoverflow.com/q/23624285
has comment: http://stackoverflow.com/comment/36278974
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/36280160
has body: i am using iText 5.1.0 for creating the PDF in java . I have 3 blocks of tables , whose sizes may change dynamically Table 1 . . . Table 2 . . . . End of page Now i am in need of the method that would compute the space below the table 2 . And i am using the pagesize as A4 Intially it printed like this , But when the data in the previous tables increased it printed , like the 2 nd one. So i would like to calculate the space below if possible before i insert the table Any suggestions are highly appreciated. Thank you
has comment: http://stackoverflow.com/comment/36273575
tagged with: itext
accepted answer: http://stackoverflow.com/a/23629269
has comment: http://stackoverflow.com/comment/36319111
has comment: http://stackoverflow.com/comment/36319058
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17214756
tagged with: java
linked to: http://stackoverflow.com/q/15387642
has comment: http://stackoverflow.com/comment/36319196
has comment: http://stackoverflow.com/comment/36283685
has comment: http://stackoverflow.com/comment/36318464
has comment: http://stackoverflow.com/comment/36279086
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36277162
has title: Getting the Line Postion In iText
has comment: http://stackoverflow.com/comment/36276657
has answer: http://stackoverflow.com/a/23629269
has comment: http://stackoverflow.com/comment/36280004

http://stackoverflow.com/a/23779902
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23773166
accepted answer of: http://stackoverflow.com/q/23773166
has body: The accepted answer is not wrong, but I would like to add extra details which give a more balanced view. a) Stable queries: ISO-8601 is stable as long as you assert that you only use one date format for storage (ISO defines three: calendar date, ordinal date and week date) and that you always use one precision degree for the time part (for example always in milliseconds) and that you always use UTC with respect to global timestamps (that is zero offset with symbol Z). Confirming this kind of stability can be application-dependent while java.util.Date does not require the same care. b) Precision: ISO-8601 can express more precision beyond milliseconds while java.util.Date and Joda-Time are limited here. This is particularly true if you might later think of other new time libraries like JSR-310 in Java 8 or my own one which provide nanosecond precision. Then you will have precision issues with all JDBC types, java.util.Date and the database columns as far as they are not CHAR or VARCHAR. A striking example is the JDBC-type java.sql.Time whose precision is limited to seconds, not better. This is pretty much in contrast to the new Java8-type java.time.LocalTime which offers nanoseconds. And worse: This aspect is also relevant for Joda-Time and java.util.Date in your application layer. For rather academic purposes: Leapseconds can only be stored in ISO-8601-format, not with java.util.Date or similar. c) Storage size: Of course, java.util.Date has a more compact representation, but else I have to say that disk space is cheap nowadays, so this is not an item to worry about so much. d) Read-Write-costs: This item is in favor of compact data types like java.util.Date. But you have also to consider that even in this case you have to represent it in a human-readable format in any other layer sooner or later (most in logging or in representation layer). So for data exchange with other proprietary applications which expect java.util.Date this native type is okay, but for logging…
score: 4
upvote count: 4

http://stackoverflow.com/comment/36517467
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23751867
type: AnswerComment
has text: please share your final code with me, which you think i should try

http://stackoverflow.com/a/23722245
downvote count: 0
has body: There is no way to literally do what is asked is the question, as Java has no globals / no macros. Here is the closest similar possibility: You can use a static method that internally uses your ourInstance variable: public class Handy{ private static Handy ourInstance = new Handy(); private Handy() {} public synchronized static Handy getInstance(){return ourInstance;} public void Example(String ss){ Log.v("Java rocks ", ss); } public static void ExampleWithoutInstance(String ss){ ourInstance.Example(ss); } } Then you can do this from anywhere: Handy.ExampleWithoutInstance("true");
has comment: http://stackoverflow.com/comment/69959937
has comment: http://stackoverflow.com/comment/36461092
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23722156
has comment: http://stackoverflow.com/comment/69941204

http://stackoverflow.com/q/23772951
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36557991
has title: Thread.sleep(long mills) delaying also previous method
has answer: http://stackoverflow.com/a/23772965
has body: invalid_login_label.setVisible(false); username_label.setVisible(false); user_field.setVisible(false); password_label.setVisible(false); pass_field.setVisible(false); access_granted_label.setVisible(true); Thread.sleep(1000); this.dispose(); hello world! I'm kinda newbie to java and I'm using netbeans so I have this code in my jframe. what i want is to do is after the system authenticated the user. it will remove the visibility of all fields and display "access granted" for 1000mills but it starts delaying but still not removing the visibility of fields.
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: jframe
tagged with: multithreading
tagged with: swing
accepted answer: http://stackoverflow.com/a/23772965
score: 2
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/comment/36535009
comment on: http://stackoverflow.com/a/23743318
type: Comment
has text: Why down vote? it is a method to solve it? and I am the poster of the question?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23627565
type: Answer
has body: The class Java.lang.Math is Final class. It can't be extended.
answers question: http://stackoverflow.com/q/23627485
score: 0

http://stackoverflow.com/comment/36435025
comment on: http://stackoverflow.com/q/23707267
has text: This can help: http://stackoverflow.com/q/15822544/6309
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23710829
has answer: http://stackoverflow.com/a/23713424
answer count: 1
downvote count: 1
favorite count: 0
tagged with: wavefront
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36441077
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
tagged with: import
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/23713424
linked to: http://stackoverflow.com/q/23349080
has title: Why is my OBJ parser rendering meshes like this?
has body: I've taken it upon myself to add OBJ parser/importer support to a 3D rendering engine I've been working on. I've followed the specification found HERE nearly 'to a tee', with the current exception of limiting all support to groups, faces, vertices, normals and texture coordinates (so no material library or free-form poly support, as of yet). My goal was to simply parse line by line -- generating an object-oriented, hierarchical tree-like scene graph as I went along -- and allow the developer to automatically bind the data to a shader program with very few manual calls in order to start manipulating &amp; viewing the mesh. The end result is that my engine does successfully parse most (if not all) valid OBJ format files, extracting the appropriate data and sending it to a basic shader for rendering. However, even though the data appears to be represented correctly in the scene graph, for some reason or another it rarely renders properly... Take note that a simple plane (exported from 3DS Max, containing only 4 vertices and 2 faces) renders perfectly fine, but a cube or anything more advanced usually ends up looking something like this: http://youtu.be/1x6bnuhAXWY I can't tell where things are going wrong, and AFAIK my code should actually be parsing and rendering basic geometry just fine... So why isn't it? For convenience, I have uploaded my project HERE. It contains a NetBeans project with a minimal version of my engine, and one Test application. I have also included 3 different versions of an OBJ cube mesh, and a single plane mesh. The application is configurable by editing the values at the top of Test.java, and the only input controls are A, S, W, &amp; D for mesh translation, and mouse movement for mesh rotation. And although I've managed to skim the project down considerably, the most notable classes include extra comments/info at the top of the file. All things considered, I'll take whatever thoughts I can get... and it certainly won't go unappreciated!

http://stackoverflow.com/comment/36479474
type: AnswerComment
comment on: http://stackoverflow.com/a/23731291
type: Comment
has text: supoose if I select shoes from that drop down I want to send that value "Shoes" or accordingly
score: 0

jscrollpane
tags question: http://stackoverflow.com/q/23636221
tag name: jscrollpane
tags question: http://stackoverflow.com/q/23646008
tags question: http://stackoverflow.com/q/23723305
tags question: http://stackoverflow.com/q/23655991
type: Tag
tags question: http://stackoverflow.com/q/23663308
tags question: http://stackoverflow.com/q/23747894
tags question: http://stackoverflow.com/q/23724609
tags question: http://stackoverflow.com/q/23721981
tags question: http://stackoverflow.com/q/23638279
tags question: http://stackoverflow.com/q/23649810

http://stackoverflow.com/a/23636008
type: Answer
has comment: http://stackoverflow.com/comment/36296407
answers question: http://stackoverflow.com/q/23633768
has comment: http://stackoverflow.com/comment/36304827
score: 0
type: AcceptedAnswer
has body: When you make a call to your Mobile Service (such as the mUserTable.select or mUserTable.where calls), the callback you pass in as the parameter is exactly that, a callback. The requests are made asynchronusly and the callback code is only executed when your Mobile Service responds. If you put breakpoints within those callbacks, you'd see them executed once a response was received. That is why it looks like the execution is skipping over that code and going right to the imgFavorite line. As to why you're getting a null exception, you'll have to step through your code and see what line of code is actually triggering it.
accepted answer of: http://stackoverflow.com/q/23633768

http://stackoverflow.com/comment/38462306
comment on: http://stackoverflow.com/q/23775175
type: Comment
type: QuestionComment
has text: Seems like you are not alone https://hibernate.atlassian.net/browse/HHH-9286
score: 0

http://stackoverflow.com/comment/36280792
score: 0
type: Comment
type: QuestionComment
has text: Where is the original date coming from, and where are you seeing `0014-02-25 22:06:00.0`? You're losing the century somewhere but it isn't really clear where, without seeing what `getSaleTime()` and `setSaleTime()` are doing. I suspect you're confused about how Oracle stores dates, as they have a fixed internal representation but no intrinsic display format.
comment on: http://stackoverflow.com/q/23628302

http://stackoverflow.com/comment/36320218
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23648911
has text: Calling the constructor requires the `new` keyword.

http://stackoverflow.com/a/23741878
has body: The answer is implementation dependent, and it also depends on the context ... and what you mean by creation. The execution of those lines of code creates one String object for the concatenation, and possibly others within the println call1. These creations would happen each time your application executes those lines. At least a further two String objects will be created when the code is loaded and String objects are created for the String literals. However, that is a once off ... 1 - In some class libraries, println(s) is implemented as print(s + newline). Hence the println call may create another String object.
type: Answer
answers question: http://stackoverflow.com/q/23741636
score: 0

tomcat
tags question: http://stackoverflow.com/q/23664421
tags question: http://stackoverflow.com/q/23649578
tags question: http://stackoverflow.com/q/23697196
tags question: http://stackoverflow.com/q/23743469
tags question: http://stackoverflow.com/q/23673315
tags question: http://stackoverflow.com/q/23757979
tags question: http://stackoverflow.com/q/23636304
tags question: http://stackoverflow.com/q/23709175
tags question: http://stackoverflow.com/q/23649389
tags question: http://stackoverflow.com/q/23619950
tags question: http://stackoverflow.com/q/23708987
tags question: http://stackoverflow.com/q/23617085
tags question: http://stackoverflow.com/q/23690405
tags question: http://stackoverflow.com/q/23763350
tags question: http://stackoverflow.com/q/23775620
tags question: http://stackoverflow.com/q/23650637
tags question: http://stackoverflow.com/q/23750038
tags question: http://stackoverflow.com/q/23638815
tags question: http://stackoverflow.com/q/23671890
tags question: http://stackoverflow.com/q/23680579
tags question: http://stackoverflow.com/q/23743630
tags question: http://stackoverflow.com/q/23768169
tags question: http://stackoverflow.com/q/23665426
tags question: http://stackoverflow.com/q/23680634
tags question: http://stackoverflow.com/q/23735503
tags question: http://stackoverflow.com/q/23652405
tags question: http://stackoverflow.com/q/23745766
tags question: http://stackoverflow.com/q/23759016
tags question: http://stackoverflow.com/q/23712286
tags question: http://stackoverflow.com/q/23693796
tags question: http://stackoverflow.com/q/23767495
tags question: http://stackoverflow.com/q/23728632
tags question: http://stackoverflow.com/q/23753966
tags question: http://stackoverflow.com/q/23773283
tags question: http://stackoverflow.com/q/23627130
tag name: tomcat
tags question: http://stackoverflow.com/q/23760002
tags question: http://stackoverflow.com/q/23736142
tags question: http://stackoverflow.com/q/23775647
tags question: http://stackoverflow.com/q/23673719
tags question: http://stackoverflow.com/q/23663629
tags question: http://stackoverflow.com/q/23696482
tags question: http://stackoverflow.com/q/23637905
tags question: http://stackoverflow.com/q/23625439
tags question: http://stackoverflow.com/q/23776644
tags question: http://stackoverflow.com/q/23658954
tags question: http://stackoverflow.com/q/23758826
tags question: http://stackoverflow.com/q/23750147
tags question: http://stackoverflow.com/q/23688694
tags question: http://stackoverflow.com/q/23633156
tags question: http://stackoverflow.com/q/23655416
tags question: http://stackoverflow.com/q/23642670
tags question: http://stackoverflow.com/q/23762762
tags question: http://stackoverflow.com/q/23635112
tags question: http://stackoverflow.com/q/23722583
type: Tag
tags question: http://stackoverflow.com/q/23625352
tags question: http://stackoverflow.com/q/23698562
tags question: http://stackoverflow.com/q/23736986
tags question: http://stackoverflow.com/q/23741643
tags question: http://stackoverflow.com/q/23724020
tags question: http://stackoverflow.com/q/23617238
tags question: http://stackoverflow.com/q/23737199
tags question: http://stackoverflow.com/q/23714643
tags question: http://stackoverflow.com/q/23673873
tags question: http://stackoverflow.com/q/23620580
tags question: http://stackoverflow.com/q/23772905
tags question: http://stackoverflow.com/q/23755201
tags question: http://stackoverflow.com/q/23651097
tags question: http://stackoverflow.com/q/23622024
tags question: http://stackoverflow.com/q/23698134
tags question: http://stackoverflow.com/q/23678722
tags question: http://stackoverflow.com/q/23698443
tags question: http://stackoverflow.com/q/23689765
tags question: http://stackoverflow.com/q/23740211
tags question: http://stackoverflow.com/q/23760158
tags question: http://stackoverflow.com/q/23635874

http://stackoverflow.com/comment/36460420
type: AnswerComment
comment on: http://stackoverflow.com/a/23722004
score: 0
type: Comment
has text: i don't know the amount of columns it's gonna take (if the window is resized it is possible that they need more/less)

http://stackoverflow.com/q/23773276
tagged with: android
has body: An error occurs when connecting to a IPv6 server via HttpsURLConnection: [error] Hostname [xxxx:xxxx:x:xx::xxx] provided via SNI and hostname xxxx:xxxx:x:xx::xxx provided via HTTP are different To connect to same IPv6 Apache server(version 2.2.27), Apache HttpClient works without any problem, but HttpsURLConnection doesn't. So it may not be a server side issue. Does anyone see this error before when using HttpsURLConnection?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6594604
tagged with: httpsurlconnection
has title: HttpsURLConnection cannot connect to IPv6 server
has comment: http://stackoverflow.com/comment/41604618
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/36567335
tagged with: java
tagged with: ssl
type: Question
downvote count: 0

http://stackoverflow.com/a/23652112
answers question: http://stackoverflow.com/q/23627396
has body: if you got this error or something like it and your game hasn't been started before, you should update your jmonkey becouse that was the problem Richard Tingle thank you! ,Niels
type: Answer
has comment: http://stackoverflow.com/comment/36326429
score: 0

http://stackoverflow.com/comment/36314413
type: Comment
has text: What webpages have you seen so far? The difference between GET and POST is very small.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23645878

http://stackoverflow.com/comment/36287772
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23632227
has text: If you combine my code above and @StanislavL's code below you should have your solution. If that's not the case you need to post what is going wrong. Is it not printing? Is it giving an error?
type: Comment

http://stackoverflow.com/comment/61214646
comment on: http://stackoverflow.com/q/23746075
score: 0
type: QuestionComment
type: Comment
has text: @ant it can be covariant

http://stackoverflow.com/comment/124487678
score: 0
type: Comment
has text: @binary If possible, drop `final` where it interferes with mocking. Otherwise use `final` consistently with the rest of your codebase. That should come through in the second and final paragraphs: there's room for engineering judgment, so it's unfortunately not really a binary answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/23621807

http://stackoverflow.com/comment/36269073
has text: Why is this question marked as a duplicate? I thought is took votes by 5 different people before a question gets closed?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23621459
score: 0

http://stackoverflow.com/comment/36300774
comment on: http://stackoverflow.com/a/23637530
has text: @Durandal So, how is your do-while loop better in that case?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23675275
has comment: http://stackoverflow.com/comment/36371322
type: Answer
has body: You might switch to log4j.xml. (this might be helpful: log4j.properties vs log4j.xml)
has comment: http://stackoverflow.com/comment/36386600
score: 0
answers question: http://stackoverflow.com/q/23675150

twitter-bootstrap
tags question: http://stackoverflow.com/q/23724102
tag name: twitter-bootstrap
type: Tag

http://stackoverflow.com/q/23757785
has title: How scala traits are implemented in Java?
has comment: http://stackoverflow.com/comment/36529403
favorite count: 0
tagged with: scala
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2557303
has body: Ok, I know about javap tool and already looked on decompiled java class files. However there are still some question about how scala traits implemented in java as I'm more .net developer. trait A{ def foo = "A" } trait B extends A{ override def foo = "B" def bfoo = "bfoo" } trait C extends A{ override def foo = "C" def cfoo = "cfoo" } class D extends A val d = new D with B with C The interesting thing here is that above d instance is realized in java as D d = new D() { public void bfoo() { B.class.bfoo(this); } public void cfoo() { C.class.cfoo(this); } public void foo() { C.class.foo(this); } }; What is that construction, ... new D() { //definition of methods}? I mean, is it somewhat like, definition of new methods inside instance initializer? I tried to do the same way for myself, and it is compiling, but I didn't find a way to access methods defined that way. I mean inside instance initializers? UPDATE Ok, here is complete example and what it decompiles to object MainClass{ def main(args:Array[String]){ val d = new D with B with C println(d.bfoo) println(d.cfoo) println(d.foo) } } trait A{ def foo = "A" } trait B extends A{ override def foo = "B" def bfoo = "bfoo" } trait C extends A { override def foo = "C" def cfoo = "cfoo" } class D extends A And decompilation of main method: public void main(String[] args) { D d = new D() { public String bfoo() { return B.class.bfoo(this); } public String cfoo() { return C.class.cfoo(this); } public String foo() { return C.class.foo(this); } }; Predef..MODULE$.println(((B)d).bfoo()); Predef..MODULE$.println(((C)d).cfoo()); Predef..MODULE$.println(((C)d).foo()); } Look how it's accessing in-place defined methods through casting. Does it make sense? Cannot understand that part, because when I tried to do it myself, it threw an exception.
tagged with: traits
answer count: 0
duplicate of: http://stackoverflow.com/q/2557303
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/23754494
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36529606
has comment: http://stackoverflow.com/comment/36530459
downvote count: 0

http://stackoverflow.com/a/23983076
has comment: http://stackoverflow.com/comment/37174005
has body: Download jersey library via maven solved the problem for me. To create a RESTFul service: Select "New Project" Select "Java" Check "Application Server" and "RESTFul Web Service" Select "Set up library later" Click "Next" Click "Finish" Right-click on the project name Select "Add Framework support..." Check "Maven" in the list and "Ok" Add the following lines to the file pom.xml: com.sun.jersey jersey-server 1.18.1
answers question: http://stackoverflow.com/q/23682334
score: 12
upvote count: 12
has comment: http://stackoverflow.com/comment/53451237
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36955387

http://stackoverflow.com/comment/36560147
type: AnswerComment
has text: As I already mentioned in my question, that would drain the whole battery quickly.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23773943

http://stackoverflow.com/a/23648756
score: 36
upvote count: 43
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23636368
type: Answer
has comment: http://stackoverflow.com/comment/57846756
has comment: http://stackoverflow.com/comment/132424556
downvote count: 7
has comment: http://stackoverflow.com/comment/87373802
accepted answer of: http://stackoverflow.com/q/23636368
has body: The default security in Spring Boot is Basic. You could disable it by setting security.basic.enabled=false. More about this here and here.

http://stackoverflow.com/comment/36476901
type: AnswerComment
type: Comment
has text: yes, of course, it will be zero until the first Integer message
comment on: http://stackoverflow.com/a/23719494
score: 0

http://stackoverflow.com/a/23725119
has comment: http://stackoverflow.com/comment/36466915
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23721933
downvote count: 0
has comment: http://stackoverflow.com/comment/36471955
type: Answer
has body: The crc_string function computes the CRC of an array of bytes until it finds a \0 byte. When you define the bufferline variable, you define it as size 11, not giving room for the \0 of your target string, so the function crc_string will continue scanning the memory after bufferline until it finds a \0 in memory... To solve the problem, define the variable bufferline as size 12 or more.

http://stackoverflow.com/comment/36355165
score: 0
has text: @Ryan Updated my answer (again). Does that match your understanding of what is going on?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23665546

http://stackoverflow.com/comment/36268196
type: Comment
comment on: http://stackoverflow.com/q/23621723
type: QuestionComment
score: 0
has text: I'm not familiar with Spring Boot and its Gradle plugin.

http://stackoverflow.com/q/23663547
score: 13
linked to: http://stackoverflow.com/q/2946338
has comment: http://stackoverflow.com/comment/36350355
linked to: http://stackoverflow.com/q/19895550
accepted answer: http://stackoverflow.com/a/23663748
favorite count: 0
has comment: http://stackoverflow.com/comment/36349799
duplicate of: http://stackoverflow.com/q/10882952
has body: Here I have found some good example: // Prepare source somehow. String source = "package test; public class Test { static { System.out.println(\"hello\"); } public Test() { System.out.println(\"world\"); } }"; // Save source in .java file. File root = new File("/java"); // On Windows running on C:\, this is C:\java. File sourceFile = new File(root, "test/Test.java"); sourceFile.getParentFile().mkdirs(); new FileWriter(sourceFile).append(source).close(); // Compile source file. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); compiler.run(null, null, null, sourceFile.getPath()); // Load and instantiate compiled class. URLClassLoader classLoader = URLClassLoader.newInstance(new URL[] { root.toURI().toURL() }); Class&lt;?&gt; cls = Class.forName("test.Test", true, classLoader); // Should print "hello". Object instance = cls.newInstance(); // Should print "world". System.out.println(instance); // Should print "test.Test@hashcode". Question: Is it possible to achieve exactly the same thing without writing to a file? @Edit: To be more exact: I know how to compile from string (overloading JavaFileObject). But after doing this, I have no idea how to load the class. I probably missed the output-write part, but this also a thing I would like not to do. @Edit2 For anyone interested, I created this small project to implement discussed feature: https://github.com/Krever/JIMCy
upvote count: 13
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23664177
has comment: http://stackoverflow.com/comment/36349541
type: Question
has answer: http://stackoverflow.com/a/23663748
has comment: http://stackoverflow.com/comment/36349713
answer count: 2
possible better answer: http://stackoverflow.com/a/23664177
has title: Compile java source from String without writing to file
downvote count: 0

http://stackoverflow.com/comment/36338389
comment on: http://stackoverflow.com/q/23658162
has text: What's your question?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36548215
type: QuestionComment
comment on: http://stackoverflow.com/q/23766789
has text: please post the code of WrapperTransmissaoRetorno, is it annotated? don't you get any messagebody writer exception in tomcat? nothing about nothing?
score: 0
type: Comment

http://stackoverflow.com/a/60017395
answers question: http://stackoverflow.com/q/23751618
score: -1
downvote count: 1
type: Answer
has body: Please use the following code... String str[]=fname.split("\\\\\\\");
upvote count: 0
has comment: http://stackoverflow.com/comment/129018085

http://stackoverflow.com/q/23713959
type: UnansweredQuestion
has body: I work with pdfbox 1.8.5 and I try to draw a colored Line using PDPageContentStream.drawLine(). I tried it with PDPageContentStream.setNonStrokingColor( 255, 0, 0 ); but it doesn't work. I also didn´t find any examples or HowTos concerning Line Color. Does anyone know, how I can change the Line Color?
has comment: http://stackoverflow.com/comment/36448056
upvote count: 3
has comment: http://stackoverflow.com/comment/66720707
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36445860
score: 3
has comment: http://stackoverflow.com/comment/36447542
tagged with: pdfbox
has title: PDFBox change color of a line
has answer: http://stackoverflow.com/a/45954129
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/73126959
has comment: http://stackoverflow.com/comment/78936064
has comment: http://stackoverflow.com/comment/78889040

http://stackoverflow.com/a/23721735
answers question: http://stackoverflow.com/q/23658848
has body: The way I solved this is rather straightforward, but poorly explained and documented on forums or message boards. OpenShift only allows ports between 15000 and 35530 to be bound by a user. However, when doing so the user must also specify the IP address of the host, otherwise localhost will be used, which is not allowed on OpenShift. The address of the server is located under the environment variable OPENSHIFT_JBOSSAS_IP (I am using JBoss AS 7.1, the variable might have a different name based on whatever technology is used). I found that out by logging into my application via SSH and running the env command. Once the program is started on OpenShift and the port bound to the correct IP address, the user has to forward the port in order to connect to it. This can be done either from eclipse or using the RHC tools. Port forwarding on OpenShift means that the bound port on the OpenShift server will be mapped to the same port on the localhost of the user. When writing the client program, the user has to connect to localhost:PORT instead of IP_ADDRESS_OF_OPENSHIFT_SERVER:PORT. This was something that took a while for me to understand. Once I got everything right, the client program ran without a problem.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23658848

http://stackoverflow.com/a/23718682
type: Answer
score: 0
has body: Try to call this.onLocationChanged(mCurrentLocation); before registering your listener requestLocationUpdates. I think, you are interrupting the callback after registering your listener.Also, please have a look on the explanatory graph, i think it might give an idea how these callbacks are working according to the precedences. this.onLocationChanged(mCurrentLocation); this.mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this); this.mCurrentLocation = this.mLocMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
accepted answer of: http://stackoverflow.com/q/23716065
answers question: http://stackoverflow.com/q/23716065
type: AcceptedAnswer

http://stackoverflow.com/comment/49425576
comment on: http://stackoverflow.com/a/25932709
has text: I think because this answer is slightly biased. " I'm very happy with it" Also, it doesn't answer the whole question. I still think this answer is useful, an answer is usually better than no answer.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36936296
has text: Have you considered using something like [this](http://www.jasypt.org/spring3.html)?
comment on: http://stackoverflow.com/q/23761089
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/23695282
has title: Error #1009 during flex alert or popup
answer count: 1
downvote count: 1
tagged with: flex-spark
favorite count: 0
has body: I am getting error #1009 in my flex project whenever I alert or popup something - TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.managers.marshalClasses::FocusManagerMarshalMixin/focusInHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.managers::FocusManager/focusInHandler() at flash.display::Stage/set focus() at mx.core::UIComponent/setFocus() at spark.components::RichEditableText/setFocus() at spark.components.supportClasses::SkinnableTextBase/setFocus() at Utils.LogUtils::Logger/ShowLogMessageWindow()[C:\Branch_Code\{XXXXXX - Hidden Path- XXXXXXXX}\Utils\LogUtils\Logger.as:49] at com.X.views::AppView/viewLogsButtonHandler()[C:\XXXXXXXXXXXXXXXXXXXXXXXXXX:996] at com.x.views::AppView/__idViewLog_click()[C:\XXXXXXXXXXXXXXXXXX.mxml:1433]
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36409685
upvote count: 0
tagged with: apache-flex
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23708439
accepted answer: http://stackoverflow.com/a/23708439
score: -1

http://stackoverflow.com/a/23702052
score: 0
has body: Every time you write a string with "..." it is either reused if the same string exists in string pool or new is created in string pool. And new keyword always creates new object on the heap. It's all very well explained in book Sun Sertified Java Developer 6 by Kathy Sierra.
type: Answer
answers question: http://stackoverflow.com/q/23701931

matrix
tags question: http://stackoverflow.com/q/23734393
tag name: matrix
tags question: http://stackoverflow.com/q/23744291
tags question: http://stackoverflow.com/q/23732809
tags question: http://stackoverflow.com/q/23719454
tags question: http://stackoverflow.com/q/23644314
type: Tag

http://stackoverflow.com/q/23624686
type: Question
tagged with: enums
has title: Declare constants inside of enum
answer count: 1
has body: I want to create an enum and declare several constants inside of it for inner usage... public enum SearchType { static final String TEXT = "text"; static final String BOOLEAN = "boolean"; STARTS_WITH(TEXT), ENDS_WITH(TEXT), CONTAINS(BOOLEAN), WILDCARD(TEXT), REGEXP(TEXT), RANGE(TEXT) private String searchType; private SearchType(String type) { searchType = type; } } unfortunately it can't be done this way. Best solution I've come up with so far is to declare a nested interface to store constants... public enum SearchType { STARTS_WITH(Categories.TEXT), ENDS_WITH(Categories.TEXT), CONTAINS(Categories.BOOLEAN), WILDCARD(Categories.TEXT), REGEXP(Categories.TEXT), RANGE(Categories.TEXT) interface Categories{ static final String TEXT = "text"; static final String BOOLEAN = "boolean"; } private String searchType; private SearchType(String type) { searchType = type; } } so I'm wondering if there is a better way to do so?
favorite count: 0
score: 8
accepted answer: http://stackoverflow.com/a/23624733
type: AnsweredQuestion
tagged with: constants
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23624733
upvote count: 8

http://stackoverflow.com/a/23665513
score: 1
has body: This happened because I had some libraries in my classpath that were not being modified as Maven dependencies, including older versions of the Selenium WebDriver libraries. To resolve it in IntelliJ I did the following: Go to File / Project Structure / Modules Find Selenium .jars that match the version I'm trying to get rid of Use the down arrow to demote these to a position below the WebDriver bindings I am trying to use
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23664751
type: Answer

http://stackoverflow.com/comment/36507850
comment on: http://stackoverflow.com/q/23745914
has text: what would be the best layout manager for this application?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23656321
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23656420
type: Question
linked to: http://stackoverflow.com/q/20053919
has answer: http://stackoverflow.com/a/23656420
tagged with: java
has title: How can I set the desktop pattern (background) in Android with my application (Java)?
tagged with: desktop
score: 0
answer count: 1
has body: I want my application (written in Java) to change the desktop pattern (background) in Android, after e.g. click on "change background to cats.png" button (in my application). And I want that change to be made constant. When somebody change the background with my application and then turn it off or un-install it, the cats.png will still be the background of the system (till user will change it manually). Also, I want to make it automatically - user press button => background of desktop being set (without any additional confirmations, fields, windows etc.)

http://stackoverflow.com/q/23677597
tagged with: java
has comment: http://stackoverflow.com/comment/36376103
type: Question
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/36376027
possible better answer: http://stackoverflow.com/a/23677739
has answer: http://stackoverflow.com/a/23677743
has answer: http://stackoverflow.com/a/23677739
has comment: http://stackoverflow.com/comment/36375909
downvote count: 1
has title: How to fix '<>' operator is not allowed for source level below 1.7 in 1.6?
favorite count: 0
has comment: http://stackoverflow.com/comment/36376136
tagged with: android
has answer: http://stackoverflow.com/a/23677784
accepted answer: http://stackoverflow.com/a/23677784
has answer: http://stackoverflow.com/a/23677757
answer count: 4
type: AnsweredQuestion
has body: I have a Java 1.6 Android project. I have a third-party code that does not compile: import org.springframework.http.HttpEntity; //... HttpHeaders requestHeaders = new HttpHeaders(); //... new HttpEntity&lt;&gt;(requestHeaders); It says: '&lt;>' operator is not allowed for source level below 1.7 I do not want to switch my project to 1.7. I have changed that line to new HttpEntity&lt;Object&gt;(requestHeaders); and it compiles fine now. But is my fix correct? What does Java 1.7 do with empty brackets? Update That new object is passed to function that accepts HttpEntity&lt;?&gt; argument. I understand the idea of type inference, but I do not understand what does 1.7 compiler infer from the given code line.

http://stackoverflow.com/comment/36472012
comment on: http://stackoverflow.com/q/23727659
has text: Yes, they are the randomizers, and I want the result to appear withing the ("") of the JOptionPane making it the "body text".
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36330346
has text: The "pool" of interned Strings is, in theory, collectable. There is a slight complication with regard to data synchronization, plus most interned Strings in "normal" circumstances are tied to loaded classes (which are mostly not collectable), so a JVM may or may not attempt to collect the pool in practice.
type: AnswerComment
comment on: http://stackoverflow.com/a/23653853
score: 0
type: Comment

http://stackoverflow.com/a/23622290
has body: try following strLinea = strLinea.trim().replaceAll("\\s"," "); String stArr[] = strLinea.split(" "); then use strArr for further as per your requirement. if you want it as list you can use Arrays.asList(strArr);
has comment: http://stackoverflow.com/comment/36268931
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/23622204
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23622204

http://stackoverflow.com/comment/36531534
type: AnswerComment
score: 0
type: Comment
has text: I did what you recommended but it throws the following exception. "A different object with same identifier was already associated with the session" I understand it is a problem with the session related to memory but I can not find it, I try to use the method clear () before persisting the object but did not work. Do not understand what I'm doing wrong.Thanks in advance
comment on: http://stackoverflow.com/a/23745376

http://stackoverflow.com/q/23646389
score: 8
has comment: http://stackoverflow.com/comment/36362344
has comment: http://stackoverflow.com/comment/36511821
tagged with: java
has comment: http://stackoverflow.com/comment/36362108
linked to: http://stackoverflow.com/q/3924079
has comment: http://stackoverflow.com/comment/36361659
has comment: http://stackoverflow.com/comment/36362137
has comment: http://stackoverflow.com/comment/36361904
type: Question
has comment: http://stackoverflow.com/comment/36315281
tagged with: transactions
tagged with: configuration
has comment: http://stackoverflow.com/comment/36315501
tagged with: hibernate
has answer: http://stackoverflow.com/a/23723996
has body: I recently upgraded the version of my Hibernate to 4.3.4.Final. Based on Contextual Sessions configuration of Hibernate this new version is not based on ThreadLocal anymore. If what I have got so far is correct do I need to do anything to make it more efficient? if it is incorrect what should I do? I have no clue. Please note it is mentioned in documentation that: Hibernate offers three methods of current session tracking. The "thread" based method is not intended for production use; it is merely useful for prototyping and tutorials such as this one. Hibernate.cfg.xml <hibernate-configuration> <session-factory> com.mysql.jdbc.Driver jdbc:mysql://localhost/myDB root org.hibernate.dialect.MySQLDialect thread org.hibernate.cache.NoCacheProvider true 5 20 300 50 3000 <mapping class="com.myProject.entities.users" /> ... Current Configuration and Code Based on answers blew and this part of documentation mu current configuration is as following: public class HibernateUtil { private static SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { Configuration configuration = new Configuration(); return configuration.configure() .buildSessionFactory( new StandardServiceRegistryBuilder() .applySettings(configuration.getProperties()) .build()); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } And the code would be as following final Session session = HibernateUtil.getSessionFactory().openSession(); try { final Transaction tx = session.beginTransaction(); try { ... Previous Configuration and Code public class HibernateUtil { private static ServiceRegistry serviceRegistry; private static final ThreadLocal<Session> threadLocal = new ThreadLocal(); private static SessionFactory sessionFactory; private static SessionFactory configureSessionFactory() { try { C…
has comment: http://stackoverflow.com/comment/36362313
answer count: 2
has answer: http://stackoverflow.com/a/23731652
has comment: http://stackoverflow.com/comment/36362031
downvote count: 0
has comment: http://stackoverflow.com/comment/36315460
tagged with: c3p0
has comment: http://stackoverflow.com/comment/36361852
has comment: http://stackoverflow.com/comment/36362128
favorite count: 0
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36362085
has comment: http://stackoverflow.com/comment/36361836
has title: How to configure and get session in Hibernate 4.3.4.Final?

http://stackoverflow.com/q/23739718
has answer: http://stackoverflow.com/a/40218018
upvote count: 8
accepted answer: http://stackoverflow.com/a/40218018
type: Question
tagged with: jodatime
answer count: 2
has title: Getting nominative month name in jodaTime
favorite count: 0
has answer: http://stackoverflow.com/a/25471075
score: 8
linked to: http://stackoverflow.com/q/17188316
has body: I need to get month name according to it's number in different Locales. To do this I create a DateTime (or YearMonth, doesn't matter) Object and get its monthOfYear Property: YearMonth md = new YearMonth(1992, month); System.out.println(md.monthOfYear().getAsText(new Locale("ru"))); The thing is that works fine for English language, because Nominative and Genitive names are the same, but for other languages it returns only Genitive, which is not what I need. How to get Nominative month name?
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/25471075
tagged with: java

http://stackoverflow.com/a/23725527
has body: You're attempting to access an entry that doesn't exist according to the key type of your map (that is, you're attempting to find a String key when passing in an Integer. Internally, the map is attempting to cast what you passed in as the key you're searching on to match the key the map is defined to accept. A String can't cast to an Integer, hence your exception. It seems like you just want to iterate over the contents of your map. That can be accomplished with an entrySet(): for(Map.Entry&lt;String, Enclavement&gt; entry : a_enclavement.entrySet()) { modify(entry.getValue()); } A Map.Entry&lt;K, V&gt; is a representation of each of your map's key-value pairs, for convenient iteration. If you want to do an operation on all of the keys, or all of the values of your map, then this would be the object you want to get from your map (as in, a_enclavement.entrySet()).
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23725479

http://stackoverflow.com/comment/36420186
score: 0
has text: @PeterLawrey That's interesting to know.
type: QuestionComment
comment on: http://stackoverflow.com/q/23700112
type: Comment

http://stackoverflow.com/a/23728810
score: 1
has body: It is really not clear why you are encountering an error without any code, but if you use a Scanner and use the next() method, you will get whitespace ignored for free. String current; Scanner in = new Scaner(new File("MyFileName")); while(in.hasNext()){ current = in.next(); // Process the current String //... }
answers question: http://stackoverflow.com/q/23728778
downvote count: 0
type: Answer
upvote count: 1

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/23731605
tags question: http://stackoverflow.com/q/23724249
tags question: http://stackoverflow.com/q/23617590
tags question: http://stackoverflow.com/q/23730834
tags question: http://stackoverflow.com/q/23765287
tags question: http://stackoverflow.com/q/23640858
tags question: http://stackoverflow.com/q/23642582
tags question: http://stackoverflow.com/q/23735683
tags question: http://stackoverflow.com/q/23684083
tags question: http://stackoverflow.com/q/23723262
tags question: http://stackoverflow.com/q/23629663
tags question: http://stackoverflow.com/q/23719546
tags question: http://stackoverflow.com/q/23762876
tags question: http://stackoverflow.com/q/23761904
tags question: http://stackoverflow.com/q/23701639
type: Tag
tags question: http://stackoverflow.com/q/23736441
tags question: http://stackoverflow.com/q/23734795
tags question: http://stackoverflow.com/q/23634389
tags question: http://stackoverflow.com/q/23720103

http://stackoverflow.com/comment/36304028
type: Comment
type: QuestionComment
has text: Maybe `java -version` gives java 6 (1.6) on the command line, as try-with-resources is new in java 7.
comment on: http://stackoverflow.com/q/23640196
score: 0

http://stackoverflow.com/a/23659740
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36342342
has comment: http://stackoverflow.com/comment/36342523
has comment: http://stackoverflow.com/comment/36342508
answers question: http://stackoverflow.com/q/23659645
type: Answer
has comment: http://stackoverflow.com/comment/36346214
score: 1
has body: They're all correct, since they're all subclasses of A.
has comment: http://stackoverflow.com/comment/36343045

http://stackoverflow.com/q/23690162
has body: I have implemented a NavigationDrawer in my application. I would like to know how I can add a vertical shadow effect which is below the main Fragment, similar to the picture below. I have one image on my drawable with the shadow image. It's called "drawer_shadow.9" but I don't know how I can implement this inside my NavigationDrawer.
has answer: http://stackoverflow.com/a/23690810
accepted answer: http://stackoverflow.com/a/23690810
tagged with: android
upvote count: 15
type: AnsweredQuestion
has title: Android: Navigation Drawer vertical shadow
score: 13
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/37375720
tagged with: java
tagged with: shadow
possible better answer: http://stackoverflow.com/a/37375720
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/50817650
has comment: http://stackoverflow.com/comment/50804145
has comment: http://stackoverflow.com/comment/36400808
favorite count: 0

http://stackoverflow.com/comment/40443592
has text: Ok, I solved it now - see my answer in the link of my comment above.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23756988

http://stackoverflow.com/a/23769676
score: 1
accepted answer of: http://stackoverflow.com/q/23762702
has body: See javadoc: java.lang.String getAuthType() Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic, form and client certificate authentication, and may additionally support digest authentication. If the servlet is not authenticated null is returned. Same as the value of the CGI variable AUTH_TYPE. Returns: one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) or the container-specific string indicating the authentication scheme, or null if the request was not authenticated.
answers question: http://stackoverflow.com/q/23762702
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/23659408
accepted answer: http://stackoverflow.com/a/23674269
has comment: http://stackoverflow.com/comment/36351172
has answer: http://stackoverflow.com/a/23674269
has comment: http://stackoverflow.com/comment/36343781
linked to: http://stackoverflow.com/q/1924136
has comment: http://stackoverflow.com/comment/36340822
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7054972
has comment: http://stackoverflow.com/comment/36348642
score: 1
has comment: http://stackoverflow.com/comment/36343263
tagged with: java
tagged with: eclipse
type: Question
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/36341762
favorite count: 0
upvote count: 3
has body: I am using junit's TemporaryFolder to test part of my application that deals with the filesystem. Is it possible to set the junit variable java.io.tmpdir to an Environment variable in the run configuration?
has comment: http://stackoverflow.com/comment/36375862
has title: How to set the location of junit TemporaryFolder to an environment variable
has comment: http://stackoverflow.com/comment/36348330

http://stackoverflow.com/a/24556763
type: Answer
answers question: http://stackoverflow.com/q/23752398
score: 0
has body: You need create firts app engine project, then in that prject generate the library for you cliens.

http://stackoverflow.com/q/23663488
has comment: http://stackoverflow.com/comment/36349719
linked to: http://stackoverflow.com/q/8563592
duplicate of: http://stackoverflow.com/q/8563592
has comment: http://stackoverflow.com/comment/36349198
upvote count: 2
has comment: http://stackoverflow.com/comment/36361670
tagged with: java
tagged with: hibernate
tagged with: annotations
has body: When I'm trying to apply @OnDelete(action=OnDeleteAction.CASCADE) and generate tables with hibernate nothing happens. With attribute OrhpanRemoval=true hibernate generates tables, but still refuses to cascade delete entities. Table itself joined to another table with @OneToMany annotation. The tables are bellow: @Entity @Table(name = "Style") public class Style { public Style() { } public Style(String nameRus, String nameEng) { this.nameRus = nameRus; this.nameEng = nameEng; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "style_id") private Long id; @Column(name = "Style_Name_rus", nullable = false) private String nameRus; @Column(name = "Style_Name_eng", nullable = false) private String nameEng; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinTable(name = "Styles_Songs", joinColumns = @JoinColumn(name = "style_id"), inverseJoinColumns = @JoinColumn(name = "song_id")) @OnDelete(action=OnDeleteAction.CASCADE) private Set&lt;Song&gt; songs; public Set&lt;Song&gt; getSongs() { return songs; } public void setSongs(Set&lt;Song&gt; songs) { this.songs = songs; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNameRus() { return nameRus; } public void setNameRus(String nameRus) { this.nameRus = nameRus; } public String getNameEng() { return nameEng; } public void setNameEng(String nameEng) { this.nameEng = nameEng; } @Override public String toString() { return this.nameRus; } } Table #2: @Entity @Table(name = "Song") public class Song { public Song() { } public Song(String name, String performer, String trackLength, Style style, User user) { this.name = name; this.performer = performer; this.style = style; this.trackLength = trackLength; this.user = user; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "song_id") private Long id; @Column(name = "Song_name", nullable=false) private String name; @Column(name = "Performer", nullable=false) private String per…
has comment: http://stackoverflow.com/comment/36349543
has comment: http://stackoverflow.com/comment/36358360
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36349256
score: 2
tagged with: jpa
answer count: 0
downvote count: 0
favorite count: 0
tagged with: postgresql
has title: Hibernate refuses to generate tables with OnDelete annotation
type: Question

http://stackoverflow.com/a/23635195
has comment: http://stackoverflow.com/comment/36293486
has comment: http://stackoverflow.com/comment/36293245
has comment: http://stackoverflow.com/comment/36294022
has comment: http://stackoverflow.com/comment/36294959
upvote count: 2
has comment: http://stackoverflow.com/comment/36294233
has body: Test like this: try{ setUp(); /* do some testing*/ }catch(Exception ex){ /* do something with the exception */ /* let the test fail */ }finally{ tearDown(); } It's probably the easiest solution for your problem, but from the viewpoint of good design practice this should be avoided. edit: There are annotations in jUnit: Different teardown for each @Test in jUnit edit2: The setUp() method is invoked before every test. You use it to initialize variables and clean up from previous tests. You can also use the JUnit tearDown() method, which runs after every test method. The tutorial does not use it. http://developer.android.com/tools/testing/activity_test.html If you have different tearDown() Methods for each test, I think you need to change them.
type: Answer
answers question: http://stackoverflow.com/q/23634993
score: 2
downvote count: 0

image
tags question: http://stackoverflow.com/q/23671353
tags question: http://stackoverflow.com/q/23651792
tags question: http://stackoverflow.com/q/23638552
tags question: http://stackoverflow.com/q/23707736
tags question: http://stackoverflow.com/q/23688127
tags question: http://stackoverflow.com/q/23677098
tags question: http://stackoverflow.com/q/23626488
tags question: http://stackoverflow.com/q/23616540
tags question: http://stackoverflow.com/q/23711939
tags question: http://stackoverflow.com/q/23701232
tags question: http://stackoverflow.com/q/23652511
tags question: http://stackoverflow.com/q/23626154
tags question: http://stackoverflow.com/q/23717634
tags question: http://stackoverflow.com/q/23700297
tags question: http://stackoverflow.com/q/23631228
tags question: http://stackoverflow.com/q/23720248
tags question: http://stackoverflow.com/q/23759223
tags question: http://stackoverflow.com/q/23656615
tags question: http://stackoverflow.com/q/23628914
tags question: http://stackoverflow.com/q/23723518
tags question: http://stackoverflow.com/q/23668508
tags question: http://stackoverflow.com/q/23734939
tags question: http://stackoverflow.com/q/23640383
tags question: http://stackoverflow.com/q/23722081
tags question: http://stackoverflow.com/q/23711664
tags question: http://stackoverflow.com/q/23690425
tags question: http://stackoverflow.com/q/23713397
tags question: http://stackoverflow.com/q/23625167
tags question: http://stackoverflow.com/q/23717056
tags question: http://stackoverflow.com/q/23762528
tags question: http://stackoverflow.com/q/23728761
tags question: http://stackoverflow.com/q/23715620
tags question: http://stackoverflow.com/q/23626633
tags question: http://stackoverflow.com/q/23758356
tags question: http://stackoverflow.com/q/23686177
tag name: image
tags question: http://stackoverflow.com/q/23766311
tags question: http://stackoverflow.com/q/23721943
tags question: http://stackoverflow.com/q/23745577
tags question: http://stackoverflow.com/q/23689580
tags question: http://stackoverflow.com/q/23748085
type: Tag
tags question: http://stackoverflow.com/q/23691544
tags question: http://stackoverflow.com/q/23744467
tags question: http://stackoverflow.com/q/23698092
tags question: http://stackoverflow.com/q/23745448
tags question: http://stackoverflow.com/q/23706492
tags question: http://stackoverflow.com/q/23717571
tags question: http://stackoverflow.com/q/23765562

http://stackoverflow.com/a/23622368
has comment: http://stackoverflow.com/comment/36268976
upvote count: 0
answers question: http://stackoverflow.com/q/23621899
has body: Support for Japanese in fonts is spotty, and different between AWT and Swing components. Those funny blobs probably mean you are using a font/component combination that doesn't have japanese glyphs. Another possibility is if you've been manipulating the characters of the string, by passing them through byte arrays or integers, it's easy to accidentally lose high order bits. There are several deprecated APIs because of this hazard.
has comment: http://stackoverflow.com/comment/36300507
has comment: http://stackoverflow.com/comment/36296571
type: Answer
score: -1
downvote count: 1

http://stackoverflow.com/comment/36261977
comment on: http://stackoverflow.com/q/23618816
type: Comment
type: QuestionComment
has text: @SJuan76: It really *is* important. The OP wants to call the method in the enclosing class. It's not well expressed in the title, but the body is reasonably clear.
score: 1

http://stackoverflow.com/comment/36393635
comment on: http://stackoverflow.com/q/23685602
has text: Also, whoever gave the 1 vote for the question to be closed, it would be great if you also commented why you think the question should be closed and I can see if I can alleviate your concerns and improve the question. It is more helpful for the community.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36488227
has text: Why do you care if zero is being appended?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23735181
score: 0

http://stackoverflow.com/comment/36388056
score: 1
has text: He is using OpenBD, not ColdFusion. That could be the reason for not using `cfdocument`. Also, I would argue that `cfdocument` is not the easiest way to create properly formatted PDFs. @anarchos check out http://wkhtmltopdf.org/ easy to use and apply formatting.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23683732

http://stackoverflow.com/comment/36526401
type: AnswerComment
type: Comment
has text: MacOS uses `\r` as line separator, please fix regex with `\r|\n|\r\n`
comment on: http://stackoverflow.com/a/23756541
score: 0

http://stackoverflow.com/comment/36428550
has text: when i input 1 or 2 when the code asks for display options..
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23705191

stack-overflow
tags question: http://stackoverflow.com/q/23638519
tags question: http://stackoverflow.com/q/23745658
tag name: stack-overflow
tags question: http://stackoverflow.com/q/23758589
type: Tag
tags question: http://stackoverflow.com/q/23692589

http://stackoverflow.com/q/23635720
score: 0
has comment: http://stackoverflow.com/comment/36294395
tagged with: java
accepted answer: http://stackoverflow.com/a/23635988
has comment: http://stackoverflow.com/comment/36294640
type: Question
linked to: http://stackoverflow.com/q/3209901
has comment: http://stackoverflow.com/comment/36294853
answer count: 1
has body: HELLO I made a video plays on a panel and I get the video's url by this : URL urlWaterIntake = new URL("file:///c:/tmp/water.avi"); BUT I moved the 'tmp' folder inside the 'bin' folder of eclipse IDE , and now i access by this : URL urlWaterIntake = new URL("file:///tmp/water.avi"); AND ERRORR !!! voila !! what a life ... , some solutions ?? btw i tried this one too : File myFile = new File("tmp/water.avi"); URL urlWaterIntake = new URL(myFile.toURI().toURL()); BUT NOTHING WORKS.....
has answer: http://stackoverflow.com/a/23635988
has comment: http://stackoverflow.com/comment/36294667
has title: Difficult on accessing a video's directory
type: AnsweredQuestion

http://stackoverflow.com/comment/36430916
score: 0
type: AnswerComment
type: Comment
has text: How did you guys know the full file name? I've never provided that
comment on: http://stackoverflow.com/a/23706453

http://stackoverflow.com/comment/36697835
has text: If you can't see where the problem is just comment out code until it compiles. That will give you a clue where to look.
comment on: http://stackoverflow.com/q/23743591
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36531195
comment on: http://stackoverflow.com/a/23758657
score: 0
type: AnswerComment
type: Comment
has text: I worked it out, i had to import HashSet "import java.util.HashSet;" Thanks

http://stackoverflow.com/comment/36470270
has text: It looks like you're asking this before reading up on use of layout managers -- why?
comment on: http://stackoverflow.com/q/23726935
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36516932
has text: The colour replacement is exactly what I'm doing, and I have the exact same code as you, and it doesn't work for me. Not sure what's going on here...
score: 0
comment on: http://stackoverflow.com/a/23751541
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/36365792
has text: create a new URLClassLoader (or a custom subclass) with the new URL in the constructor arguments. Use that loader to load some anchor for your app, and anything from there down (if you do nothing else to break the chain) will have the same classpath.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23672116
type: Comment

http://stackoverflow.com/q/23637496
tagged with: session
tagged with: java
tagged with: struts2
has body: I want to access a session attribute from some actions that implement the SessionAware interface; I want to perform some test according to the type of the user logged in, the information which it relates are stored in the attributes of the session, I can get this attribute in my JSP page with the following code: &lt;s:property value="%{#session['attribute']}"/&gt; My LoginAction: public class LoginAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 1L; private String userName; private String password; private Map&lt;String, Object&gt; session; private Service service; Utilisateur user; // ---------------------------- Log Out register user public String logOut() { session.remove("loginId"); session.clear(); addActionMessage("You Have Been Successfully Logged Out"); return SUCCESS; } // ---------------------------- Login register user public String loginRegisterUser() { service = new ServiceImpl(); user = service.checkUsernamePassword(userName, password); if (user != null) { session.put("loginId", userName); session.put("mdp", password); session.put("role", user.getRole().getRole()); return "success"; } else { addActionError("Please Enter Valid emailId or Password"); return LOGIN; } } public void setSession(Map&lt;String, Object&gt; map) { this.session = map; } How can I get them in my action classes ? EDIT : I try to get it from other action with this code : public class GestionMissions extends ActionSupport implements SessionAware, ModelDriven { private Map&lt;String, Object&gt; session; @Override public void setSession(Map&lt;String, Object&gt; s) { this.session = s; } public String getsession() { String test; test = (String) session.get("loginId"); System.out.println(test); return "success"; }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23637625
type: Question
has title: sessionAware : How can I get session attribute from action
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23637625

http://stackoverflow.com/comment/36543245
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23737038
has text: yes dear Robert, but I think this is more clear to understand :)

http://stackoverflow.com/comment/36508900
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23747437
has text: its like searching a short simple answer to "how a computer work"
type: Comment

http://stackoverflow.com/comment/36261462
comment on: http://stackoverflow.com/q/23618298
has text: it is doesn't compatibility with **The signature of a method m1 is a subsignature of the signature of a method m2 if either: m2 has the same signature as m1, or the signature of m1 is the same as the erasure (§4.6) of the signature of m2.**
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23701345
answers question: http://stackoverflow.com/q/23701051
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36420610
has comment: http://stackoverflow.com/comment/36420585
upvote count: 1
has comment: http://stackoverflow.com/comment/36421496
has body: The problem is here: for (int a = 1; a &lt;= 2 * diamondSize - 1; a++) { if (a == i || a == 0) { System.out.print("\\"); for (int n = 1; n &lt; a * 2; n++) { System.out.print(" "); } System.out.print("/"); System.out.println(); } } You are adding spaces after the "\" and before the "/". However, you need to place hald the spaces before the "\" and half after. I've tried to bugfix it but I can't really make head or tail out of your many nested blocks and stuff, but I'm sure you can figure this one out. Sorry about that.
type: Answer

http://stackoverflow.com/a/23702075
has comment: http://stackoverflow.com/comment/36422211
answers question: http://stackoverflow.com/q/23702038
upvote count: 4
downvote count: 0
has body: Arrays are always modifiable (except for zero-size array, as stated in the comment), you should use Collections.unmodifiableList here. For example: public final static List&lt;Move&gt; ALL = Collections.unmodifiableList(Arrays.asList(NW, N, NE, E, SE, S, SW, W));
type: Answer
score: 4

http://stackoverflow.com/comment/36445587
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23713732
has text: edited question with the web.xml entry

http://stackoverflow.com/comment/36427689
score: 1
type: AnswerComment
type: Comment
has text: @Braj you will get it if you pass `Transformation` because it's an abstract class. You should pass a child of `Transformation` like `MyTransformation` as provided in OP's code.
comment on: http://stackoverflow.com/a/23704705

http://stackoverflow.com/a/23699283
accepted answer of: http://stackoverflow.com/q/23698936
has body: There is a related question here. The answer posted by Peter Lawrey states it outright: There is no way to pass the argument when starting the .jar by double-clicking. However, there are alternatives: The double click starts a wrapper program which then starts your program with the parameter (as suggested in the linked answer). Create a script file that launches your application. Create a proper OSX application instead.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23698936
type: Answer
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/23780774
has body: It depends on which information you want to extract. In principle, you can detect loops by searching for backward branches. A loop can’t work without and with usual code structures you won’t find backward branches which are not part of a loop. So if you want to have them named explicitly, all of the bytecode instructions goto, goto_w, if_acmpeq, if_acmpne, if_icmpeq, if_icmpge, if_icmpgt, if_icmple, if_icmplt, if_icmpne, ifeq, ifge, ifgt, ifle, iflt, ifne, ifnonnull, ifnull may indicate a loop if they point backwards. But in most cases you will have a hard time telling what kind of loop you have. There is no significant difference between a for loop and a while loop in the compiled code. E.g., the following code fragments are entirely equivalent: for(a();b();c()) { d(); } a(); for(;b();) { d(); c(); } a(); for(;;) { if(!b()) break; d(); c(); } a(); while(b()) { d(); c(); } It will become even worse with more complicated structure, e.g. when you want to find out whether two backward branches pointing to the same code location belong to a single loop with a conditional continue statement within the body or to two nested loops. It can turn out to be impossible.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23775476
downvote count: 0

http://stackoverflow.com/comment/36313525
type: Comment
has text: HI James, Thanks for your suggestion. But DataAcessException does not have the Error codes. Thats why concern.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23645277

http://stackoverflow.com/a/28626206
type: Answer
has body: i see that you have a 32bits JDK version for the JDK 1.8 and a 64bits version for the JDK 1.7 i you running your project on a 64bits machine try to use the 64bits version of JDK 1.8 Note: you must have a 64bits version for eclipse too
answers question: http://stackoverflow.com/q/23624038
score: 0

http://stackoverflow.com/comment/36373653
type: QuestionComment
comment on: http://stackoverflow.com/q/23676192
has text: thanks again for your answer ! Actually, I tried this but I can't hide the task bar with a JFrame, and I really need to cover all the screen.. If there's a way to create a fullscreen with a JFrame I'll do your technique
score: 0
type: Comment

http://stackoverflow.com/q/23674624
has body: I'm looking at the docs for the IntStream, and I see an toArray method, but no way to go directly to a List&lt;Integer&gt; Surely there is a way to convert a Stream to a List?
downvote count: 0
has comment: http://stackoverflow.com/comment/86827363
has answer: http://stackoverflow.com/a/59824536
tagged with: java
has answer: http://stackoverflow.com/a/40015936
has comment: http://stackoverflow.com/comment/36370139
upvote count: 414
type: Question
has answer: http://stackoverflow.com/a/36242338
has title: How do I convert a Java 8 IntStream to a List?
has answer: http://stackoverflow.com/a/55627600
possible better answer: http://stackoverflow.com/a/40015936
score: 414
favorite count: 0
has answer: http://stackoverflow.com/a/23674719
accepted answer: http://stackoverflow.com/a/23674719
linked to: http://stackoverflow.com/q/14830313
answer count: 5
tagged with: java-8
type: AnsweredQuestion

http://stackoverflow.com/comment/36312823
score: 0
type: AnswerComment
type: Comment
has text: This answers half of the un-researched and easily answerable question.
comment on: http://stackoverflow.com/a/23644957

http://stackoverflow.com/comment/36358040
type: QuestionComment
type: Comment
has text: This is a *terrible* use of enums :|
score: 2
comment on: http://stackoverflow.com/q/23667888

http://stackoverflow.com/comment/36444754
comment on: http://stackoverflow.com/a/23713920
has text: Cool. Both are problems, though. Getting the regex right is important. All too often I see patterns that are underconstrained and declared to "work"; but if a pattern is over-inclusive, declaring that it "works" is really inappropriate.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36447143
has text: what expections you got now.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23715195

http://stackoverflow.com/comment/36488569
type: QuestionComment
has text: i think `190520141618013381` value is in integer form, but not in integer rang
comment on: http://stackoverflow.com/q/23736772
score: 0
type: Comment

http://stackoverflow.com/comment/36482872
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23733737
type: Comment
has text: This answer would be better if you told us what the `\b` actually means.

http://stackoverflow.com/comment/36326102
type: QuestionComment
comment on: http://stackoverflow.com/q/23651751
score: 0
type: Comment
has text: try to change `getSelectedItem` to `getSelectedObjects`, this returns you list of selected objects

http://stackoverflow.com/comment/36460754
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23721990
score: 0
has text: Thanks. But then again, can I enquire why I cannot use onClickListener just like how we do for calculator?

http://stackoverflow.com/comment/36309520
type: Comment
has text: Do not just magically make up numbers to fill in as parameters to methods. The value should be `R.xml.data`, if your file is `res/xml/data.xml`.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23642810

http://stackoverflow.com/comment/36466570
type: AnswerComment
has text: Thanks bro, the more I study Java, the more I love the old school friend `C`.
type: Comment
comment on: http://stackoverflow.com/a/23715189
score: 0

http://stackoverflow.com/a/25015811
score: 0
type: Answer
has body: I tried to implement it in Gradle but I couldn't get it to work reliably on windows. If the options file has this: -header 'this is\ a test which should fail' It works nicely on linux/mac but fails on windows (tried on win7/java7 and some other windows+java6). I've tried with vanilla javadoc executable (without Gradle). I'll get the fix into Gradle and it will work out of the box for linux/mac but not quite for windows. If you want to help out with windows support catch us at http://issues.gradle.org/browse/GRADLE-3099
answers question: http://stackoverflow.com/q/23763534
has comment: http://stackoverflow.com/comment/38946765

http://stackoverflow.com/comment/36322959
type: Comment
comment on: http://stackoverflow.com/a/23648043
has text: Ok, both my suggestion will do the work (Role is independent class and can be easy extended by this "action logic" you talk about). What about the Access concept? Do you need some extra info here?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23728879
upvote count: 2
has body: Your question is still anemic on details, and you still haven't posted the actual runnable example that demonstrates your problem, but your post: So im trying to place an Image as the background for a JLabel. Ive tried using: public void paintComponent(Graphics g){ super.paintComponent(g); } but the super.paintComponent(g) part seems to give an error. suggests that this code is not placed inside of a class that extends JPanel or JComponent. Suggestions: Put that method inside of a class that extends JPanel. Place an @Override annotation above your method to make sure that you are in fact overriding the method correctly. Put code in that method to get the Graphics object, g, to draw your image. I'd call g.drawImage(...) after the super call. Note that the paintComponent(Graphics g) method should be declared protected not public. Re-read the examples of this sort of code on this site and in the tutorials. Your review of the information is not being done very carefully since you're missing a lot. If these suggestions still don't help, then again, create and post your runnable example that demonstrates your problem.
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23728761

http://stackoverflow.com/comment/36510513
has text: I don't think it would compile with "}" to be honest.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23748242

http://stackoverflow.com/q/23639100
answer count: 1
favorite count: 0
score: -1
tagged with: static
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36301718
has body: I'm currently working on a small project in Java. I am doing a 2D Minecraft game and want to add tiles/blocks to the map. I know how to add blocks and stuff that are static to make them all render with only one sprite, but if I want to add a block, let's say a sapling, I want to update it all the time, but that seems to be impossible when it is static without making every other sapling doing the exact same thing... So I am wondering if there is a way to make the block update by itself but still only render it with one sprite?
tagged with: 2d
tagged with: java
has title: How do I update static objects separately?
tagged with: render
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23639351
upvote count: 0

http://stackoverflow.com/comment/36443738
type: Comment
type: QuestionComment
has text: You're not passing an Integer instance. You're passing a reference to the method Integer.compareTo(). That's quite different.
comment on: http://stackoverflow.com/q/23712248
score: 0

http://stackoverflow.com/a/23932205
answers question: http://stackoverflow.com/q/23744256
has body: You can use an adapter inside another adapter. I have used this approach in a dummy project. I put the following code as a starting point. class Category{ List&lt;Expense&gt; expenseList; } //this adapter will be used in Activity class CategoryAdapter extends ArrayAdapter&lt;Category&gt;{ //your other adapter code here ArrayAdapter&lt;Expense&gt; expenseAdtr =new ExpenseAdapter(context, category.getExpenseList()); expenseListView.setAdapter(expenseAdtr ); expenseListView.setOnClickListner(....); } //this adapter will be used inside CategoryAdapter class ExpenseAdapter extends ArrayAdapter&lt;Expense&gt;{ //your adapter code here, should have no issue here } class MyActivity extends Activity{ //somewhere onCreate or ..... List&lt;Category&gt; categoryList; ArrayAdapter&lt;Category&gt; categoryAdtr =new CategoryAdapter(context, categoryList); expenseListView.setAdapter(categoryAdtr); }
score: 0
type: Answer

http://stackoverflow.com/a/23697932
score: 1
has body: The Problem is your list is of type List&lt;Product&gt;, but product does not implement the Comparable interface, therefore this type does not implement the method. Make public interface Product extends Comparable&lt;Product&gt; { public abstract String getName(); public abstract double getCost(); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36413959
accepted answer of: http://stackoverflow.com/q/23697869
answers question: http://stackoverflow.com/q/23697869
type: Answer
upvote count: 1

http://stackoverflow.com/comment/36428317
type: Comment
type: QuestionComment
has text: "Nearly accurate" and "accurate" mean opposite things.
score: 5
comment on: http://stackoverflow.com/q/23705140

http://stackoverflow.com/a/23708580
answers question: http://stackoverflow.com/q/23708323
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Try letting your JList know what kind of data it is intended to hold, something like: JList&lt;String&gt; list = new JList&lt;String&gt;(); or JList&lt;String&gt; list = new JList&lt;&gt;(); depending on your version of Java. As far as current resources on Java, try the good ol' Java Tutorial. I'll hazard a guess and say that your book may predate Java 1.5, which introduced the first of a number of big changes over the next couple of versions, including: SwingFX, Generics (which is what you ran into), JDBC, File I/O... just to name a few things off the top of my head. Your book should probably be repurposed as a doorstop at this point. I'd recommend using the tutorial until you hit a specialized area of interest that warrants another book -- the tutorial really is quite good.

http://stackoverflow.com/comment/36388232
type: AnswerComment
score: 0
type: Comment
has text: Instead of "reproducing", say "demonstrating". It's easy to set up a data race. You can find lots of examples in literature and on the web. The hard part is demonstrating that the outcome of the race is not always the same. When I had to demonstrate a data race in my company's production code, I ran the experiment ten million times, and it only came out the wrong way less than one hundred times.
comment on: http://stackoverflow.com/a/23683826

http://stackoverflow.com/q/23619936
has comment: http://stackoverflow.com/comment/36264248
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23623131
linked to: http://stackoverflow.com/q/7783919
has title: Not seeing a static class variable changing from another class in the same package running in a separate thread
favorite count: 0
has comment: http://stackoverflow.com/comment/36264229
has answer: http://stackoverflow.com/a/23669724
accepted answer: http://stackoverflow.com/a/23669724
linked to: http://stackoverflow.com/q/2423622
has body: I have a GUI class that, upon a button press, assigns a value to a private static class variable, -- let's call it strX. The constructor of class GUI also instantiates a subclass (in the same package). This subclass implements Runnable, and starts a thread. There is an infinite loop in the thread which keeps querying the value of strX until it is no longer null. The querying is done by calling a getter method in the GUI class. I notice that even after I have pressed the button and set strX to some non-null value, the querying in the subclass produces only null. I am new to Java, and I am beginning to wonder if my understanding is flawed. I've read Java: cannot access static variable from a different class in the same package and its 4 answers, which address a situation having to do with a clash of variable names. My situation is certainly not this. All I am trying to do is to use a getter method to obtain a class variable from a subclass. Please let me know if any aspect of my question needs clarification. I would post the code, but it is long and will probably add to the confusion. Follow-up Okay, first of all, I'd like to thank Darren Gilroy for his detailed answer and code snippet. That cleared up some confusion in my mind, but I still had problems. So I decided to create a simple stripped-down version of my code for clarity and started testing it. This simple GUI class has two buttons, one called 'Only Instantiate', and the other called 'Set Value and Instantiate'. When you push the 'Only Instantiate', it creates an instance of another class called PeekAtGUI. Inside PeekAtGUI, a thread is started. The thread invokes a static getter method of GUI to obtain the current value of a static class variable strX in GUI. When you push the 'Set value and Instantiate' button, it first sets the value of strX to a new value, and then instantiates PeekAtGUI. Please note that as I am debugging, I comment out one or other of these instantiations. Here is the bottomline- When I …
tagged with: multithreading
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23623131
has comment: http://stackoverflow.com/comment/36330607
tagged with: java
has comment: http://stackoverflow.com/comment/36270083
type: Question
has answer: http://stackoverflow.com/a/23623517

http://stackoverflow.com/a/39002236
answers question: http://stackoverflow.com/q/23618628
score: 0
type: Answer
has body: If you're using SYS V init scripts and running in a container such a Tomcat, DON'T start the script directly with: sudo /etc/init.d/tomcat7 start That will start it without a clean environment. Instead, use the service command: sudo /sbin/service tomcat7 start

http://stackoverflow.com/a/23674284
type: Answer
answers question: http://stackoverflow.com/q/23674236
score: 1
has body: reolace your code with public class Money { String girl ; **Money mon = new Money();** mon.girl = "Isabel" ; //I want to do that (here is basic part) but... //..I get Null Pointer Exception } It was due to not initializing the object Money mon .
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/23623240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36271678
has body: could we convert microsoft office documents(doc, docx, ppt, pptx, xls, xlsx, etc.) in to html string in Android. i need to show office documents in my app. i have searched and found docx4j, apache poi and http://angelozerr.wordpress.com/2012/12/06/how-to-convert-docxodt-to-pdfhtml-with-java/ to convert files in html. this approach is working fine in desktop version. but when using in android i am getting "Unable to convert in Dalvik format error 1". which is may be due to using too much jars in my android project. i want to know is there a single way from which i convert office document to html in android. sorry for english. EDIT i am now able to convert doc to html using apache poi. here is method public void showsimpleWord() { File file = new File("/sdcard/test.doc"); HWPFDocumentCore wordDocument = null; try { wordDocument = WordToHtmlUtils.loadDoc(new FileInputStream(file)); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } WordToHtmlConverter wordToHtmlConverter = null; try { wordToHtmlConverter = new WordToHtmlConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument()); wordToHtmlConverter.processDocument(wordDocument); org.w3c.dom.Document htmlDocument = wordToHtmlConverter .getDocument(); ByteArrayOutputStream out = new ByteArrayOutputStream(); DOMSource domSource = new DOMSource(htmlDocument); StreamResult streamResult = new StreamResult(out); TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty(OutputKeys.METHOD, "html"); serializer.transform(domSource, streamResult); out.close(); String result = new String(out.toByteArray()); System.out.println(result); ((WebView) findViewById(R.id.webview)).loadData(result, "text/html", "utf-8"); } catch (Exception e) { e.printStackTrace(); } } now searching for others.
has title: How to convert office documents into html in android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36282932
tagged with: docx4j
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36271578
linked to: http://stackoverflow.com/q/8493507
score: 6
has answer: http://stackoverflow.com/a/25252319
has comment: http://stackoverflow.com/comment/36271447
tagged with: android
has comment: http://stackoverflow.com/comment/36271544
upvote count: 6
has comment: http://stackoverflow.com/comment/36849914
favorite count: 0
tagged with: apache-poi

http://stackoverflow.com/q/23700826
accepted answer: http://stackoverflow.com/a/23740299
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36423462
tagged with: persistence
has answer: http://stackoverflow.com/a/23740299
answer count: 1
tagged with: persistence-unit
has comment: http://stackoverflow.com/comment/36494322
has comment: http://stackoverflow.com/comment/36494246
has body: Question : When and how do the JDBC tables get created ? Cause the wierd thing is that i can't find any User tabel. I find it wierd that there is a tabel for the many-on-many relationship between User and Dish yet there is no User tabel to store the name and password of this user. Structure: User : String name String password List<Dish> shoppingList Ingrediënt : String name IngredientQuantity : Ingredient ingredient Quantity quantity Quantity : int quantity String unit Dish : String name int people Collection<IngredientQuantity> ingredients JDBC: Persistence Unit: org.eclipse.persistence.jpa.PersistenceProvider domain.Dish domain.Ingredient domain.User <property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/ShoppingCalendarDB"/> <property name="javax.persistence.jdbc.password" value="app"/> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/> <property name="javax.persistence.jdbc.user" value="app"/> <property name="javax.persistence.schema-generation.database.action" value="create"/>
tagged with: jdbc
has title: When/How does jdbc percistency enities get created
type: AnsweredQuestion

http://stackoverflow.com/a/23703699
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36428193
score: 0
has comment: http://stackoverflow.com/comment/36426165
has comment: http://stackoverflow.com/comment/36426436
type: Answer
has body: This tutorial shows how to host service without server. It's wrong to publish web application on server this way. Server applications doesn't need main method. In order to run EE application, you need web.xml file. Follow this tutorial: http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/ to deploy jax-ws application on Tomcat. Hoever, Tomcat is only Servlet container, so you must provide jax-ws implementation by yourself. JEE applications should be hosted on EE Servers - like Glassfish, Tomcat EE or Jboss, for name a few. They have EE libraries built in. Take a look: http://docs.oracle.com/javaee/6/tutorial/doc/bnayn.html
has comment: http://stackoverflow.com/comment/36426046
answers question: http://stackoverflow.com/q/23703008
accepted answer of: http://stackoverflow.com/q/23703008

http://stackoverflow.com/comment/36270366
comment on: http://stackoverflow.com/q/23623196
score: 0
type: Comment
type: QuestionComment
has text: yes I have looked but everything seems confusing so I decided to get help from here and also hopefully get an explanation on how they did it.

http://stackoverflow.com/comment/36470117
type: Comment
type: QuestionComment
has text: I'm not really married to any version of it, since this is just for a personal project. I have the latest that installed with netbeans a few months ago. Is there one version that would be better for this than another?
score: 0
comment on: http://stackoverflow.com/q/23726688

http://stackoverflow.com/q/23623398
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
upvote count: 8
has title: Spring bean not autowiring with @Component annotation
has answer: http://stackoverflow.com/a/23623438
accepted answer: http://stackoverflow.com/a/23623438
answer count: 1
has body: Not sure what I'm doing wrong, but I have a webapp configuration that works in Unit Testing but dies in production for a Component bean. The bean extends WebServiceGatewaySupport and extends an Interface. I define it in java thusly: @Component("myShippingImplementation") public class MyShippingImplemenation extends WebServiceGatewaySupport implements ShippingImplementation { private String addressValidationUri; public String getAddressValidationUri() { return addressValidationUri; } public void setAddressValidationUri(String addressValidationUri) { this.addressValidationUri = addressValidationUri; } } and the XML bean configuration is: &lt;bean id="myShippingImplementation" class="com.cerp.service.shipping.MyShippingImplemenation" autowire="byType"&gt; &lt;property name="addressValidationUri" value="https://www.testurl.com" /&gt; &lt;property name="defaultUri" value="https://www.alturl.com" /&gt; &lt;property name="marshaller" ref="marshaller"/&gt; &lt;property name="unmarshaller" ref="marshaller"/&gt; &lt;/bean&gt; If I wire this in a Unit test it works: public class MyServiceClientTest extends BaseWebServiceTest { @Autowired MyShippingImplemenation c; (BaseWebServiceTest uses SpringJUnit4ClassRunner) but if I wire it in a Controller and run it off Tomcat with the following: @Controller @RequestMapping(value="/work/settings") public class SettingsController { @Autowired SignupServiceI signupService; @Autowired ShippingImplementation myShipImplementation; it dies. The problem is that the fields I defined in XML don't seem to be part of the bean that is autowired into the Controller. For example, I put a breakpoint in the setAddressValidationUri and I can see that it is called on application startup with the proper property. However, after the autowiring in the controller the instance of the bean has null for these values. You will also notice that there's a SignupServiceI reference... this is a Service bean that does autowire successfully. It's an interface implemen…
favorite count: 0
score: 8
tagged with: annotations

http://stackoverflow.com/q/23716144
accepted answer: http://stackoverflow.com/a/23716208
linked to: http://stackoverflow.com/q/4741878
has body: This code will execute an external exe application. private void clientDataActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Runtime.getRuntime().exec("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"); } catch(Exception e) { System.out.println(e.getMessage()); } } What if I want to execute external java file? Is it possible? For example like this command: Runtime.getRuntime().exec("cmd.exe /C start cd \"C:\Users\sg552\Desktop\ java testfile"); The code does not work from java and cmd prompt. How to solve this?
score: 0
answer count: 1
has title: Execute java file with Runtime.getRuntime().exec()
type: AnsweredQuestion
tagged with: runtime.exec
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23716208

http://stackoverflow.com/comment/121623132
comment on: http://stackoverflow.com/a/54945136
has text: similar to my solution but you can save a bit of time by just returning -1 as soon as count is over max.
type: AnswerComment
type: Comment
score: 1

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/23751759
tags question: http://stackoverflow.com/q/23655348
tag name: grouplayout

http://stackoverflow.com/q/23665308
has comment: http://stackoverflow.com/comment/36354897
has comment: http://stackoverflow.com/comment/36353857
upvote count: 0
has body: The problem I have with this is the program displays like this 1 Please Enter the name red Please Enter the price of this event red Please Enter the price of this event 40 Please Enter the date of this event Please enter the amount of tickets available for this event. It completely skips the date. How can I edit my code so that I can enter the data correctly. Any tips and advice would be great. What is it I am doing wrong? Thanks My code is case 1: char ans; do{ Event event = new Event(); out.println("Please Enter the name "); event.setEvent(input.next()); input.nextLine(); do { try { out.println("Please Enter the price of this event\n"); event.setprice(input.nextDouble()); } catch (InputMismatchException e) { out.println("Please Enter the price of this event\n"); } input.nextLine(); } while (!input.hasNextDouble()); out.println("Please Enter the date of this event\n"); event.setdate(input.next()); out.println("Please enter the amount of tickets available for this event.\n"); event.setavailability(input.nextInt()); out.println("Please enter"); event.setvenue(input.next()); Events.add(event); out.println("Would you like to add a new event?"); String answer = input.next(); ans = answer.charAt(0); while (ans== 'y'); out.println (Events.get(0)); break; }
downvote count: 2
tagged with: error-handling
has answer: http://stackoverflow.com/a/23665789
type: Question
tagged with: try-catch
tagged with: case
score: -2
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36352861
has comment: http://stackoverflow.com/comment/36352916
answer count: 1
has title: What is the correct way to structure a try catch statement to only allow integers
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23724609
answer count: 1
has answer: http://stackoverflow.com/a/23726846
has comment: http://stackoverflow.com/comment/36469133
score: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/36467390
accepted answer: http://stackoverflow.com/a/23726846
tagged with: swing
has title: Auto Scroll with the JLabel containing an image
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36466460
tagged with: java
type: Question
tagged with: jscrollpane
has body: There's something I want to try but I've no idea how to go about this and not sure if it's at all possible. I've got a JPanel of JLabels using a GridLayout. This JPanel is then added to a JScrollPane. One if the JLabels has an image in it. That image is supposed to show me where the character in the program is. I just a JLabal so I can get it's position. So basically when I want to move the character, I remove the image from the current JLabel and add it onto the next JLabel. I understand this is possibly the worst approach ever but I am new, all I know is Java and I've got a deadline and didn't think to learn Game Development in Java. Anyway, since I'm using a JScrollPane, I would like the program to automatically scroll when the JLabel with the image cannot be seen anymore. Therefore as the character is moving, the JSCrollPane is scrolling, so I don't have to scroll to it. It does it for me. So like a camera watching where it's going. Is this possible? Thank you very much!!

appium
tags question: http://stackoverflow.com/q/23736407
tag name: appium
tags question: http://stackoverflow.com/q/23672428
tags question: http://stackoverflow.com/q/23753439
tags question: http://stackoverflow.com/q/23713185
type: Tag
tags question: http://stackoverflow.com/q/23737901

http://stackoverflow.com/comment/69492056
comment on: http://stackoverflow.com/a/25043966
has text: Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
type: Comment
score: 0
type: AnswerComment

google-app-engine
tags question: http://stackoverflow.com/q/23764386
tags question: http://stackoverflow.com/q/23622310
tags question: http://stackoverflow.com/q/23700945
tag name: google-app-engine
tags question: http://stackoverflow.com/q/23777482
tags question: http://stackoverflow.com/q/23645757
type: Tag
tags question: http://stackoverflow.com/q/23730207
tags question: http://stackoverflow.com/q/23686429
tags question: http://stackoverflow.com/q/23769832
tags question: http://stackoverflow.com/q/23675452
tags question: http://stackoverflow.com/q/23622255
tags question: http://stackoverflow.com/q/23682439
tags question: http://stackoverflow.com/q/23687581
tags question: http://stackoverflow.com/q/23778147
tags question: http://stackoverflow.com/q/23674074
tags question: http://stackoverflow.com/q/23623643
tags question: http://stackoverflow.com/q/23648054
tags question: http://stackoverflow.com/q/23777024
tags question: http://stackoverflow.com/q/23722254
tags question: http://stackoverflow.com/q/23752398
tags question: http://stackoverflow.com/q/23767953
tags question: http://stackoverflow.com/q/23701064
tags question: http://stackoverflow.com/q/23624101
tags question: http://stackoverflow.com/q/23640799
tags question: http://stackoverflow.com/q/23749907
tags question: http://stackoverflow.com/q/23689218
tags question: http://stackoverflow.com/q/23725693
tags question: http://stackoverflow.com/q/23749023
tags question: http://stackoverflow.com/q/23756988
tags question: http://stackoverflow.com/q/23692317
tags question: http://stackoverflow.com/q/23711789
tags question: http://stackoverflow.com/q/23773166

http://stackoverflow.com/a/23722925
type: AcceptedAnswer
downvote count: 0
has body: Your TextView hold the number when user press buttons, for example user press 2 5 1 then the plus button. In your case R.id.buttonplus, the TextView content will be your num1. So you can do : case R.id.buttonplus: int num1 = Integer.parseInt(text.getText().toString()); text.setText(text.getText() + "+");
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23722884
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23722884

http://stackoverflow.com/a/23620785
has comment: http://stackoverflow.com/comment/36266659
has comment: http://stackoverflow.com/comment/36265944
answers question: http://stackoverflow.com/q/23620746
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36266096
upvote count: 4
has body: You should use \1 to refer to your first group. Your regex is then: (\d{2})-\1-\d{2}\1 In Java code: Pattern pattern = Pattern.compile("(\\d{2})-\\1-\\d{2}\\1");
has comment: http://stackoverflow.com/comment/36266277
has comment: http://stackoverflow.com/comment/36265942
score: 3
has comment: http://stackoverflow.com/comment/36266247
has comment: http://stackoverflow.com/comment/36266213
has comment: http://stackoverflow.com/comment/36266233

http://stackoverflow.com/q/23764865
type: Question
tagged with: jsoup
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23766460
has title: JSoup - Number of Table Rows per Table Body
favorite count: 0
possible better answer: http://stackoverflow.com/a/23766460
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23767199
accepted answer: http://stackoverflow.com/a/23767199
has body: I have the following html table which i am trying to parse using JSoup. I am parsing it as follows; Elements table = document.select("table[class=MsoNormalTable]"); Elements tbody = table.select("tbody"); Elements tr = tbody.select("tr"); Elements td = tr.select("td"); Elements tableHeaders = td.select("p[class=MsoNormal]"); How am I able to find out, per table body how many table rows there are? &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;u&gt;&lt;span lang="EN-US"&gt;â‚¬ SUPR:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt; &lt;table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="585" style="width:438.45pt; margin-left:-1.05pt; border-collapse:collapse"&gt; &lt;tbody&gt; &lt;tr style="height:15.0pt"&gt; &lt;td width="124" style="width:92.8pt; border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt"&gt; &lt;p class="MsoNormal" align="center" style="text-align:center"&gt;&lt;b&gt;&lt;span style="color:black"&gt;Available on TW&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;/td&gt; &lt;td width="60" style="width:44.65pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt"&gt; &lt;p class="MsoNormal" align="center" style="text-align:center"&gt;&lt;b&gt;&lt;span style="color:black"&gt;Ticker&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;/td&gt; &lt;td width="85" style="width:64.0pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt"&gt; &lt;p class="MsoNormal" align="center" style="text-align:center"&gt;&lt;b&gt;&lt;span style="color:black"&gt;Coupon&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;/td&gt; &lt;td width="110" style="width:82.7pt; border:solid windowtext 1.0pt; border-left:none; padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt"&gt; &lt;p class="MsoNormal" align="center" style="text-align:center"&gt;&lt;b&gt;&lt;span style="color:black"&gt;Maturity Date &lt;/span&gt;&lt;/b&gt; &lt;/p&gt; &lt;/td&gt; &lt;td width="99" style="width:74.3pt; border:solid windowtext 1.0pt; border-…
has comment: http://stackoverflow.com/comment/36542049
downvote count: 0
has comment: http://stackoverflow.com/comment/36542079
has comment: http://stackoverflow.com/comment/36542235
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36542427

http://stackoverflow.com/comment/36442963
type: Comment
comment on: http://stackoverflow.com/q/23711664
type: QuestionComment
has text: 1) Post a link to your images and then we can update your question and add the images if we can find them. 2) Don't post code in comments since it loses its formatting making it unreadable. Instead, post any new code to the bottom of your original question by [editing your question](http://stackoverflow.com/posts/23711664/edit). 3) Again you will need to create and post your [minimal code example program](http://stackoverflow.com/help/mcve) for us to allow us to understand your problem. Again, please read [this link](http://stackoverflow.com/help/mcve) to see how to create this.
score: 0

http://stackoverflow.com/comment/36286083
comment on: http://stackoverflow.com/a/23631461
score: 0
type: AnswerComment
type: Comment
has text: Restricting the instantiation to just one instance, I avoid multiple connection to the same database, so what I really need is also lock calls on db object by synchronizing blocks, am I right?

http://stackoverflow.com/a/23631018
type: Answer
upvote count: 12
answers question: http://stackoverflow.com/q/23630255
score: 12
has body: Quote from the documentation: An autowired Maps values will consist of all bean instances that match the expected type, and the Maps keys will contain the corresponding bean names. I think that just changing @Inject with @Resource will do it.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23630255
downvote count: 0

http://stackoverflow.com/comment/36529487
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23758252
has text: The `gson` library makes it easy and simple to convert `JSON` object to **classes** in java. If you want these objects represented as classes, then **yes** you need to make POJO classes. If you do not necessarily want that (i.e. To convert the `JSON` to a **Map** or something) you shouldn't use `gson`
type: Comment

http://stackoverflow.com/q/23726474
has title: Java Swing repaint & threads
has comment: http://stackoverflow.com/comment/36469442
has comment: http://stackoverflow.com/comment/36469313
has comment: http://stackoverflow.com/comment/36473615
has comment: http://stackoverflow.com/comment/36469771
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36471020
has comment: http://stackoverflow.com/comment/36469450
has comment: http://stackoverflow.com/comment/36469617
has body: Context: in my Java Swing app I have a chart (using JFreeChart) and when the user clicks on a datapoint on it, it opens a specific flash animation in a JDialog (flash played using DJNativeSwing). Problem: when the flash animation starts playing, for some reason the background chart in the main window decides to refresh (calls its paintComponent()) and, as the chart is fairly heavy, this takes ~4 seconds during which the flash animation freezes. I am thus looking for the most elegant / simplest solution to avoid the flash freeze. So far, I could imagine: Find out why paintComponent() is called and avoid this Open the JDialog (or child window without modal behavior) on a different thread What would be the best approach and, most importantly, how to do it?
has comment: http://stackoverflow.com/comment/36469368
answer count: 0
linked to: http://stackoverflow.com/q/2064427
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jfreechart
type: Question
downvote count: 0

http://stackoverflow.com/comment/36447548
type: QuestionComment
has text: I've tried googling that but nothing even comes up, and it obviously doesn't work on CMD any knowledge on the Windows version of that?
comment on: http://stackoverflow.com/q/23715057
score: 0
type: Comment

http://stackoverflow.com/a/23671798
downvote count: 0
has comment: http://stackoverflow.com/comment/36365417
has body: Doing this can produce some very weird results. The API is designed to protect against threaded updates and potential modifications that might cause infinite loops In this case, the text field is modified, the Document is updated, the DocumentListener is notified and you try to change the field again, which would start the cycle again, except the Document has a guard to prevent you from doing just this very thing, hence the Exception. What you need to do is two things. You need to update the text field AFTER the DocumentListener has been notified. As has already been stated, this can be achieved by using SwingUtilities.invokeLater Provide some kind of flag so you don't try and modify your field on events cause by you modifying the field due to DocumentListener events...confused yet? Basically, this example uses SwingUtilities.invokeLater to update the field AFTER the DocumentListener has completed it's event notifications and a simple boolean flag to provide a means to "ignore" updates that we have triggered... It's messy, but it will get the job done...mostly... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; public class TestFrame extends JFrame implements DocumentListener { private static final long serialVersionUID = 1L; // tool bar private JToolBar topToolBar; private JTextField wordSearchField; private JComboBox&lt;String&gt; wordSearchTips; // window size private static final int width = 700; private static final int height = 500; public TestFrame() { } public static void main(String[] argv) { new TestFrame().CreateUI(); } public void CreateUI() { setPreferredSize(new Dimension(width, height)); setResizable(false); setLayout(new B…
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23671101
has comment: http://stackoverflow.com/comment/36365528

http://stackoverflow.com/q/23702321
type: Question
has answer: http://stackoverflow.com/a/23702878
tagged with: jenkins
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/23702878
tagged with: java
has title: Jenkins setup to user selenium java scripts
has body: i am new to code and selenium, is there any way to build a job on Jenkins to run scripts automatically at a specific time everyday? need steps to follow
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36422674
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/23663264
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23662997
has body: Try this: package com.sandbox; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import static org.junit.Assert.assertTrue; public class SandboxTest { @Rule public TemporaryFolder folder = new TemporaryFolder(); private File level1; private File level2a; private File level2b; @Before public void setUp() throws Exception { level1 = folder.newFolder("level1"); level2a = folder.newFolder("level1/level2a"); level2b = folder.newFolder("level1/level2b"); } @Test public void whenCreatingNestedFoldersThenAllGetDeleted() { assertTrue(level1.exists()); assertTrue(level2a.exists()); assertTrue(level2b.exists()); System.out.println(level1.getAbsolutePath()); } } It will work exactly as you'd expect. All will be cleaned up after the test runs.
score: 2
has comment: http://stackoverflow.com/comment/74463929
accepted answer of: http://stackoverflow.com/q/23662997
downvote count: 0
has comment: http://stackoverflow.com/comment/70924673

http://stackoverflow.com/q/23667013
answer count: 1
has title: Java multiple CheckBoxes
favorite count: 0
has comment: http://stackoverflow.com/comment/36355987
tagged with: jframe
accepted answer: http://stackoverflow.com/a/23669220
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/36356233
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/36356268
tagged with: jcheckbox
downvote count: 0
has answer: http://stackoverflow.com/a/23669220
has body: I have problem with multiple CheckBoxes. When I create them with my code it only show last box "bolonska zmes" and other boxes are shown only when mouseover. I think that it might be some problem with layers, but I dont know what to do. Thank you for help. public class OknoPizzaVlastna extends JFrame { private String nazvy[] = { "cesnak", "feferony", "hrasok", "cibula", "kecup", "tatarskaOmacka", "vajce", "kapia", "fazula", "kukurica", "ananas", "brokolica", "Niva", "Mozarella", "olivy", "inovec udeny", "articoky", "klobasa", "sampiony", "salama", "slanina", "hranolky", "tuniak", "sunka", "kuracie maso", "syr", "Morska zmes", "bolonska zmes"}; private JCheckBox boxes[]; public OknoPizzaVlastna() { boxes = new JCheckBox[nazvy.length]; for (int i = 0; i &lt; nazvy.length; i++) { createrCheckBox(i); } setTitle("Vlastna Pizza"); setSize(480,320); setVisible(true); setResizable(true); getContentPane().setLayout(null); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } public void createrCheckBox(int i) { boxes[i] = new JCheckBox(); //proper locations will be solved later boxes[i].setLocation(62+i*30,54+i*20); boxes[i].setSize(100,50); boxes[i].setText(nazvy[i]); boxes[i].setSelected(false); boxes[i].setVisible(true); getContentPane().add(boxes[i]); } }

http://stackoverflow.com/comment/36536957
type: Comment
type: QuestionComment
has text: @TAsk: no, it does not seem.
score: 0
comment on: http://stackoverflow.com/q/23762124

xsd
tags question: http://stackoverflow.com/q/23646849
tags question: http://stackoverflow.com/q/23673745
tags question: http://stackoverflow.com/q/23682125
tags question: http://stackoverflow.com/q/23775502
tags question: http://stackoverflow.com/q/23672617
tag name: xsd
tags question: http://stackoverflow.com/q/23648495
tags question: http://stackoverflow.com/q/23699715
tags question: http://stackoverflow.com/q/23627758
tags question: http://stackoverflow.com/q/23660919
tags question: http://stackoverflow.com/q/23704915
tags question: http://stackoverflow.com/q/23669385
type: Tag
tags question: http://stackoverflow.com/q/23675105

http://stackoverflow.com/comment/36499070
score: 1
type: Comment
type: QuestionComment
has text: http://programmers.stackexchange.com/questions/118703/where-did-the-notion-of-one-return-only-come-from
comment on: http://stackoverflow.com/q/23738691

http://stackoverflow.com/a/23664194
has comment: http://stackoverflow.com/comment/36352301
answers question: http://stackoverflow.com/q/23664129
type: Answer
has comment: http://stackoverflow.com/comment/36350572
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23664129
has body: You need to create a new instance of your class add(new mainScreenMenu());

http://stackoverflow.com/q/23731928
has answer: http://stackoverflow.com/a/23731946
downvote count: 2
tagged with: android
has body: I have some problems with this code. I'm trying to create a dynamically list of news with this format: |image| - title |image|- subtitle this is my little cicle code (a example with random data) void setListNews(List<Map<String,String>>l){ listaNewsPagina = l; final Iterator ite = listaNewsPagina.iterator(); LinearLayout lin = (LinearLayout)findViewById(R.id.linear_sezione_news); LinearLayout lineare = (LinearLayout)findViewById(R.id.lineare); while(ite.hasNext()){ Map<String,String> map = (Map<String, String>) ite.next(); ImageView imm = (ImageView)findViewById(R.id.immagine); RelativeLayout rl = (RelativeLayout)findViewById(R.id.relative); TextView titolo = (TextView)findViewById(R.id.titolo); TextView sottoTitolo = (TextView)findViewById(R.id.sottoTitolo); titolo.setText("titolooooo"); sottoTitolo.setText("sottoTitoloooooooooooo"); rl.addView(titolo); rl.addView(sottoTitolo); lineare.addView(imm); lineare.addView(rl); } lin.addView(lineare); setContentView(lin); and this is my layout: <ImageView android:id="@+id/immagine" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginBottom="4dp" android:layout_marginLeft="4dp" android:layout_marginRight="10dp" android:layout_marginTop="4dp" android:src="@drawable/ic_launcher" /> <TextView android:id="@+id/titolo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" /> <TextView android:id="@+id/sottoTitolo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/titolo" android:textSize="13dp" /> <ImageButton android:id="@+id/ImageButtonPrecc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_alignParentLeft="true" android:src="@drawable/bottone_prev" android:text="@string/load_news" /> <ImageButton android:id="@+id/ImageButtonSucc" android:layout_width="wrap_content" android:layout_height="wrap_…
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/23731946
tagged with: android-layout
answer count: 1
has title: ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.LinearLayout
favorite count: 0

http://stackoverflow.com/q/23754732
upvote count: 1
tagged with: excel
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36524057
tagged with: java
has comment: http://stackoverflow.com/comment/36523908
type: Question
tagged with: iterator
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23755898
favorite count: 0
has comment: http://stackoverflow.com/comment/36523459
has title: How to remove iterator loop and allow cellDateType to work in xlsx java?
has comment: http://stackoverflow.com/comment/36523809
has comment: http://stackoverflow.com/comment/36524249
has comment: http://stackoverflow.com/comment/36524078
tagged with: http://stackoverflow.com/tag/xlsx
accepted answer: http://stackoverflow.com/a/23755898
has comment: http://stackoverflow.com/comment/36524765
has comment: http://stackoverflow.com/comment/36523342
has comment: http://stackoverflow.com/comment/36523457
has comment: http://stackoverflow.com/comment/36523681
has comment: http://stackoverflow.com/comment/36523990
has comment: http://stackoverflow.com/comment/36524347
tagged with: apache-poi
has body: Hi to all experts out there, Currently I have some problem regarding the iterator loop. I need to remove it in order for my data to appear on my xlsx excel sheet but I am not sure how do I go about removing it such that my codes are error free. And I suspect that the error may be on the iterator loop. For now, this is my codes and an image link of how it looks like now. The data in the excel sheet are not suppose to have a space in between but apparently, there is. There isn't any data in the first column because I didn't have any data being keyed in into the website. So it's okay for the first column to be blank. int r = 3; for (Iterator iter = Cells.iterator();iter.hasNext();) { Object[] _o = (Object[]) iter.next(); currentRow = s.createRow(r); for(int colNum = 0; colNum &lt; _col_cnt; colNum++){ XSSFCell currentCell =currentRow.createCell(colNum); if (CellDataType[c].equals("STRING") || CellDataType[c].equals("VARCHAR")) { String _l = (String) _o[colNum]; if (_l != null) { currentCell.setCellValue(_l); System.out.println("Data: " + _l); } } hardcode (Testing): int r = 3; for (Iterator iter = Cells.iterator();iter.hasNext();) { Object[] _o = (Object[]) iter.next(); currentRow = s.createRow(r); for(int colNum = 0; colNum &lt; _col_cnt; colNum++){ XSSFCell currentCell =currentRow.createCell(colNum); currentCell.setCellValue("Hello");
linked to: http://stackoverflow.com/q/23721320

http://stackoverflow.com/comment/36367619
comment on: http://stackoverflow.com/q/23673180
score: 0
type: Comment
has text: private Tree<T> parent; statement inside Tree class does not make sense actually
type: QuestionComment

http://stackoverflow.com/q/23739696
downvote count: 0
linked to: http://stackoverflow.com/q/23791014
tagged with: jsch
favorite count: 0
has comment: http://stackoverflow.com/comment/36494089
type: Question
has comment: http://stackoverflow.com/comment/36494567
accepted answer: http://stackoverflow.com/a/23740293
tagged with: httpsurlconnection
tagged with: ssh
has comment: http://stackoverflow.com/comment/36495470
has comment: http://stackoverflow.com/comment/36494018
has title: Java - connect to webpage using SSH tunneling
has comment: http://stackoverflow.com/comment/36496069
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36494276
has comment: http://stackoverflow.com/comment/80370987
answer count: 1
has answer: http://stackoverflow.com/a/23740293
has comment: http://stackoverflow.com/comment/36495985
tagged with: portforwarding
has comment: http://stackoverflow.com/comment/36495651
has comment: http://stackoverflow.com/comment/80499140
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36496200
has body: fellow Java coders. I have recently been faced with an interesting task - to create software that would use an SSH tunnel as a proxy for browsing webpages (over HTTPS). After reading some docs on JSCH (http://www.jcraft.com/jsch/, a Java SSH tunneling library), which all gave database connections as an example, I decided to try it myself. Here is the connection code I copied from http://kahimyang.info/kauswagan/code-blogs/1337/ssh-tunneling-with-java-a-database-connection-example int assigned_port; int local_port=3309; // Remote host and port int remote_port=3306; String remote_host = "&lt;SSH host goes here&gt;"; String login = "&lt;SSH login goes here&gt;"; String password = "&lt;SSH password goes here&gt;"; try { JSch jsch = new JSch(); // Create SSH session. Port 22 is your SSH port which // is open in your firewall setup. Session session = jsch.getSession(login, remote_host, 22); session.setPassword(password); // Additional SSH options. See your ssh_config manual for // more options. Set options according to your requirements. java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); config.put("Compression", "yes"); config.put("ConnectionAttempts","2"); session.setConfig(config); // Connect session.connect(); // Create the tunnel through port forwarding. // This is basically instructing jsch session to send // data received from local_port in the local machine to // remote_port of the remote_host // assigned_port is the port assigned by jsch for use, // it may not always be the same as // local_port. assigned_port = session.setPortForwardingL(local_port, remote_host, remote_port); } catch (JSchException e) { System.out.println("JSch:" + e.getMessage()); return; } if (assigned_port == 0) { System.out.println("Port forwarding failed!"); return; } Now, I am not exactly experienced with all the port forwarding stuff, but, if I understand it correctly, the code is supposed to forward all connections incoming to 127.0.0.1:3…

http://stackoverflow.com/q/23768348
tagged with: java
downvote count: 2
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36549430
has body: I use License4J for my Java software; it supports license activation over internet but I need help on how to save and load activated license text. String licenseKey = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE"; String publickey = "30819f300d06092a864...e32fb70203010001"; String internalString = "1395297610268"; String nameforValidation = null; String companyforValidation = null; int hardwareIDMethod = 0; License license = LicenseValidator.validate( licenseKey, publickey, internalString, nameforValidation, companyforValidation, hardwareIDMethod); System.out.println("License Validation Status: " + license.getValidationStatus()); License activatedLicense = LicenseValidator.autoActivate(license, "https://myServer/algas/autoactivate"); System.out.println("License Activation Status: " + activatedLicense.getActivationStatus()); Here I can have activated license text string from activatedLicense.getLicenseString(); If I save this string on disk, how to validate it on each startup; and is hardware id for activated license stored inside license text or do I have to specify hardware id in validation method?
has title: License Activation and Saving Activated License
has answer: http://stackoverflow.com/a/23769047
upvote count: 0
answer count: 1
favorite count: 0
tagged with: license4j
accepted answer: http://stackoverflow.com/a/23769047
type: AnsweredQuestion

http://stackoverflow.com/q/23766870
has answer: http://stackoverflow.com/a/23767047
linked to: http://stackoverflow.com/q/7355024
has comment: http://stackoverflow.com/comment/36546628
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36547827
favorite count: 0
type: UnansweredQuestion
has body: I am developing a Java program and I'm meeting cases where I get undecided whether to use the casting a string to integer method, or to use the integer.parseInt method. Is there any clear benefit for either of the two methods? With 'casting to string method', I mean: String.valueOf(integer);
has comment: http://stackoverflow.com/comment/36546217
has comment: http://stackoverflow.com/comment/36550141
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36547103
tagged with: methods
type: Question
tagged with: casting
score: -2
has title: distinguishing cases to use interger.parseInt and string casting methods

http://stackoverflow.com/a/23769539
has comment: http://stackoverflow.com/comment/36552359
type: Answer
has comment: http://stackoverflow.com/comment/36551869
score: 3
upvote count: 3
has body: Your 4 code blocks look the same, so the first step would be to extract your algorithm to a method public void algo(List&lt;MyObject&gt; head) { for (int i = 0; i &lt; head.size(); i++) { a = head.get(i); for (int j = 0; j &lt; l.size(); j++) { b = l.get(j); fun1 = curr1; fun2 = b.getName(); int d = dL.execute(fun1,fun2); if(d&lt;5){ int x=a.getName().length(); int y=b.getName().length(); if(x&lt;y){ currCDO.add(a); } if(y&lt;x){ a.setName(b.getName()); currCDO.add(a); } if(x==y){ currCDO.add(a); } break; } } } } Then one possible solution would be to call this for each list: public void createAndRun(final List&lt;MyObject&gt; list) { Thread thread = new Thread(new Runnable() { @Override public void run(){ algo(list); } }); thread.start(); }
answers question: http://stackoverflow.com/q/23769411
downvote count: 0

file
type: Tag
tags question: http://stackoverflow.com/q/23742506
tags question: http://stackoverflow.com/q/23761174
tags question: http://stackoverflow.com/q/23704988
tags question: http://stackoverflow.com/q/23708705
tags question: http://stackoverflow.com/q/23710086
tags question: http://stackoverflow.com/q/23763343
tags question: http://stackoverflow.com/q/23686904
tags question: http://stackoverflow.com/q/23751345
tag name: file
tags question: http://stackoverflow.com/q/23769751
tags question: http://stackoverflow.com/q/23725226
tags question: http://stackoverflow.com/q/23675010
tags question: http://stackoverflow.com/q/23750542
tags question: http://stackoverflow.com/q/23648123
tags question: http://stackoverflow.com/q/23723331
tags question: http://stackoverflow.com/q/23618409
tags question: http://stackoverflow.com/q/23769567
tags question: http://stackoverflow.com/q/23747268
tags question: http://stackoverflow.com/q/23721931
tags question: http://stackoverflow.com/q/23771808
tags question: http://stackoverflow.com/q/23661038
tags question: http://stackoverflow.com/q/23674898
tags question: http://stackoverflow.com/q/23624902
tags question: http://stackoverflow.com/q/23722067
tags question: http://stackoverflow.com/q/23717072
tags question: http://stackoverflow.com/q/23759687
tags question: http://stackoverflow.com/q/23766470
tags question: http://stackoverflow.com/q/23683126
tags question: http://stackoverflow.com/q/23640931
tags question: http://stackoverflow.com/q/23625705
tags question: http://stackoverflow.com/q/23676380
tags question: http://stackoverflow.com/q/23733482
tags question: http://stackoverflow.com/q/23714217
tags question: http://stackoverflow.com/q/23640069
tags question: http://stackoverflow.com/q/23638552
tags question: http://stackoverflow.com/q/23717572
tags question: http://stackoverflow.com/q/23723659
tags question: http://stackoverflow.com/q/23677926
tags question: http://stackoverflow.com/q/23728493
tags question: http://stackoverflow.com/q/23777614
tags question: http://stackoverflow.com/q/23740757
tags question: http://stackoverflow.com/q/23620281
tags question: http://stackoverflow.com/q/23741627
tags question: http://stackoverflow.com/q/23706109
tags question: http://stackoverflow.com/q/23665119
tags question: http://stackoverflow.com/q/23737528

http://stackoverflow.com/q/23777229
type: Question
accepted answer: http://stackoverflow.com/a/23777761
tagged with: eclipse
has answer: http://stackoverflow.com/a/23777761
score: 0
has comment: http://stackoverflow.com/comment/36565717
has comment: http://stackoverflow.com/comment/36567882
answer count: 1
has title: FATAL EXCEPTION: main with android and eclipse
has body: Im making a simple GPS/Google maps based app in android and i was about finished with it when it just throws up this horrible error. I really dont know where to start with trying to debug this aswell because it doesnt stop at any breakpoints i put in the main activity and im not massively familiar with android, java or eclipse. So as annoying as it is im just going to dump the whole main file in here Basically, the point of the app is that it'll find out where you are and then you can choose to bring up a wikipedia article based on where you are edit: and ive tried restarting the emulator,eclipse, cleaning and rebuilding Any help will be massively appreciated Logcat: 05-21 03:41:45.283: E/AndroidRuntime(1846): FATAL EXCEPTION: main 05-21 03:41:45.283: E/AndroidRuntime(1846): Process: com.example.playservicestest, PID: 1846 05-21 03:41:45.283: E/AndroidRuntime(1846): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.playservicestest/com.example.playservicestest.MainActivity}: java.lang.NullPointerException 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.os.Handler.dispatchMessage(Handler.java:102) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.os.Looper.loop(Looper.java:136) 05-21 03:41:45.283: E/AndroidRuntime(1846): at android.app.ActivityThread.main(ActivityThread.java:5017) 05-21 03:41:45.283: E/AndroidRuntime(1846): at java.lang.reflect.Method.invokeNative(Native Method) 05-21 03:41:45.283: E/AndroidRuntime(1846): at java.lang.reflect.Method.invoke(Method.jav…
has comment: http://stackoverflow.com/comment/36566142
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/36566001
has comment: http://stackoverflow.com/comment/36566304
tagged with: android
has comment: http://stackoverflow.com/comment/36565869
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36566422
tagged with: java
has comment: http://stackoverflow.com/comment/36565728

http://stackoverflow.com/a/23659281
answers question: http://stackoverflow.com/q/23658678
downvote count: 0
has body: I also think using a Hashmap is the best solution. In your code, there is an error, maybe your problem is here. Replace the following : if(words.get(i)==Final.get(j)){ By : if(words.get(i).equals(Final.get(j))){
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36397786
type: Comment
has text: Hi, would it be possible for you to provide me with a code sample or point me in the direction of one.
comment on: http://stackoverflow.com/a/23656268
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36534297
has text: u might be calling these classes in your new app activities , getting any error ??
comment on: http://stackoverflow.com/q/23760031
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36363515
comment on: http://stackoverflow.com/q/23660924
score: 0
type: Comment
type: QuestionComment
has text: The simplest way to speed up the process would be to send the 20 queries in parallel by submitting the tasks to an ExecutorService.

http://stackoverflow.com/comment/36460494
comment on: http://stackoverflow.com/q/23722067
type: Comment
has text: Did you bother to read the docs for `BufferedReader.read()`? http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#read%28%29 And you can read about `ready()` method while you are there.
type: QuestionComment
score: 0

http://stackoverflow.com/q/23647892
has comment: http://stackoverflow.com/comment/36318330
type: UnansweredQuestion
has title: ActionListener not working on some computers?
upvote count: 1
tagged with: actionlistener
score: 1
tagged with: java
tagged with: keylistener
has body: I was making a snake game, it works fine on my computer but doesn't work on any of the school computers. It compiles and I can run it but my keypressed events don't work, so i cannot control the snake because the keys don't work. Snake Class import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.Random; import javax.swing.JFrame; import javax.swing.Timer; public class Snake implements ActionListener, KeyListener { public static Snake snake; public JFrame jframe; public RenderPanel renderPanel; public Timer timer = new Timer(20, this); public ArrayList&lt;Point&gt; snakeParts = new ArrayList&lt;Point&gt;(); public static final int UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, SCALE = 10; public int ticks = 0, direction = DOWN, score, tailLength = 10, time; public Point head, mouse; public Random random; public boolean over = false, paused; public Dimension dim; public Snake() { dim = Toolkit.getDefaultToolkit().getScreenSize(); jframe = new JFrame("TechnoSnake"); jframe.setVisible(true); jframe.setSize(805, 700); jframe.setResizable(false); jframe.setLocation(dim.width / 2 - jframe.getWidth() / 2, dim.height / 2 - jframe.getHeight() / 2); jframe.add(renderPanel = new RenderPanel()); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.addKeyListener(this); startGame(); } public void startGame() { over = false; paused = false; time = 0; score = 0; tailLength = 1; ticks = 0; direction = DOWN; head = new Point(0, -1); random = new Random(); snakeParts.clear(); mouse = new Point(random.nextInt(79), random.nextInt(66)); timer.start(); } public void actionPerformed(ActionEvent arg0) { renderPanel.repaint(); ticks++; if (ticks % 2 == 0 &amp;&amp; head != null &amp;&amp; !over &amp;&amp; !paused) { time++; snakeParts.add(new Point(head.x, head.y)); if (direction == UP) if…
type: Question
tagged with: keypress
has answer: http://stackoverflow.com/a/23648022
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36318565
has comment: http://stackoverflow.com/comment/36318541

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/23680830

http://stackoverflow.com/comment/36546217
type: QuestionComment
has text: Please clarify _to cast a string to integer method_.
score: 2
comment on: http://stackoverflow.com/q/23766870
type: Comment

http://stackoverflow.com/comment/36419588
type: QuestionComment
has text: @Juvanis Only the OP can comment on whether `add(maths)` was the real intention.
comment on: http://stackoverflow.com/q/23700736
score: 0
type: Comment

http://stackoverflow.com/a/23725888
downvote count: 0
has body: Class.forName("oracle.jdbc.driver.OracleDriver"); Connection connection = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:MySID","username","password"); If you use : (jdbc:oracle:thin:@localhost:1521:MySID) - after that, the SID name is expected. If you use / (jdbc:oracle:thin:@localhost:1521/MySERVICE) - the service name is expected More here: http://www.orafaq.com/wiki/JDBC
upvote count: 3
has comment: http://stackoverflow.com/comment/36479409
answers question: http://stackoverflow.com/q/23725832
type: Answer
score: 3

http://stackoverflow.com/q/23700387
tagged with: spring-mvc
has body: In many tags of spring.tld there are those attributes: htmlEscape javaScriptEscape The question may seem trivial, but which is the difference from html escape and javascript escape in this context?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23717929
tagged with: spring-tld
tagged with: java
type: Question
answer count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23717929
score: 0
tagged with: spring
has title: spring.tld tag library attributes differences

http://stackoverflow.com/comment/36323797
score: 0
type: AnswerComment
type: Comment
has text: in the second diagram should we do [Acess * -- 1 role] instead of aggregation because an access should have just one role element ?
comment on: http://stackoverflow.com/a/23648043

http://stackoverflow.com/q/23764211
type: Question
has answer: http://stackoverflow.com/a/23765084
accepted answer: http://stackoverflow.com/a/23765084
has body: I'm currently building a new application where I'm about to choose logging framework. I already know that I would like to index my logs in logstash. What I would like to do is to log directly from my application (without writing to disk) to the logstash server. I would also like to avoid using a secondary server such as a syslog server. Example scenario The scenario I'm imagining is that I have my top level logging framework, say hypothetically slf4j. To this framework I'd like to drop in a Logger that would log directly into logstash over tcp. Is there a logger with corresponding framework runnable on the JVM that is capable of doing this?
tagged with: logstash
answer count: 1
tagged with: elasticsearch
downvote count: 0
favorite count: 0
upvote count: 1
tagged with: logging
has title: Is it possible to log directly from jvm application to Logstash?
type: AnsweredQuestion
tagged with: kibana
score: 1
tagged with: java

http://stackoverflow.com/comment/36351305
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23664487
has text: Also, I'm guessing `grid.length` doesn't compile because `grid` is never defined in that class
score: 0

http://stackoverflow.com/a/23745806
accepted answer of: http://stackoverflow.com/q/23745658
score: 0
answers question: http://stackoverflow.com/q/23745658
type: Answer
has comment: http://stackoverflow.com/comment/36506018
type: AcceptedAnswer
has body: You get a stackOverflow, because the java stack is not so big. You should use an iterative algorithm, similar to this one: public int getLength(){ MyObject cursor = this; int length = 0; while (cursor != null) { length += 1; cursor = this.next; } } Where MyObject is the current class.

http://stackoverflow.com/comment/36422365
comment on: http://stackoverflow.com/a/23691208
type: Comment
score: 0
has text: I think I got it with `public int[] unpack(int pack){return new int[]{pack / max[0],pack % max[0]};} public int pack(int[] num){return (num[0] % (max[0]+1)) * max[0] + (num[1] % (max[1]+1));}` is that the best way?
type: AnswerComment

http://stackoverflow.com/q/23751193
has answer: http://stackoverflow.com/a/44705987
has title: spring data jpa limit pagesize, how to set to maxSize
has answer: http://stackoverflow.com/a/77630877
has answer: http://stackoverflow.com/a/74908524
has answer: http://stackoverflow.com/a/58891109
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/44705987
has answer: http://stackoverflow.com/a/23766580
tagged with: java
has answer: http://stackoverflow.com/a/51648916
has answer: http://stackoverflow.com/a/51965588
has answer: http://stackoverflow.com/a/63865896
type: Question
upvote count: 27
has body: I have one requirement is to search by pageable and non-pageable, and in my Java code, I use spring data jpa Pageable class, Pageable pageable = new PageRequest( queryForm.getPageNumber()- 1, queryForm.getPageSize(),Sort.Direction.ASC,"id"); Page page = repository.fullTextSearch(queryForm.getText(), pageable); And I don't want to change the return structure, So when non-pageable situation (search all), how to set the pageSize value to MAX ?
downvote count: 0
score: 27
favorite count: 0
has answer: http://stackoverflow.com/a/59776741
has answer: http://stackoverflow.com/a/44409704
accepted answer: http://stackoverflow.com/a/23766580
tagged with: spring-data-jpa
answer count: 14
has answer: http://stackoverflow.com/a/56857029
has answer: http://stackoverflow.com/a/56904030
has answer: http://stackoverflow.com/a/54682535
has answer: http://stackoverflow.com/a/46836539

http://stackoverflow.com/comment/36422746
score: 0
type: Comment
has text: Yes, that is no surprising. It is too bad that neo4j does not (yet) support using an index to speed up `ORDER BY` clauses.
comment on: http://stackoverflow.com/a/23685806
type: AnswerComment

http://stackoverflow.com/a/23701769
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/23701595
has body: Try this. private static final long ZERO_OUT_LAST_32_BITS = 0xffffffff00000000L; public static void main(String[] args) { double number = 2.5; long numberBits = Double.doubleToLongBits(number); double result = Double.longBitsToDouble(numberBits &amp; ZERO_OUT_LAST_32_BITS); } It zeroes out the last 32 bits of the binary representation of your double by using a binary AND operation. However, make sure you know exactly what and why you are doing - I would at least expect an explaining comment next to code like this.
upvote count: 7

http://stackoverflow.com/q/23627199
tagged with: pattern-matching
score: 0
has comment: http://stackoverflow.com/comment/36278287
accepted answer: http://stackoverflow.com/a/23627461
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Get img tags from an xml
upvote count: 1
downvote count: 1
has body: I have the following code that gets the img tags urls from an XML which is working correctly: Pattern p = Pattern.compile("&lt;img[^&gt;]+src\\s*=\\s*['\"]([^'\"]+)['\"][^&gt;]*&gt;"); Matcher m = p.matcher(xmlString); while (m.find()) imagesURLs.add(m.group(1)); My xml looks like the following: &lt;item&gt; &lt;desc&gt; txt txt txt txt &lt;img src="htttp://mysite.com/images/img.png"&gt; txt txt &lt;img src="htttp://mysite.com/images/img.png"&gt; ... &lt;/desc&gt; &lt;/item&gt; &lt;item&gt; &lt;desc&gt; txt txt txt txt &lt;img src="htttp://mysite.com/images/img.png"&gt; txt txt &lt;img src="htttp://mysite.com/images/img.png"&gt;&lt;img src="htttp://mysite.com/images/img.png"&gt; &lt;/desc&gt; &lt;/item&gt; I want to modify the code to only get the first img tag url from each desc tag.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36278536
has comment: http://stackoverflow.com/comment/36278606
has comment: http://stackoverflow.com/comment/36278195
has comment: http://stackoverflow.com/comment/36277892
tagged with: java
has answer: http://stackoverflow.com/a/23627461
type: Question
answer count: 1

http://stackoverflow.com/q/23725630
possible better answer: http://stackoverflow.com/a/23725666
score: -2
has body: I am trying to have it so that my drawRect is created 13 times on the panel. This works correctly but I would also like it to start from a height of say 100 and increment up to 550. I am not sure how I would add the incrementation of the height as I have the draw rect in a for loop already. import java.awt.Color; import java.awt.Graphics2D; import java.util.Random; import javax.swing.JPanel; public class Draw extends JPanel { Color rand; private int randRed() { int red; Random randomNumber = new Random(); red = randomNumber.nextInt(255); return red; } private int randGreen() { int green; Random randomNumber = new Random(); green = randomNumber.nextInt(255); return green; } private int randBlue() { int blue; Random randomNumber = new Random(); blue = randomNumber.nextInt(255); return blue; } int newRectPos = 0; public void paintComponent(java.awt.Graphics g) { super.paintComponent(g); for (int i = 0; i &lt; 550; i ++) { } for (int j = 0; j &lt;= 800; j = j + 60; int i = 0; i &lt;= 550; i ++) { g.setColor(new Color(randRed(), randGreen(), randBlue())); g.drawRect(j, 0, 60, 550); g.fillRect(j, 0, 60, 550); repaint(); } } }
answer count: 2
downvote count: 3
upvote count: 1
tagged with: paintcomponent
favorite count: 0
has answer: http://stackoverflow.com/a/23725666
has title: How to have a for loop increment height and pos
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23725658
accepted answer: http://stackoverflow.com/a/23725658
tagged with: java
has comment: http://stackoverflow.com/comment/36467577
type: Question

http://stackoverflow.com/comment/36339585
type: AnswerComment
type: Comment
has text: @user1207289 No idea how to make it work in `SoapUI-5.0.0/bin/ext`. Place it under `SoapUI-5.0.0/lib` instead.
score: 1
comment on: http://stackoverflow.com/a/23640468

http://stackoverflow.com/comment/36895724
type: Comment
type: QuestionComment
has text: I think you are right @mabi. I have taken the route of having two mapping tables to achieve what I wanted here. I think this is the only, and probably cleanest, way.
comment on: http://stackoverflow.com/q/23737344
score: 0

http://stackoverflow.com/comment/36358697
has text: What do you think the result of executing that `cd` would be? Put the command(s) in a `.bat` (or `.cmd`) file and then you could exec that.
comment on: http://stackoverflow.com/q/23664789
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36356713
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23665607
score: 1
has text: Where is the image stored (in particular, in relation to your program)?

http://stackoverflow.com/comment/36456960
type: QuestionComment
has text: IntToHex() is not C++. It is just a functions that comes with C++ Builder.
comment on: http://stackoverflow.com/q/23717736
score: 0
type: Comment

http://stackoverflow.com/q/23744756
has answer: http://stackoverflow.com/a/23755665
type: AnsweredQuestion
tagged with: java
has title: parse XML to ArrayList using XSTREAM
type: Question
tagged with: xstream
has comment: http://stackoverflow.com/comment/36529305
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36528970
answer count: 1
accepted answer: http://stackoverflow.com/a/23755665
tagged with: http://stackoverflow.com/tag/xml
has body: I'm testing out Xstream library. All I want is to parse XML into ArrayList This is a tutorial I've been following. It seems pretty simple, but my XML structure is more complex. Therefore there's some mess appeared in my mind. I did everything step by step and got java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException. If someone worked with this please help. Here's the XML boards.xml: <?xml version="1.0" encoding="UTF-8"?> The APO Supreme is an interesting board. To start off I think someone filed down the edges because we have never experienced so little edge hold. It was to the point where it was a bit scary. Hopefully this was not how the board really rides because there is some snap and pop to it. <riding_style> All Mountain Freestyle </riding_style> <riding_level> Intermediate - Expert </riding_level> Directional Twin <camber_profile> Flat to Rocker </camber_profile> Centered $499 drawable\\snb_apo_supreme.jpg The Arbor Draft was the first snowboard in their line up to go rocker back in 2010. Over the years the Arbor Draft has pretty much remained the same board with the exception of a few minor refinements. This is one of the better jib park boards we came across and it also isn’t bad out of the jib park. <riding_style> Jib / Street </riding_style> <riding_level> Beginner - Expert </riding_level> True Twin <camber_profile> Continuous Rocker </camber_profile> Centered $399 drawable\\snb_arbor_draft.jpg The Burton Custom Restricted is a Twin camber version of the Custom Flying V Restricted like the Custom is to the Custom Flying V. Usually the Restricted Custom is the same as the Custom but this time there is a completely different ride. They share the same name and the same twin shape but that’s it. The vastly different camber profiles change the ride a lot. This has a more semi-aggressive freestyle feel to it for those that like the Custom but want to ride switch a lot more. It’s still got the same mountain speed as the Custom Camber and it also…

http://stackoverflow.com/comment/36453011
comment on: http://stackoverflow.com/a/23710119
score: 0
type: Comment
has text: Column 5030 is an empty array. It doesn't have `enchantment`. Others item: `enchantment: { "whatever": "whatever"}` but this item is `enchantment: []`
type: AnswerComment

http://stackoverflow.com/a/23731608
type: AcceptedAnswer
score: -1
has body: In java problem solved by get ResultSet string end get from it bytes in ISO-8859-1. After that create new String from bytes. new String(rs.getString(1).getBytes("ISO-8859-1"))
accepted answer of: http://stackoverflow.com/q/23697077
answers question: http://stackoverflow.com/q/23697077
type: Answer
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/36483596

http://stackoverflow.com/comment/36385339
type: Comment
type: QuestionComment
has text: Do you have the qualifier name??
comment on: http://stackoverflow.com/q/23647908
score: 0

http://stackoverflow.com/q/23750221
has title: Sleep timer for displaying text
has comment: http://stackoverflow.com/comment/36514791
has body: In android, I am trying to display Ready Set Go one at a time with a slight delay before overwriting the next one. This doesn't work for me. I get the pause but no text is written. Here is what I have tried so far any help is appreciated! Once a user clicks the Button the on click calls readySetGo @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.button_start_pause: readySetGo(); break; default: break; } } public void readySetGo() { text_timer.setText("Ready"); SystemClock.sleep(2000); text_timer.setText("Set"); SystemClock.sleep(2000); text_timer.setText("Go!!"); }
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36514273
tagged with: android
has comment: http://stackoverflow.com/comment/36514750
possible better answer: http://stackoverflow.com/a/23750282
accepted answer: http://stackoverflow.com/a/23750789
has answer: http://stackoverflow.com/a/23750282
tagged with: java
has comment: http://stackoverflow.com/comment/36514730
has comment: http://stackoverflow.com/comment/36514329
has answer: http://stackoverflow.com/a/23750789
type: AnsweredQuestion

http://stackoverflow.com/a/23773815
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23773762
answers question: http://stackoverflow.com/q/23773762
has body: You would loop through every "Bad word" and look to see if the String contained the word. If so, you set a flag. For example: String[] badWords = new String[5]; //set all of you bad words String fname = scanner(System.in); //check if it contains explicit words boolean containsBadWord = false; for(String badWord : badWords){ if (fname.contains(badWord)) { containsBadWord = true; break; } } if(containsBadWord){ System.out.println(fname + " contains inappropriate words and is not accepted."); } else { System.out.println(fname + " is all good"); //create file createFile(fname); }
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23677438
has comment: http://stackoverflow.com/comment/36531333
has comment: http://stackoverflow.com/comment/36382123
has comment: http://stackoverflow.com/comment/36534895
has comment: http://stackoverflow.com/comment/36394330
type: Answer
has comment: http://stackoverflow.com/comment/36382469
accepted answer of: http://stackoverflow.com/q/23676998
downvote count: 0
has comment: http://stackoverflow.com/comment/36383170
score: 1
answers question: http://stackoverflow.com/q/23676998
has comment: http://stackoverflow.com/comment/36383338
has comment: http://stackoverflow.com/comment/36535794
has body: This looks like a classic memory leak situation. Most likely, you're keeping a live reference to some UI component (or maybe even the Activity) in a listener or an AsyncTask which causes the Activity instance to be leaked (kept from being garbage collected) when you turn the device -- because due to orientation change another Activity instance is created and the old one is supposed to be destroyed and collected. After you turn the device 3 times you have 4 copies of everything -- hence the OOM. Another possibility is that you're decoding a Bitmap manually and not calling recycle() on it when your Activity is destroyed. And yep, as the guys suggest in the comments, nothing more specific can be said until you post your code. UPD Oh, yeah, now that the code is there, most likely the source of your problem is somewhere in the anonymous classes (the OnPreDrawListener and the Runnable). First, not all conditions guarantee that your listener gets removed -- I'm not sure this is exactly what's causing the leak but consider checking if the listener is still around and removing it in onDestroy() also. But the more general idea is that any untrivial anonymous and nested non-static classes are a bad idea because they store an implicit reference to the instance of the containing class -- in this case, the Activity. Should anything unsuspected happen with any of that code -- it can cause the containing instance to be retained. So, safest strategy is to avoid using non-static nested (let alone anonymous) classes unless the logic they carry is so trivial that you're absolutely sure about the implications. My go-to approach is to create static nested Listeners (or AsyncTasks, Runnables, etc.) that refer to everything they need via WeakReference. Most obvious solution is to store the reference to the Activity in a member WeakReference&lt;InstructionsActivity&gt; and check it for null when the corresponding code gets executed. If it returns null - that means your Activity got destroye…
has comment: http://stackoverflow.com/comment/36376678
has comment: http://stackoverflow.com/comment/36394564
has comment: http://stackoverflow.com/comment/36535358
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36536317

http://stackoverflow.com/comment/36816092
type: Comment
type: AnswerComment
has text: @user1121883: Sorry if my original question did not communicate the exact problem. But that was precisely what I was looking for. public String createHTML(String tag) { String temp = ""; temp += "function test(javascript_tagname)"; //"javascript_tagname" should be the value passed in the Java variable "tag" temp += "{ "; temp += " var x = document.getElementsByTagName('javascript_tagname');"; //I would want the variable 'javascript_tagname' in the above line to contain the same value as 'javascript_tagname' passed as parameter to function test()
score: 0
comment on: http://stackoverflow.com/a/23752652

http://stackoverflow.com/q/23699203
type: Question
has title: Add a common query to Spring Data JPA Repository in hirachical vs flat way
has answer: http://stackoverflow.com/a/23725094
tagged with: jpa
tagged with: spring-data-jpa
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 3
upvote count: 3
tagged with: java
tagged with: spring-data
has body: In Spring Data JPA a interface (CommonRepository) that contains common (not custom) querys can: extends JpaRepository so that a concreate repository only need to extend the CommonRepository or, the CommonRepository extends nothing and the the concreate repositories have to extends JpaRepository and the CommonRepository which way is the preferred one? Sometimes a Picture explain it best: The Domain Model (the common feature is that every entity has a title) Repositories I want not to write the findByTitle(String title) method explicit for every repository (In truth there is not only the one common query, but much more). With Spring Data JPA, it seams possible to solve this in two different ways: Hierarchical way: MyCommonRepository extends the JpaRepository public interface MyCommonRepository&lt;T extends TitledEntity&lt;T&gt;, ID extends Serializable&gt; extends JpaRepository&lt;T, ID&gt; {...} public interface DomainClassARepository extends MyCommonRepository&lt;DomainClassA, Long&gt; {...} Flat way: MyCommonRepository extends nothing, but the concrete Repositories have to extend JpaRepository and MyCommonRepository. public interface MyCommonRepository&lt;T extends TitledEntity&lt;T&gt;&gt; {...} public interface DomainClassARepository extends JpaRepository&lt;DomainClassA, Long&gt;, MyCommonRepository&lt;DomainClassA&gt; {...} From a first test both ways seams to work, but I don't know if there is some pitfall or some other reason to de?

http://stackoverflow.com/q/23622400
tagged with: jtable
upvote count: 1
has body: I'm trying to refresh my table but it won't refresh. I tried using the fireTableDataChanged() as well as creating a new model but my Table will not budge. I can get the initial values in but I can't figure out how to refresh it. HS = new Vector(Arrays.asList(finalHSArr)); SF = new Vector(Arrays.asList(finalFlagsArr)); I have two separate JTables that I am trying to refresh and these are the new values above. I've been trying for 6 hours now. public class TemplateGui extends JFrame { private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField textField; private static String [] sortedRoles_Flags,finalFlagsArr,finalHSArr; private static String finalFlags="",finalHS="",columnToConvert="Result"; private Vector&lt;String&gt; SF,HS,column; private JTable hotelSecurityTable,securityFlagsTable; private DefaultTableModel hsTableModel,sfTableModel; public TemplateGui(){ super("Galaxy Template Generator V1.0"); //column name column = new Vector(Arrays.asList(columnToConvert)); getContentPane().setForeground(new Color(0, 0, 0)); getContentPane().setLayout(null); getContentPane().setBackground(new Color(51, 51, 51)); //radio buttons JRadioButton rdbtnNewRadioButton = new JRadioButton("Central User "); rdbtnNewRadioButton.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnNewRadioButton.setBackground(Color.WHITE); buttonGroup.add(rdbtnNewRadioButton); rdbtnNewRadioButton.setBounds(222, 75, 127, 36); getContentPane().add(rdbtnNewRadioButton); final JRadioButton rdbtnPropertyUser = new JRadioButton("Property User"); rdbtnPropertyUser.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnPropertyUser.setBackground(Color.WHITE); buttonGroup.add(rdbtnPropertyUser); rdbtnPropertyUser.setBounds(222, 38, 127, 34); getContentPane().add(rdbtnPropertyUser); textField = new JTextField(); textField.setFont(new Font("Tahoma", Font.BOLD, 18)); textField.setBounds(10, 35, 53, 34); getContentPane().add(textField); textField.setColumns(10); JLabel lblHotelSecurity = new JLabel("Hotel Se…
favorite count: 0
has answer: http://stackoverflow.com/a/23622487
accepted answer: http://stackoverflow.com/a/23622487
downvote count: 0
tagged with: swing
has title: Refresh JTable using Vectors strings
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: defaulttablemodel
tagged with: vector
answer count: 1

spnego
tags question: http://stackoverflow.com/q/23759016
tag name: spnego
tags question: http://stackoverflow.com/q/23741629
type: Tag

http://stackoverflow.com/q/23764729
favorite count: 0
has body: I am writing a Java application that run test automatically on salesForce account and display the result in a excel document. But I have a probleme : One of my classe doesnt compile, so I obtain this error : line 49, column 35: Invalid type: FooClass And the problem is after that all my classes test fail with this error : line -1, column -1: Previous load of class failed: APB005_AudienceMember_Update_TEST: line 49, column 35: Invalid type: APB005_AudienceMember_Update. This is the part of code that execute all tests on salesforce platform : connector = new SoapConnection(config); RunTestsRequest request = new RunTestsRequest(); request.setAllTests(true); //execution of All tests RunTestsResult r = connector.runTests(request); Is there anyway to continue the tests even if a compilation error appears?
type: UnansweredQuestion
answer count: 0
score: 1
upvote count: 1
type: Question
has title: How to catch this error : " line -1, column -1: Previous load of class failed"?
tagged with: java
has comment: http://stackoverflow.com/comment/36543218
tagged with: apex
tagged with: automated-tests
downvote count: 0
tagged with: salesforce
has comment: http://stackoverflow.com/comment/36541768

http://stackoverflow.com/comment/36279881
type: Comment
comment on: http://stackoverflow.com/a/23628269
type: AnswerComment
has text: Thank you for your help. I don't understund the final code. What's wrong in my foreign key id? thank you.
score: 0

http://stackoverflow.com/comment/36534825
score: 0
comment on: http://stackoverflow.com/a/23761020
type: Comment
has text: @Tim B I'm reacting to the "Instantiate M" requirement. A factory created by the user (not the entitycollection author) can also abstract away knowledge of the concrete type but so can simple dependency injection.
type: AnswerComment

http://stackoverflow.com/comment/36544428
type: Comment
has text: I can't... it's Java 8 and (I forgot to say) I'm using 7.
type: AnswerComment
comment on: http://stackoverflow.com/a/23747056
score: 0

http://stackoverflow.com/q/23741178
has answer: http://stackoverflow.com/a/23741607
has comment: http://stackoverflow.com/comment/36496600
type: UnansweredQuestion
has body: I want to know how I should declare a Integer with Null Value in Android. Here is my code: btnload.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String getDate, getEpayee, getEcategory; int getEamt; getDate= ""; getEamt=""; //This Eamt variable is of integer type and //this gives me a error. getEpayee =""; getEcategory="";
has answer: http://stackoverflow.com/a/23741221
has title: how to declare null value to integer in android
tagged with: java
has comment: http://stackoverflow.com/comment/36496587
type: Question
has answer: http://stackoverflow.com/a/23741665
score: 0
answer count: 3
tagged with: integer

http://stackoverflow.com/a/33337838
type: Answer
has comment: http://stackoverflow.com/comment/99320983
has comment: http://stackoverflow.com/comment/84127687
has body: We ran into the same problem - needed to execute code in the background using @Async, so it was unable to use any Session- or RequestScope beans. We solved it the following way: Create a custom TaskPoolExecutor that stores scoped information with the tasks Create a special Callable (or Runnable) that uses the information to set and clear the context for the background thread Create an override configuration to use the custom executor Note: this will only work for Session and Request scoped beans, and not for security context (as in Spring Security). You'd have to use another method to set the security context if that is what you're after. Note2: For brevity, only shown the Callable and submit() implementation. You can do the same for the Runnable and execute(). Here is the code: Executor: public class ContextAwarePoolExecutor extends ThreadPoolTaskExecutor { @Override public &lt;T&gt; Future&lt;T&gt; submit(Callable&lt;T&gt; task) { return super.submit(new ContextAwareCallable(task, RequestContextHolder.currentRequestAttributes())); } @Override public &lt;T&gt; ListenableFuture&lt;T&gt; submitListenable(Callable&lt;T&gt; task) { return super.submitListenable(new ContextAwareCallable(task, RequestContextHolder.currentRequestAttributes())); } } Callable: public class ContextAwareCallable&lt;T&gt; implements Callable&lt;T&gt; { private Callable&lt;T&gt; task; private RequestAttributes context; public ContextAwareCallable(Callable&lt;T&gt; task, RequestAttributes context) { this.task = task; this.context = context; } @Override public T call() throws Exception { if (context != null) { RequestContextHolder.setRequestAttributes(context); } try { return task.call(); } finally { RequestContextHolder.resetRequestAttributes(); } } } Configuration: @Configuration public class ExecutorConfig extends AsyncConfigurerSupport { @Override @Bean public Executor getAsyncExecutor() { return new ContextAwarePoolExecutor(); } }
accepted answer of: http://stackoverflow.com/q/23732089
has comment: http://stackoverflow.com/comment/99917719
has comment: http://stackoverflow.com/comment/103091562
has comment: http://stackoverflow.com/comment/80883530
has comment: http://stackoverflow.com/comment/80988640
has comment: http://stackoverflow.com/comment/100688656
has comment: http://stackoverflow.com/comment/64853557
has comment: http://stackoverflow.com/comment/99320749
score: 101
has comment: http://stackoverflow.com/comment/80167231
has comment: http://stackoverflow.com/comment/80142424
has comment: http://stackoverflow.com/comment/99176905
has comment: http://stackoverflow.com/comment/72359159
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/99233993
downvote count: 0
has comment: http://stackoverflow.com/comment/137571676
has comment: http://stackoverflow.com/comment/136135150
has comment: http://stackoverflow.com/comment/99130490
answers question: http://stackoverflow.com/q/23732089
has comment: http://stackoverflow.com/comment/122502485
upvote count: 101
has comment: http://stackoverflow.com/comment/78557484

http://stackoverflow.com/q/23748085
tagged with: image
has title: Getting JLabel Size
type: Question
upvote count: 0
answer count: 1
favorite count: 0
tagged with: jlabel
has body: I am trying to fit the image on JLabel but I cannot get Width or Height. I think because jLabel1 is not instantiated. But I drawed in design panel. Anyway how can I do it? I created JFrame, JPanel (jPanel1) and JLabel (jLabel1). (On the netbeans) Here is my code: public class ImageProcessing extends javax.swing.JFrame { Image image; public ImageProcessing() { setSize(640, 480); setVisible(true); ImageIcon icon = new ImageIcon("D:\\timeline.jpg"); image = icon.getImage(); Image newImg = image.getScaledInstance(jLabel1.getHeight(), jLabel1.getWidth(), java.awt.Image.SCALE_SMOOTH); ImageIcon i1 = new ImageIcon(newImg); jLabel1 = new JLabel(i1); getContentPane().add(jLabel1); }
has answer: http://stackoverflow.com/a/23748222
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/36510320
tagged with: java
score: -1

http://stackoverflow.com/comment/36486969
type: Comment
score: 0
has text: I checked it using `BufferedImage img = ImageIO.read(new URL("http://www.cityrider.com/fixed/43aspect.png"));` in the second line and it works just fine, returning true. Maybe your image isn't really fully alpha? Then you might want to check if it less than a threshold. (So don't compare for != 0 in the if-statement but check for <= 10 or some similiar value)
type: AnswerComment
comment on: http://stackoverflow.com/a/23735292

http://stackoverflow.com/comment/123446404
type: Comment
has text: this is over complicated, using Gson can be much simpler.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/48490088

http://stackoverflow.com/q/23677746
type: Question
has comment: http://stackoverflow.com/comment/36414832
score: -1
has answer: http://stackoverflow.com/a/23679143
tagged with: encryption
accepted answer: http://stackoverflow.com/a/23679143
answer count: 1
downvote count: 1
tagged with: java
type: AnsweredQuestion
has body: Here is my dilemma. I am trying to decrypt some value from a URL parameter. My code is below import java.net.URLDecoder; import java.net.URLEncoder; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class EncTest { public static String decryptString(String str, String key) throws Exception { str = URLDecoder.decode(str, "UTF-8"); String result = java.net.URLDecoder.decode(str, "UTF-8"); byte[] keyBytes = key.getBytes("UTF-8"); SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "DESede"); Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, keySpec); BASE64Decoder base64decoder = new BASE64Decoder(); byte[] clrtxt = base64decoder.decodeBuffer(result); byte[] cphtxt = cipher.doFinal(clrtxt); StringBuffer sBuffer = new StringBuffer(); for (int i = 0; i &lt; cphtxt.length; i++) { sBuffer.append((char) cphtxt[i]); } return sBuffer.toString(); } public static String encryptString(String str, String key) throws Exception { byte[] keyBytes = key.getBytes("UTF-8"); SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "DESede"); Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, keySpec); byte[] clrtxt = str.getBytes("UTF8"); byte[] cphtxt = cipher.doFinal(clrtxt); BASE64Encoder base64encoder = new BASE64Encoder(); return URLEncoder.encode(base64encoder.encode(cphtxt), "UTF-8"); } I read in some other posts that I should not be using sun.misc.BASE64* but I don't know how to use the Apache version. Now, the problem starts when I decrypt the value. I see some funky chars like : +T??td? I run some tests by encrypting some string then decrypting the same string and these weird chars appear. What am I doing wrong here?
upvote count: 0
has title: issues with decryption of a URL parameter
favorite count: 0

http://stackoverflow.com/comment/36455926
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23701354
has text: I converted to the type CV_32F. It still shows the same exception

http://stackoverflow.com/comment/36308953
comment on: http://stackoverflow.com/q/23642734
score: 0
has text: I suspect the hotel list returned is not the same order on every invoke. In addition, it is always taking the last element in the list and doing calculation based on that hotel. I suspect the last element of the list is different.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23817249
upvote count: 1
answers question: http://stackoverflow.com/q/23743860
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23743860
type: Answer
has body: Now problem is fixed, the problem is that for native C code, originally I wrote it like this: JNIEXPORT void JNICALL Java_jniWrapper_wlsAcc instead, the correct way should be: JNIEXPORT void JNICALL Java_affy_qualityControl_jniWrapper_wlsAcc

http://stackoverflow.com/q/23620233
tagged with: jtextpane
tagged with: swing
tagged with: jbutton
tagged with: java
has body: I've made a simple chat server/client and have this problem when the user clicks the button I want the button to change to "disconnect", write some stuff on a JTextPane object and do the connection. the problem is nothing gets updated until the connection is made, the button gets stuck, also any writing to the JTextPane object is only seen after the connection (about 5-10 seconds). any solution/advice? connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (!running) { SwingUtilities.invokeLater(new Runnable() { public void run() { connectButton.setText("disconnect"); } }); running = true; connect(); } else { connectButton.setText("connect"); running = false; disconnect(); } }
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23620427
score: 0
has answer: http://stackoverflow.com/a/23624510
has title: JButton gets stuck until connection is made...
has comment: http://stackoverflow.com/comment/36264808
type: UnansweredQuestion

http://stackoverflow.com/a/23748248
accepted answer of: http://stackoverflow.com/q/23735004
type: Answer
score: 2
upvote count: 2
has body: If the incorrect BER/DER encoding of ASN.1 integers - which are stored as signed big endian, right aligned octets - is indeed the culprit then Bouncy does not have a bug. Positive values should be left padded with a 00 valued byte if the first bit of the encoding is set, otherwise it would represent a negative value. The Sun provider is wrong to allow those kind of signatures to verify, and the other party is of course generating invalid signatures. Note that it is possible to let the signatures verify without this "fix" within the Sun code: simply adjust the encoding before feeding it to the verification function. The only time when this is not possible is when the DSA verification is called as a generic signature verification method from another library instead of from an application that can adjust the data before the call. On the other hand, I think you've created an elegant fix. The only issue with it is that it may not run if the provider's signature is verified from a JCA compliant framework. The other possible fix is to re-encode before feeding it into the Signature class for verification. Note that I don't see how this could be a security issue; the signature consists of the values of R and S, and it does not matter how they are encoded, as long as you receive the correct values in the end.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23735004
has comment: http://stackoverflow.com/comment/36517988

http://stackoverflow.com/comment/36342253
has text: Ok, for instance, i have two windows, in one of which i can change some data and so change the picture in the other window. And the window with the picture is a child of the data window. The problem is the picture window overlapping the data window so it's hard to change information in it. I believe that can clarify the problem.
comment on: http://stackoverflow.com/q/23658623
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36493665
has text: this works only for the first click.. My window dont get all other KeyDowns
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23739246
score: 0

http://stackoverflow.com/q/23639334
has body: I am trying to write a code for postfix evaluation but I get a error as java.lang.String cannot be cast to java.lang.Integer and the problem is in the linesobj1=(int) calStack.topAndpop();.The problem is my ArrayStack topAndpop() method returns a Object type as public Object topAndpop() throws EmptyStackException{ Object returnPop; if (isEmpty()) throw new EmptyStackException("Stack empty"); else{ returnPop=top(); pop(); } return returnPop; and I should be able to convert this into int type.I can't see anything wrong apart from this line.Can someone point me how to correct this please import java.lang.Math; public class Calculate{ double result=0; int obj1,obj2; public Object cal(String expression) throws OverFlowException,EmptyStackException{ String[] array = expression.split("");//remember // for (int i=0;i&lt;array.length;i++) // System.out.println(array[i]); ArrayStack calStack=new ArrayStack(array.length); for(int i=0;i&lt;array.length;i++){ if(!(array[i].equals("+") || array[i].equals("-")||array[i].equals("/") || array[i].equals("*"))){ calStack.push(array[i]); //calStack.print(); } else { obj1=(int) calStack.topAndpop();//check how this casting is done obj2=(int)calStack.topAndpop(); result=calculate(obj2,obj1,array[i]); System.out.println(result); calStack.push(result); } } return calStack.topAndpop(); } public double calculate(int a,int b,String op){ if(op=="+") return a+b; else if(op=="-") return a-b; else if(op=="/") return a/b; else if (op=="^") return Math.pow(a,b); else return a*b; } public static void main (String args[]) throws OverFlowException,EmptyStackException{ Calculate c=new Calculate(); System.out.println("result"+c.cal("623+-382/+*2^3")); } }
has title: Evaluating postfix expression using stacks in java
type: AnsweredQuestion
tagged with: stack
tagged with: java
possible better answer: http://stackoverflow.com/a/23639461
type: Question
has answer: http://stackoverflow.com/a/23639461
has answer: http://stackoverflow.com/a/23639419
tagged with: data-structures
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23639419
has comment: http://stackoverflow.com/comment/36301790
has answer: http://stackoverflow.com/a/23639546

http://stackoverflow.com/comment/76068851
comment on: http://stackoverflow.com/a/33919078
type: AnswerComment
has text: Add updateItem(item,false) after firing the event to show the commited item in te table cell.
type: Comment
score: 3

http://stackoverflow.com/comment/36328863
type: Comment
comment on: http://stackoverflow.com/q/23650349
type: QuestionComment
has text: @Kayaman No, I described my actual problem: I tried to make hard timeouted java api calls. And I finally got my answer: in Java it is impossible. And later I found out, that it is impossible even with threads: because they can only be stopped if they are wanted to. So, I have a trivial problem, which hasn't a working solution because in case of Java can't the trivial problems often be solved.
score: 0

http://stackoverflow.com/comment/36376728
score: 0
has text: `@PostConstruct` is your friend. As long as your class is registered with Jersey, a method annotated with `@PostConstruct` will be called after the the class is instantiated and the injections are completed and before any service calls are executed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23673840

http://stackoverflow.com/comment/36378561
type: AnswerComment
comment on: http://stackoverflow.com/a/23676693
score: 0
type: Comment
has text: I understand that you want output from certain commands. I noticed that $SUDO_USER is set by sudo and shows the username of the user which executed sudo.

http://stackoverflow.com/q/23681372
has answer: http://stackoverflow.com/a/23681467
downvote count: 0
has answer: http://stackoverflow.com/a/23681420
favorite count: 0
tagged with: writer
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/23681467
has comment: http://stackoverflow.com/comment/36383435
accepted answer: http://stackoverflow.com/a/23681420
type: AnsweredQuestion
has title: Buffered Writer: write an ArrayList to a file
upvote count: 1
has body: we want to write the content of an ArrayList (images with a longitude and latitude) to a file (.csv or txt, doesn't matter). We know that there is something wrong with the bw.write(), but we didn't get how we can manage it. Someone an idea? Here is our code: /** * Test if stadium contains image */ public void RemStaImSB(){ Mbb mbb = new Mbb(1,new Point (1,-0.192423,51.480788),new Point(2,-0.189537,51.482646)); int i = 0; imgOut = new ArrayList&lt;Image&gt;(); for(Image im: this.img){ if(mbb.piMbb(im)==false){ imgOut.add(im); } i++; } System.out.println("Reporting the images "+i); } /** * Test if stadium contains image */ public void main() throws Exception{ //Declarations File outputFile; BufferedWriter bw; //Create outputFile object outputFile = new File ("Chelsea.txt"); //Create stream - file is created bw= new BufferedWriter(new FileWriter(outputFile)); //Send data thorugh file writer bw.write(imgOut.lat &amp; imgOut.lon); //Close the writer bw.close(); }
type: Question
score: 1
tagged with: java
answer count: 2

yammer
type: Tag
tags question: http://stackoverflow.com/q/23681560
tag name: yammer

http://stackoverflow.com/q/23669960
answer count: 3
score: 3
has comment: http://stackoverflow.com/comment/36367642
has answer: http://stackoverflow.com/a/59454921
favorite count: 0
upvote count: 3
has title: First level cache not working with JPA and Hibernate
tagged with: spring
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23671023
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23674128
linked to: http://stackoverflow.com/q/21672454
tagged with: caching
has answer: http://stackoverflow.com/a/23674128
accepted answer: http://stackoverflow.com/a/23671023
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/36361437
has comment: http://stackoverflow.com/comment/36361401
has body: I an new to use hibernate caching (first level, 2nd level and query cache). My project is configured using Spring MVC and JPA. I am testing first level cache using JUnit test case below. public class FirstLevelCacheTest { private static final Logger logger = LoggerFactory.getLogger(FirstLevelCacheTest.class); @PersistenceContext private EntityManager entityManager; @Test public void testFirstLevelCacheTest() { Long clientId = 1L; // fetch the client entity from database first time Client client1 = entityManager.find(Client.class, clientId); logger.debug("Client Name : {}", client1.getName()); // fetch the client entity again client1 = entityManager.find(Client.class, clientId); logger.debug("Client Name : {}", client1.getName()); } } And my entity class is defined as : @Entity @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) @Table(name = "client") public class Client extends BaseModel { // instance variable declaration // getter and setter methods for instance variables } This should execute native query once in case first level cache is by default enabled. But I am getting result below while executing this query: Hibernate: select client0_.id as id0_0_, client0_.created as created0_0_, client0_.createdBy as createdBy0_0_, client0_.updated as updated0_0_, client0_.updatedBy as updatedBy0_0_, client0_.contactNo as contactNo0_0_, client0_.contactPerson as contactP7_0_0_, client0_.contactPersonEmail as contactP8_0_0_, client0_.contactPersonNo as contactP9_0_0_, client0_.email as email0_0_, client0_.name as name0_0_ from client client0_ where client0_.id=? [main] DEBUG Client Name : Client1 Hibernate: select client0_.id as id0_0_, client0_.created as created0_0_, client0_.createdBy as createdBy0_0_, client0_.updated as updated0_0_, client0_.updatedBy as updatedBy0_0_, client0_.contactNo as contactNo0_0_, client0_.contactPerson as contactP7_0_0_, client0_.contactPersonEmail as contactP8_0_0_, client0_.contactPersonNo as contactP9_0_0_, client0_.email as email0…

http://stackoverflow.com/comment/48734581
score: 0
type: QuestionComment
has text: Ok guys i have found the solution thanks to `nhaarman` http://stackoverflow.com/questions/28843304/how-to-run-a-simple-junit4-test-in-android-studio-1-1
type: Comment
comment on: http://stackoverflow.com/q/23632169

http://stackoverflow.com/q/23735872
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36487660
has answer: http://stackoverflow.com/a/23735928
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36486738
type: Question
has comment: http://stackoverflow.com/comment/36486760
tagged with: oop
tagged with: java
has body: I am working on a multiplayer game.. and i came up with a really weird situation. It's even possible? - System.out.println(foo); // left System.out.println(foo instanceof String) // true System.out.println(foo == "left") // false I don't understand how it's even possible.. I really don't think it will be a good idea to post all of my code. Any ideas why its like that? and how can i fix it? Thanks in advance
has title: Weird issue with String
has comment: http://stackoverflow.com/comment/36486697
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36486768
answer count: 1
has comment: http://stackoverflow.com/comment/36486679
tagged with: string
has comment: http://stackoverflow.com/comment/36486692
has comment: http://stackoverflow.com/comment/36486641
score: 0

http://stackoverflow.com/comment/36520162
type: Comment
comment on: http://stackoverflow.com/q/23753342
has text: Do not rely on InputStream.available(). This is only an estimation.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23746705
downvote count: 0
answers question: http://stackoverflow.com/q/23746614
type: Answer
score: 3
upvote count: 3
has body: The second option is not possible. ArrayList has only one template parameter. What you can do is this: class MyClass { EnumClassName name; long l; ... // getters and setters } Then declare your array list like this: List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;();

http://stackoverflow.com/a/23616218
downvote count: 0
score: 1
upvote count: 1
has body: Pass the path directly like this. ImageIcon image = new ImageIcon("c://somepath//image.png"); I dont know, how MineSweeper is helpful here
has comment: http://stackoverflow.com/comment/36256701
type: Answer
answers question: http://stackoverflow.com/q/23616037

http://stackoverflow.com/q/23725531
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/36470150
has comment: http://stackoverflow.com/comment/36468534
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36470063
type: UnansweredQuestion
tagged with: android
has title: Libgdx PanStop missing
has body: I have been using an InputHandler class which implements GestureListener and had some code in panStop. After I did an update of libgdx (on 18.05.14) for my project, @Override is no longer accepted for this method. Since then my logic is broken. I checked the GestureListener class and it's not in there. Has it been removed? Should I be using something else from now on? I was using it to be able to handle a tap while panning.
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36470789

http://stackoverflow.com/comment/36306328
comment on: http://stackoverflow.com/q/23641336
has text: No. That doesn't remove the spaces from a single string after it has been pulled out of the arraylist.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23755446
type: AcceptedAnswer
downvote count: 0
has body: 1) As pointed out in above answers, for MySql you should use Class.forName("com.mysql.jdbc.Driver"); 2) Make sure you have jar in classpath. You can download jar from mvnrepo MVNREPO 3) Port is 3306 for MySql? And a quick google for JAVA + MYSQL gives me this tutorial
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23754456
answers question: http://stackoverflow.com/q/23754456
has comment: http://stackoverflow.com/comment/36525787

http://stackoverflow.com/q/23748186
favorite count: 0
has answer: http://stackoverflow.com/a/23748210
has comment: http://stackoverflow.com/comment/36510363
answer count: 3
has answer: http://stackoverflow.com/a/23748204
upvote count: 2
type: UnansweredQuestion
has title: What is the purpose of concatenating a string and an integer?
linked to: http://stackoverflow.com/q/23756966
has answer: http://stackoverflow.com/a/23748266
tagged with: java
downvote count: 3
score: -1
has body: This method returns true if the number passed in contains a 1. public boolean hasOne(int n) { return (n + "").contains("1"); } What is the purpose of the + "" part? How does that make n a string? (.contains only works with Strings as far as I understand).
type: Question
tagged with: string

http://stackoverflow.com/comment/36282364
has text: check your xml file again,
comment on: http://stackoverflow.com/q/23628771
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36340524
has text: yes ........... usually a screenshot can give you visual clues on where to break it down into custom panels.
comment on: http://stackoverflow.com/a/23658886
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23646160
has body: this behaviour is totally explainable for your code. you have a few mistakes. As you may know 30k! is a really big number. NDK: you are using a single loop, doing 30k multiplications - this happens very fast indeed you are using jlong (a limited 64 bit signed int) after about 20! it will overflow so your results are of course wrong Android: BigInteger allocates memory in order to store your infinite number. each operation is increasingly difficult, the multiplication operation becoming increasingly complex you have prints in the loop (or worse, SetText() on the UI!) - never include them in your measurements, they take time
has comment: http://stackoverflow.com/comment/36315176
score: 0
has comment: http://stackoverflow.com/comment/36323369
type: Answer
answers question: http://stackoverflow.com/q/23640341
has comment: http://stackoverflow.com/comment/36315691

http://stackoverflow.com/q/23628512
has comment: http://stackoverflow.com/comment/36280367
type: UnansweredQuestion
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/36280291
has title: can concurrent hashmap handle up to 10000 threads without deadlock?
has answer: http://stackoverflow.com/a/23630282
tagged with: java
has comment: http://stackoverflow.com/comment/36280273
has comment: http://stackoverflow.com/comment/36280248
answer count: 2
has answer: http://stackoverflow.com/a/23628558
score: 0
has body: I have an application that spawns up to 10,000 threads. each of this threads would be updating a Hashmap. I know Hashmaps are not thread safe and hear concurrent hashmaps are thread safe. So can a cuncurrent hashmap handle this scenario with up to 10,000 threads updating it without a deadlock?

http://stackoverflow.com/comment/36567635
type: AnswerComment
has text: is it not working Soundar
comment on: http://stackoverflow.com/a/23778021
type: Comment
score: 0

http://stackoverflow.com/q/23722251
favorite count: 0
has comment: http://stackoverflow.com/comment/36461085
has comment: http://stackoverflow.com/comment/36460895
tagged with: generics
downvote count: 0
has comment: http://stackoverflow.com/comment/36460932
score: 2
type: AnsweredQuestion
tagged with: java
has body: I have a method, &lt;T&gt; void method(T element,Collection&lt;T&gt; list), I am able to call it as method("A",list), where list can be List&lt;String&gt; or List&lt;Object&gt; But fails if I call method(new Object(),list) where list is List&lt;String&gt; Thanks in advance.
has comment: http://stackoverflow.com/comment/36461046
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36461083
possible better answer: http://stackoverflow.com/a/23722401
has comment: http://stackoverflow.com/comment/36460853
answer count: 2
has comment: http://stackoverflow.com/comment/36460988
has answer: http://stackoverflow.com/a/23722401
has answer: http://stackoverflow.com/a/23722803
accepted answer: http://stackoverflow.com/a/23722803
has title: How to call a generic method?

http://stackoverflow.com/comment/36295960
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23635175
has text: (1) no it shouldn't make a difference (to the value of `f.barArr` - it does make a difference in terms of scope of course) (2) because I placed them all in my Test class. I could have made them non-static top level classes too. (3) `public Bar() {}` is equivalent to no constructor at all - if you don't need to do anything special in the constructor then you don't need one.

http://stackoverflow.com/q/23747060
has title: Junit/Hamcrest - Does any of the specified text appear on the page?
accepted answer: http://stackoverflow.com/a/23747149
has body: I am trying to use Junit and Selenium WebDriver to find misspelled words, from a word bank, on a website. I am also using Hamcrest which is now included in Junit. @Test public void filter() throws Exception { driver.get("http://www.ExampleWebsite.org/selenium-filter-test/"); WebElement body = driver.findElement(By.xpath("//*")); String content = body.getText(); assertThat(content, anyOf ( equalTo("foo"), equalTo("Charoit"), equalTo("Micha"))); } The problem is that I am having issues comparing what is on the page to the three words in the test. I think the specified string "content" is comparing all of the text on the page as one whole string. I need it to find if any of those words are contained in "content." Am I approaching this the correct way? Or would you recommend something better? Thank You. Micah
has answer: http://stackoverflow.com/a/23747148
type: AnsweredQuestion
tagged with: junit
possible better answer: http://stackoverflow.com/a/23747148
type: Question
has answer: http://stackoverflow.com/a/23747149
score: 0
tagged with: java
answer count: 2
tagged with: selenium

http://stackoverflow.com/comment/36537715
type: AnswerComment
has text: I haven't get null it's retrieve entered value but I want to know is it stored in context or not.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23762350

http://stackoverflow.com/a/23752124
has comment: http://stackoverflow.com/comment/36633353
accepted answer of: http://stackoverflow.com/q/23741110
has comment: http://stackoverflow.com/comment/36987786
answers question: http://stackoverflow.com/q/23741110
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36561621
has body: I need to check this as I'm away from a pc, but you need to increment the second argument by System.currentTimeInMillis(). What i think is happening is the alarm is detecting the time to trigger as being in the past, so it fires immediately. You need to change: alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, 60*60*1000, (60*60*1000)/2, pIntent); To: alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeInMillis() + 60*60*1000, (30*60*1000), pIntent); However, since you are going to set the alarm everytime the widget is updated, can I recommend you change this from setRepeating to set. Otherwise, what will currently happen is your widget will update every hour only. Use Alarm Manager.set instead. Edit: After reading your comment, please try this for AlarmManager.set, which is similar to what you were using before. alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+30*60*1000, pIntent); or if you wish to use your the different mode as per your comment, do: alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealTime()+30*60*1000, pIntent); This will send the PendingIntent every 30 minutes, which will call onUpdate() in your widget, which will send the PendingIntent, etc. In using AlarmManager, you have to realise the different modes you can use, as each require a different definition of time to supply. AlarmManager.RTC &amp; AlarmManager.RTC_WAKEUP require the starting time period to be defined using System time since start of Epoch. AlarmManager.ELAPSED_REALTIME &amp; AlarmManager.ELAPSED_REALTIME_WAKEUP require your start time to be defined using time since boot (SystemClock.elapsedRealTime()). So in both instances, you are defining the start time in GLOBAL time ie the internal clock is at time A, you want the alarm to refresh the widget in 30 mins, so you have to tell the AlarmManager to send the PendingIntent in A+30mins. AlarmManager.setRepeating also takes a 3rd parameter, which is the subsequent delta in…
has comment: http://stackoverflow.com/comment/36559451
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36564728

http://stackoverflow.com/comment/36405390
comment on: http://stackoverflow.com/a/23692632
score: 2
type: AnswerComment
has text: @user2627018 any Java code in scriptlets **are not** in client side. They are in server side and only serve to generate the HTML output. Once the HTML is rendered, there's no way to interact with Java (server side) unless you fire a request.
type: Comment

http://stackoverflow.com/a/23682952
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23666101
has comment: http://stackoverflow.com/comment/36387499
has body: the adapter.notifyDataSetChanged() should do the JOB, what you need to make sure is if the List itemsList you are manipulating outside the Adapter is the exact same instance that the Adapter is holding internally. If the notifyDataSetChanged() isn't working for you, that is definitely the case. Your adapter might also be holding a 'copy' of the list you provided in the constructor, so your changes on the original list won't be reflected...maybe you can introduce a method to the adapter like: adapter.setItems(List items) to ensure the items are really set You don't need to call invalidateViews() on a ListView...all you need to do is make sure the Adapter has the correct list to display and trigger notifyDataSetChanged().
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36261496
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23618522
has text: This still only fixes one of my problems and not the major problem I am having. Appreciate the help, I'll edit my code shortly to adjust for your fix.
score: 0

http://stackoverflow.com/comment/36354705
comment on: http://stackoverflow.com/q/23665537
score: 1
has text: Could it be that you have auto-commit ON when you run it through query analyzer, but OFF when you run it through your Java program? Just a guess.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24281168
has body: Ref: https://groups.google.com/forum/#!topic/appium-discuss/A6kAET0C7nc For real iOS device, it is not possible to capture safari web page from mac using java code.
answers question: http://stackoverflow.com/q/23678092
score: 0
type: Answer

http://stackoverflow.com/comment/36510490
type: Comment
comment on: http://stackoverflow.com/a/23747149
score: 0
type: AnswerComment
has text: Thank you so much for the comment. I am looking into this more to better understand it.

http://stackoverflow.com/q/23641113
has comment: http://stackoverflow.com/comment/36328397
tagged with: executorservice
favorite count: 0
tagged with: threadpoolexecutor
has comment: http://stackoverflow.com/comment/36305632
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23642504
tagged with: multithreading
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/36305329
upvote count: 3
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36305382
has body: I want to ask for a little more detail to the same question posted by Zeller over a year ago... The javadoc says that the service returned by Executors.newCachedThreadPool reuses threads. How is this possible? I get how the queue structure is setup internally, what I don't see is how it reuses threads in the queue. All examples I've seen have the developer create an instance of their thread and pass it in through the "execute" method. For example... ExecutorService executor = Executors.newCachedThreadPool(); for (int i = 0; i &lt; 10; i++) { Runnable worker = new WorkerThread(i); //will create 10 instances executor.execute(worker); } I understand that a thread pool can easily manage the life cycle of each thread, but again, I see no methods nor the ability to access or restart any of the threads in the pool. In the above example, I would then expect that each thread would be started, run, terminated and disposed of by the thread pool, but never reused. A messaging system would be an example of where you'd need this. Say you have an onMessage handler and you'd like to reuse one of the threads in the pool to handle it, so I'd expect methods like... worker = executor.getIdleThread; worker.setData(message); executor.resubmit(worker); or maybe have the ExecutorService acting as a factory class and have it return an instance of your threads, where internally it decides to create a new one or reuse an old one. ExecutorService executor = Executors.newCachedThreadPool(WorkerThread); Runnable worker = executor.getThread; worker.setData(message); So I'm missing something. It's probably something simple but I've spent the afternoon reading tutorials and examples and still haven't figured it out. Can someone shed some light on the subject?
has answer: http://stackoverflow.com/a/23641624
tagged with: threadpool
has title: How does newCachedThreadPool reuse threads?
has comment: http://stackoverflow.com/comment/36305430

http://stackoverflow.com/a/23693920
has body: If you want the text to be ordered based on its position on the page, you need to introduce a specific strategy, such as the LocationTextExtractionStrategy: for (int i = 1; i &lt;= reader.getNumberOfPages(); i++) { String str=PdfTextExtractor.getTextFromPage(reader, i, new LocationTextExtractionStrategy()); } The LocationTextExtractionStrategy sometimes results in odd sentences, more specifically if the letters 'dance' on the page (the baseline of the glyphs differs for text on the same line). In that case, you can try the SimpleTextExtractionStrategy which will return the text in the order in which it appears in the PDF syntax content stream.
score: 3
has comment: http://stackoverflow.com/comment/36407811
downvote count: 0
has comment: http://stackoverflow.com/comment/63593535
answers question: http://stackoverflow.com/q/23693706
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23693706
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/36407773

http://stackoverflow.com/a/23691164
has body: If you have a look at the Color API http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html you will see that there is a Field called YELLOW http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html#YELLOW but there is not one called chosenColor. In your example there is absolutely not need to use reflection, rather try if (chosenColor.equals("BLUE")) chosen = Color.BLUE; else if (chosenColor.equals("YELLOW")) chosen = Color.YELLOW;
has comment: http://stackoverflow.com/comment/36403190
has comment: http://stackoverflow.com/comment/36403322
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23691001
has comment: http://stackoverflow.com/comment/36403263
type: Answer
accepted answer of: http://stackoverflow.com/q/23691001

http://stackoverflow.com/comment/36350162
comment on: http://stackoverflow.com/a/23663748
score: 0
type: Comment
has text: It does not look like the OP's code avoids writing the input files: see the `new FileWriter(sourceFile).append(source).close()` line.
type: AnswerComment

http://stackoverflow.com/comment/36465642
comment on: http://stackoverflow.com/a/23722199
type: Comment
score: 0
has text: No this wont work. The problem is with the FileWriter. Since I created a File "Combined_Sym.csv" in the JAVA code so I could read from it , and simultaneously I am writing to a file of the same name using FileWriter. Some overlap is happening and in the second iteration of my loop the FileWriter doesnt write into the file as it is already filled ( hence there is an overwriting issue, so I need some help to understand how I can over write the file )
type: AnswerComment

http://stackoverflow.com/comment/36361696
has text: You got two donvotes for a rep of -4. Here's an upvote for +10. Quit your whining :-) (note the smiley!).
score: 0
comment on: http://stackoverflow.com/q/23670062
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23710181
tagged with: java-canvas
has comment: http://stackoverflow.com/comment/36438222
has comment: http://stackoverflow.com/comment/36438137
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36438173
has title: How to avoid flickering with bufferstrategy when updating Canvas
tagged with: java
has body: I am programming a platformer game in Java. Everything works fine and there are no bigger problems, except the flickering on the screen when the Canvas is updated. I'll roughly explain how my game "engine" works: In my main method, I have a Loop, that is repeating itself 30 times a second: while (play) { Date delay_time = new Date(); delay_time.setTime(delay_time.getTime() + (int) (1000*(1.0/FPS))); // Here is all the game stuff, like the motion of the player, // function calling, etc. Graphics g = can.getGraphics(); can.update(g); while(new Date().before(delay_time)) { } } My FPS variable is a static final int that is currently set to 30. So i am updating my Canvas 30 time a second. Play is a boolean, which controls if the game is still playing, or the player died. Can is an instance of my class MyCanvas.java. The Code of the paint() method looks like so: if (Main.play) { //NOW //Draw the now Level Caption //SIZE: 240 g2.setFont(new Font("Bank Gothic", Font.PLAIN, 240)); g2.setColor(new Color(Math.abs(bg.getRed() - 30), Math.abs(bg.getGreen() - 30), Math.abs(bg.getBlue() - 30))); g2.drawString("LEVEL " + Main.lvl, 80, 80 + 300 - Main.groundY); //Draw the ground g2.setColor(haba); g2.fillRect(0, Main.screenSize.height - Main.groundY, Main.screenSize.width, Main.groundY); //Draw the level g2.setColor(haba); for (int i = 0; i &lt; Main.LVLWIDTH; i++) { for (int j = 0; j &lt; Main.LVLHEIGHT; j++) { if (Main.level[i][j] == '1') { g2.fillRect(i*(Main.BLOCK_X), (j - Main.LVLHEIGHT)*(Main.BLOCK_Y) + Main.screenSize.height - Main.groundY, Main.BLOCK_X, Main.BLOCK_Y); } } //More drawing stuff... } So, as you can see, I am updating quite a lot - 30 times a second. This leads to the problem that my game (which is playing in fullscreen mode BTW) flickers all the time. How do solve that problem? Is a Bufferstrategy the right way? And if yes, how should I do it? Can you please explain the Bufferstartegy or provide links that have great tutorials or explanations, which or not to t…
has comment: http://stackoverflow.com/comment/36438254
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/24045571
score: 0
answer count: 1
tagged with: awt
accepted answer: http://stackoverflow.com/a/24045571

http://stackoverflow.com/a/30210356
type: Answer
has body: This seems to be an old post. However one solution would be to use source('path of R script') R command in your Java code to import the functionality written in external R script. There is also a blog on integration of R with Java [http://www.codophile.com/how-to-integrate-r-with-java-using-rserve/][1] which describes the process under heading 'Calling User-defined R functions in Java'
score: 0
answers question: http://stackoverflow.com/q/23696610

http://stackoverflow.com/a/23726282
has comment: http://stackoverflow.com/comment/36469159
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36468867
score: 1
accepted answer of: http://stackoverflow.com/q/23726260
answers question: http://stackoverflow.com/q/23726260
type: Answer
upvote count: 1
has body: As dataout is created inside the try/catch blocks its lifetime is only within these curly brackets. The best way would be to declare it as an instance variable and then access it like that. Eg. DataOutputStream dataout = null; try { System.out.println("Waiting for clients to connect..."); Socket s = ss.accept(); dataout = new DataOutputStream(s.getOutputStream()); System.out.println("Client connected!"); } catch(IOException e){ System.out.println("Error"); }
has comment: http://stackoverflow.com/comment/36469013
has comment: http://stackoverflow.com/comment/36469079

http://stackoverflow.com/comment/36508549
comment on: http://stackoverflow.com/q/23747294
score: 1
has text: Possible duplicate : http://stackoverflow.com/questions/3947080/progressdialog-does-not-want-to-update-the-message
type: Comment
type: QuestionComment

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/23760978
type: Tag
tags question: http://stackoverflow.com/q/23636748

http://stackoverflow.com/comment/36421568
type: AnswerComment
comment on: http://stackoverflow.com/a/23701359
type: Comment
has text: I am new to Jersey. You mean any object types ? even Collection classes can be sent.? What you meant is like as mentioned here: http://stackoverflow.com/questions/17541223/setting-content-type-encoding-in-jersey-rest-client
score: 0

http://stackoverflow.com/q/23621459
has comment: http://stackoverflow.com/comment/36268987
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36267200
tagged with: swing
has comment: http://stackoverflow.com/comment/36267272
has comment: http://stackoverflow.com/comment/36267522
upvote count: 0
linked to: http://stackoverflow.com/q/23602144
tagged with: java
has comment: http://stackoverflow.com/comment/36267406
type: Question
score: -2
has answer: http://stackoverflow.com/a/23621776
has title: Show an image when the mouse hovers over a JTable cell using the prepareRenderer method
has comment: http://stackoverflow.com/comment/36267439
tagged with: jtable
downvote count: 2
has comment: http://stackoverflow.com/comment/36269073
answer count: 1
has comment: http://stackoverflow.com/comment/36270593
duplicate of: http://stackoverflow.com/q/23602144
favorite count: 0
has body: I have a JTable created using this code : table = new JTable(new DefaultTableModel( new Object[][] { }, en_entete ) ) { public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { URL fileURL = null; try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost/test", "root", "root"); PreparedStatement ps = conn.prepareStatement("select name, img from table where id=1"); ResultSet rs = ps.executeQuery(); while (rs.next()) { String name = rs.getString("name"); File temp = File.createTempFile(name, ".jpg"); Blob blob = rs.getBlob("img"); int blobLength = (int) blob.length(); byte[] bytes = blob.getBytes(1, blobLength); blob.free(); BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes)); ImageIO.write(img, "jpg", temp); fileURL = temp.toURI().toURL(); } } catch (Exception ex) { ex.printStackTrace(); } html = "&lt;html&gt;&lt;body&gt;" + "&lt;img src='" + fileURL + "'&gt;"; Component c = super.prepareRenderer(renderer, row, column); if (c instanceof JComponent) { JComponent jc = (JComponent) c; jc.setToolTipText(html); } return c; } }; So when the mouse hovers over a cell of my JTable, the image show up. But I want that image to be different for each cell (changing the SQL request) and to be shown only for the first column. Thanks in advance
has comment: http://stackoverflow.com/comment/36267368

http://stackoverflow.com/a/23648546
upvote count: 1
score: 1
has body: Actually I found the solution to my problem, following annotation gives whatever there is after /assetViewCount/ into {path} @Path("/assetViewCount/{path:.*}")
answers question: http://stackoverflow.com/q/23639717
downvote count: 0
type: Answer

http://stackoverflow.com/a/31604646
upvote count: 1
answers question: http://stackoverflow.com/q/23659424
downvote count: 0
score: 1
type: Answer
has body: Previous answer is not right, because it works just thanks to "\n" end of lines added to each line, but in reality you may not have end of line on end of each HTML line...

http://stackoverflow.com/a/79116120
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23689137
has body: I'm currently working out this same problem myself and I'll give some of my observations while experimenting with this... You can create a wrapper object of a Callable that holds a reference to a ExecutorService. Now, you can have that Callable also submit a new Callable to the ExecutorService. If the parent Callable is not dependent on the completion of the child Callable, then this is really no different than having two entirely unrelated constructs submitting Callables to the same ExecutorService reference. The ExecutorService will eventually get both of them done - business as usual. However, things get more complicated if some of those Callables wait (i.e., call to .get() on the returned Future&lt;V&gt;) for the Callables they've submitted. Because obviously you now have a thread that is waiting on another thread to complete. This isn't inherently a bad situation, but it depends on a ton of things... How long will each Callable take? How many threads will you have? Can threads have timeouts? What's the incoming amount of payloads you'll need to process? E.g., 2 threads, three cascading Callables: Callable (1): Submits new Callable (2), who is waiting for it to complete Callable (2): Submits new Callable (3), who is waiting for it to complete Callable (3): Attempts to submit a new Callable, but no threads are available. What you have now is a textbook deadlock situation.

http://stackoverflow.com/a/55959153
score: -1
downvote count: 1
type: Answer
has body: The easiest way to deal with this is split the array into positive and negative sort and push the first two items from both the arrays into another array. Have fun! function closeToZeroTwo(arr){ let arrNeg = arr.filter(x =&gt; x &lt; 0).sort(); let arrPos = arr.filter(x =&gt; x &gt; 0).sort(); let retArr = []; retArr.push(arrNeg[0], arrPos[0]); console.log(retArr) }
upvote count: 0
answers question: http://stackoverflow.com/q/23760979

http://stackoverflow.com/a/42908813
has comment: http://stackoverflow.com/comment/105768596
upvote count: 69
has comment: http://stackoverflow.com/comment/124654923
has comment: http://stackoverflow.com/comment/109390849
answers question: http://stackoverflow.com/q/23696317
has comment: http://stackoverflow.com/comment/125384537
downvote count: 2
type: Answer
score: 67
has comment: http://stackoverflow.com/comment/97691441
has body: return dataSource.getParkingLots() .stream() .filter(parkingLot -&gt; Objects.equals(parkingLot.getId(), id)) .findFirst() .orElse(null); I had to filter out only one object from a list of objects. So i used this, hope it helps.

http://stackoverflow.com/a/23781084
downvote count: 0
score: 1
has body: Problem seems to be on the JasperPrint printer = JasperFillManager.fillReport(file, parametros,dados); line. Make sure that your report is found (file is not null). In order to show the report, what I usually do is put the resulted pdf in a stream, then create a streamResource with mimeType='application\pdf' and use window.open(resource) to show it. Example: StreamResource.StreamSource source = new StreamResource.StreamSource() { public InputStream getStream() { byte[] b = null; try { b = JasperRunManager.runReportToPdf(getClass().getClassLoader().getResourceAsStream("reports/report3.jasper"), map, con); } catch (JRException ex) { ex.printStackTrace(); } return new ByteArrayInputStream(b); } }; StreamResource resource = new StreamResource(source, "report3.pdf", getApplication()); resource.setMIMEType("application/pdf"); getApplication().getMainWindow().open(resource, "_new");
has comment: http://stackoverflow.com/comment/36580034
has comment: http://stackoverflow.com/comment/36617995
has comment: http://stackoverflow.com/comment/36576874
upvote count: 1
has comment: http://stackoverflow.com/comment/36581731
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23766146
accepted answer of: http://stackoverflow.com/q/23766146
type: Answer
has comment: http://stackoverflow.com/comment/36620053
has comment: http://stackoverflow.com/comment/36606580

http://stackoverflow.com/comment/36436229
has text: @LOL Ah OK. I'll remove that part from my answer and change the loop. My apologies for the misunderstanding.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23709279

http://stackoverflow.com/comment/36481752
score: 0
type: Comment
has text: I changed the code and used the observer pattern based on this [example](http://www.ootpapps.com/2013/02/android-observers-and-observables-how-to-update-activities-automatically-upon-data-changes/) but I don't get the TextViews updated. What could be wrong when I have 1 observer registered (found this using countObservers() in the Activity class) but when I check this in the class that extends Observable I have zero observers? The second question: what is the callback method that you mentioned above? Do I need one if I use the Observer pattern? Thank you in advance.
comment on: http://stackoverflow.com/a/23643656
type: AnswerComment

http://stackoverflow.com/comment/36405863
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23692943
type: QuestionComment
has text: Try [this](http://stackoverflow.com/questions/3615721/how-to-use-the-tostring-method-in-java)

http://stackoverflow.com/comment/36287649
has text: That string matches no better than OP's string.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23632331
type: Comment

http://stackoverflow.com/q/23725268
tagged with: android
has title: Unable to save highscore of game using shared preferences?
tagged with: java
tagged with: sharedpreferences
type: Question
has comment: http://stackoverflow.com/comment/36466755
has body: Here is my code for game i use to save high score SharedPreferences preferences = null; SharedPreferences.Editor editor = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); //Highscore.easyHigh = 0; Highscore.easyHigh = preferences.getInt("EasyScore", 0); Highscore.mediumHigh = preferences.getInt("MediumScore", 0); Highscore.hardHigh = preferences.getInt("HardScore", 0); Now i set these values when player looses the game editor = preferences.edit(); if(level==1) editor.putInt("EasyScore", score); else if(level==2) editor.putInt("MediumScore", score); else if(level==3) editor.putInt("HardScore", score); editor.commit(); Highscore is my class storing public static int easy, medium , hard? I get a null pointer exception but why does that happen?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23725286
has comment: http://stackoverflow.com/comment/36467830
has answer: http://stackoverflow.com/a/23725575
type: UnansweredQuestion

http://stackoverflow.com/a/23753323
has comment: http://stackoverflow.com/comment/36520491
has body: You should choose a monospace font. This will ensure that all characters have the same width.
type: Answer
score: 3
downvote count: 0
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23753274
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23753274
has comment: http://stackoverflow.com/comment/36520280

http://stackoverflow.com/a/23677305
accepted answer of: http://stackoverflow.com/q/23677293
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23677293
has body: You can check in you exception handler if the exception is type of FacesException That will give you the abillity to fitlter by exception type Try this ... Throwable rootCause = getRootCause(throwable); if (FacesException.class.isAssignableFrom(rootCause.getClass())) { // perform sepecfic logic // maybe you dont want to handle this exception }

http://stackoverflow.com/q/23683555
type: Question
tagged with: spring-security
has comment: http://stackoverflow.com/comment/36392905
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23684010
has body: I am currently trying to get my spring security based Webapp to authenticate the entered Username to several database columns. To be exact, I want the User to be able to use an Username OR Email OR Alias to login. Therefore I have written the following JdbcDaoImpl (the email feature is not yet implemented, but it should not make a difference) package de.dlr.gsoc.gssng.springSecurity; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.simple.ParameterizedRowMapper; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; public class CustomJDBCDaoImpl extends JdbcDaoImpl{ public CustomJDBCDaoImpl() { // TODO Auto-generated constructor stub super(); } /* (non-Javadoc) * @see org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl#loadUserAuthorities(java.lang.String) */ @Override protected List&lt;GrantedAuthority&gt; loadGroupAuthorities(String username) { String sql = "SELECT GroupAuthorities.Authority FROM Groups, GroupAuthorities, GroupMembers, Users WHERE (Users.Username = ? OR Users.Alias = ?) AND GroupMembers.Users_UserID = Users.UserID AND GroupMembers.Groups_GroupID = Groups.GroupID AND GroupAuthorities.Groups_GroupID = Groups.GroupID"; JdbcTemplate template = new JdbcTemplate(getDataSource()); CustomAuthority returnAuth = template.queryForObject(sql, new Object[] {username, username}, new AuthorityMapper()); ArrayList&lt;GrantedAuthority&gt; returnLi…
has answer: http://stackoverflow.com/a/23686719
type: UnansweredQuestion
tagged with: spring
tagged with: java
has title: Spring Security always authenticates with custom JdbcDaoImpl

http://stackoverflow.com/a/23723220
has comment: http://stackoverflow.com/comment/36462967
has body: Just a couple of things it seems to me you forgot your web context you shouldn't forward to MyServlet.java but you should use the mapping you specified in the web.xml Angelo
answers question: http://stackoverflow.com/q/23723189
score: 0
type: Answer

http://stackoverflow.com/comment/36462784
type: AnswerComment
score: 0
type: Comment
has text: `if its index in that array is a prime number`
comment on: http://stackoverflow.com/a/23723198

oop
tags question: http://stackoverflow.com/q/23735872
tags question: http://stackoverflow.com/q/23707950
tags question: http://stackoverflow.com/q/23673406
tags question: http://stackoverflow.com/q/23740638
tags question: http://stackoverflow.com/q/23762337
tags question: http://stackoverflow.com/q/23748857
tags question: http://stackoverflow.com/q/23777012
tags question: http://stackoverflow.com/q/23712645
tags question: http://stackoverflow.com/q/23669223
tags question: http://stackoverflow.com/q/23702555
tags question: http://stackoverflow.com/q/23771186
tags question: http://stackoverflow.com/q/23744582
tag name: oop
tags question: http://stackoverflow.com/q/23730416
tags question: http://stackoverflow.com/q/23767069
tags question: http://stackoverflow.com/q/23687297
tags question: http://stackoverflow.com/q/23708845
tags question: http://stackoverflow.com/q/23737074
tags question: http://stackoverflow.com/q/23718964
tags question: http://stackoverflow.com/q/23754763
tags question: http://stackoverflow.com/q/23648516
tags question: http://stackoverflow.com/q/23739333
tags question: http://stackoverflow.com/q/23653006
tags question: http://stackoverflow.com/q/23744049
tags question: http://stackoverflow.com/q/23748422
type: Tag
tags question: http://stackoverflow.com/q/23743755

http://stackoverflow.com/q/23630495
type: Question
answer count: 1
has title: JTable fireDataChanged duplicating cell values
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36284015
has answer: http://stackoverflow.com/a/23630755
tagged with: swing
type: AnsweredQuestion
tagged with: list
tagged with: abstracttablemodel
has body: I tried searching for the answer but I never found anyone having this problem. Basically what's happening is that the JTable that's supposed to show my objects is duplicating the value of last cell value into the cell before that. To be more specific I have a List of objects called "Artikl". Artikl has 4 values that I want to show in the table, String naziv, String drzava, Int kolicina and Float cijena. Lets say the values of those variables are naziv="x", drzava="y", kolicina=2, cijena=100 When adding the values to the object Artikl, and then adding the object to the List, everything works fine, the values are as they should be. The problem arises when I use artiklModel.fireDataChanged(); The values shown in the table are naziv="x", drzava="y", kolicina=100, cijena=100. I've been debugging for 2 days and cannot find the cause of this. I'll attach the necessary code below (I cannot add much more since it's a college project). public class Artikl { private int rbr; private float cijena; private String naziv; private String drzava; int kolicina; public int getRbr(){ return rbr; } public void setRbr(int rbr){ this.rbr = rbr; } public int getKolicina(){ return kolicina; } public void setKolicina(int kolicina){ this.kolicina = kolicina; } public float getCijena(){ return cijena; } public void setCijena(float cijena){ this.cijena = cijena; } public String getNaziv(){ return naziv; } public void setNaziv(String naziv){ this.naziv = naziv; } public String getDrzava(){ return drzava; } public void setDrzava(String drzava){ this.drzava = drzava; } } This is my TableModel: public class ArtiklModel extends AbstractTableModel{ private static final int COLUMN_NAZIV = 0; private static final int COLUMN_DRZAVA = 1; private static final int COLUMN_KOLICINA = 2; private static final int COLUMN_CIJENA = 3; private List&lt;Artikl&gt; listArtikl; private String[] columnNames; public ArtiklModel() { // initializes contact list this.listArtikl = new ArrayList&lt;Artikl&gt;(); // define co…
tagged with: java
accepted answer: http://stackoverflow.com/a/23630755

http://stackoverflow.com/a/23645586
has comment: http://stackoverflow.com/comment/36315214
has comment: http://stackoverflow.com/comment/36314865
has comment: http://stackoverflow.com/comment/36315331
has comment: http://stackoverflow.com/comment/36315247
downvote count: 0
answers question: http://stackoverflow.com/q/23645496
has comment: http://stackoverflow.com/comment/36315349
has comment: http://stackoverflow.com/comment/36315541
has body: The length of an array is an int, so you can't allow arrays with more than Integer.MAX_VALUE elements without breaking length. Breaking length would be huge; it would require source changes and recompilation all over the place. Given that you already have a length cap mandated by the length field, there's not a huge difference between a cap of Integer.MAX_VALUE or something like Integer.MAX_VALUE - 5.
has comment: http://stackoverflow.com/comment/36315401
type: Answer
has comment: http://stackoverflow.com/comment/36314797
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36315289

http://stackoverflow.com/comment/36519144
type: QuestionComment
comment on: http://stackoverflow.com/q/23752503
has text: What is the `<activity android:name="com.android.tsmirror.LoginScreen" >`? It is also called LoginScreen, but from another package...
score: 0
type: Comment

http://stackoverflow.com/q/23750542
favorite count: 0
has comment: http://stackoverflow.com/comment/36514949
has comment: http://stackoverflow.com/comment/36514889
has comment: http://stackoverflow.com/comment/36514786
has answer: http://stackoverflow.com/a/23750608
tagged with: list
has comment: http://stackoverflow.com/comment/36514813
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/23750656
accepted answer: http://stackoverflow.com/a/23750656
downvote count: 1
type: Question
type: AnsweredQuestion
has title: How to build an array from a list? (without ArrayList)
score: -1
has comment: http://stackoverflow.com/comment/36514868
possible better answer: http://stackoverflow.com/a/23750608
has body: I'm trying to build an array from a file that lists 43 countries along with 4 other specific information fields about them on their respective lines. I got the code I have to read the code (verified with echo print) but I'm not sure how to process the rest of the code so I can get some results in terms of output. public static void main(String[] args) throws IOException { // TODO code application logic here String inputString = null; String cName; String cCapital; String regionNum; int capitalPop; int region; File f = new File("Countries.txt"); FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); while (inputString != null) { cName = inputString.substring(0, 15).trim(); cCapital = inputString.substring(15, 30); capitalPop = Integer.parseInt(inputString.substring(55, 60)); inputString = br.readLine(); } br.close(); fr.close(); } The three lines in the while loop have sample values for trimming from the file's lines. I think my main problem is that I'm conceptually confused. Any input is appreciated. Thank you
answer count: 3
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/23750841

http://stackoverflow.com/comment/94158775
type: Comment
has text: This produces a list of names, not `Person`s.
comment on: http://stackoverflow.com/a/51167119
type: AnswerComment
score: 4

http://stackoverflow.com/a/76870130
type: Answer
answers question: http://stackoverflow.com/q/23722650
downvote count: 0
has body: for (Object o : linkedHashSet.reversed()) { System.out.println(o); } JEP 431: Sequenced Collections (release 9/19/23) in Java 21 has a reversed() method to LinkedHashSet. This reversed view of the LinkedHashSet can iterate in descending order.
score: 1
upvote count: 1

http://stackoverflow.com/a/23734046
has comment: http://stackoverflow.com/comment/36485264
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36484080
upvote count: 19
has body: The highest value that a short (which you're casting to) can represent is 32,767, after which it wraps around to -32768. XSSFSheet.createRow takes an int, so you don't need to cast your number.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36484692
score: 19
answers question: http://stackoverflow.com/q/23734004
accepted answer of: http://stackoverflow.com/q/23734004

http://stackoverflow.com/comment/36490478
has text: Any idea what's causing this NullPointerException?
comment on: http://stackoverflow.com/a/23737747
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23633454
has comment: http://stackoverflow.com/comment/36289605
has comment: http://stackoverflow.com/comment/36289624
has comment: http://stackoverflow.com/comment/36289581
accepted answer of: http://stackoverflow.com/q/23633287
has body: It seems like your Java Application is adding slashes to the string or as suggested in the comments the PHP app is probably adding slashes to the quotes to avoid SQL injection Try if you can get it to work by adding $data = stripslashes($data); Above the json_decode part
has comment: http://stackoverflow.com/comment/36289657
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23633287

http://stackoverflow.com/comment/36435439
has text: yeah that is fine, but can you please address my specific question? I am working on linux machine, I feel that unless you understand basics and how basic things works , you can't appreciate how further versions are beneficial
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23708705

http://stackoverflow.com/comment/36566417
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23777070
has text: and is there any way to avoid this?
type: AnswerComment

http://stackoverflow.com/comment/49323890
type: Comment
score: 1
type: AnswerComment
has text: When i use @JsonIgnore , that fileld is removed from my json ! any solution for this ?
comment on: http://stackoverflow.com/a/23632999

http://stackoverflow.com/q/23639823
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23639921
tagged with: android
has comment: http://stackoverflow.com/comment/36302565
tagged with: http://stackoverflow.com/tag/xml
score: 4
linked to: http://stackoverflow.com/q/23637615
has answer: http://stackoverflow.com/a/46198813
tagged with: java
answer count: 2
has title: XML layout to Java code converter
has body: I know that in Android all XML layout files are converted to Java code on compilation. Is there any way to have access to those java codes (layout in java)? Or if there isn't a way, is there any converters I can find? -- For example: XML layout: &lt;TextView android:layout_width="50px"&gt; &lt;/TextView&gt; Java code: TextView textview = new TextView(); textview.setWidth(50); -- As you can see, this is just a simple example, however, layouts are usually much longer. It would take a very long time to convert it line by line. Any suggestions?
possible better answer: http://stackoverflow.com/a/46198813
accepted answer: http://stackoverflow.com/a/23639921
has comment: http://stackoverflow.com/comment/36302544
upvote count: 4

http://stackoverflow.com/q/23668808
favorite count: 0
score: -1
tagged with: http://stackoverflow.com/tag/xml
downvote count: 2
has body: I am a first time Eclipse user and I am trying to create my first application on an Android emulator. So I just finished downloading the Android developer SDK package and I created the "My First App" application using the step-by-step tutorials provided there. I am now trying to learn how to be able to change the text and play around with the application. My question is: Which file do I code in to change the text/look of the application? I looked this question up and it said to do the edits (such as deleting the "Hello World" string and putting in whatever you would like) by editing the string.xml file which should be found in the res folder. I found my res folder in on the left but inside there is no "string.xml" file, I just have the android picture(of the robot), two text files, and the AndroidManifest.xml file. Also, to edit and change things in the application for Android is it all done in XML or Java? I always thought it was done with Java but it seems that it is mainly XML.
possible better answer: http://stackoverflow.com/a/23668856
upvote count: 1
has answer: http://stackoverflow.com/a/23668856
has answer: http://stackoverflow.com/a/23668968
has answer: http://stackoverflow.com/a/23668916
type: AnsweredQuestion
has title: Locate strings.xml file in the project res folder [Eclipse]
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23668968
answer count: 3
tagged with: android

http://stackoverflow.com/comment/36383900
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23681306
has text: Amazing! I thought it could be something like that, but I didn't expect 'to the power of'. Congratulations on an expertly explained answer, and thanks :)

http://stackoverflow.com/q/23729921
has answer: http://stackoverflow.com/a/23730010
accepted answer: http://stackoverflow.com/a/23744168
linked to: http://stackoverflow.com/q/1429172
downvote count: 0
tagged with: jar
favorite count: 0
has body: My problem is getting some CSS files from a foo.jar file. How can I get these CSS files from foo.jar? I found some ways, firstly by unzipping this .jar and copying files and then by deleting the unzipped folder. Is that a good way?
has comment: http://stackoverflow.com/comment/36476210
tagged with: file-io
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23744168
has comment: http://stackoverflow.com/comment/36476112
upvote count: 1
has comment: http://stackoverflow.com/comment/36476118
type: Question
has title: How can I get files in .jar file using java?
possible better answer: http://stackoverflow.com/a/23729978
has comment: http://stackoverflow.com/comment/36502409
has answer: http://stackoverflow.com/a/23730036
score: 1
has answer: http://stackoverflow.com/a/23729978
tagged with: java

http://stackoverflow.com/comment/36257721
comment on: http://stackoverflow.com/q/23616564
score: 0
type: Comment
has text: Where does the writer object get initialised?
type: QuestionComment

http://stackoverflow.com/a/23752149
type: Answer
has body: Description Resource Path Location Type The project was not built since its build path is incomplete. Cannot find the class file for java.lang.reflect.AnnotatedElement. Looks like your build-path is messed up somehow. Right-click on the project and goto properties --> configure build-path). You will be able to pin-point the issues in the build path from there. Make sure that everything is configured and referenced properly from the project and that the JDK(not jre) is also setup correctly.
answers question: http://stackoverflow.com/q/23751949
has comment: http://stackoverflow.com/comment/36517907
score: 0
has comment: http://stackoverflow.com/comment/36517890
has comment: http://stackoverflow.com/comment/36518162

http://stackoverflow.com/comment/36323270
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23649618
has text: Is it helpful to you? Try putting it in your application. :-)
score: 0

http://stackoverflow.com/comment/36259279
type: QuestionComment
has text: http://www.javaranch.com/journal/200711/creating_java_classes_runtime_expression_evaluation.html This looks perfect. Any opinions?
comment on: http://stackoverflow.com/q/23617274
score: 0
type: Comment

http://stackoverflow.com/a/23664828
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: I'd say you should iterate pressed List from the end to the start and remove the first occurrence of KeyEvent there that has the same KeyCode. Something like this: @Override public void keyReleased(KeyEvent k) { for (int i=pressed.size()-1;i&gt;=0;i--) { if (pressed.get(i).getKeyCode()==k.getKeyCode()) { pressed.remove(i); break; } } ......
answers question: http://stackoverflow.com/q/23664599

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/23770908

http://stackoverflow.com/comment/36316227
has text: The purpose of an interface is not to do things but to define what things the class implementing the interface "must" (not "can") do.
comment on: http://stackoverflow.com/a/23646839
type: AnswerComment
score: 0
type: Comment

variables
tag name: variables
tags question: http://stackoverflow.com/q/23726260
tags question: http://stackoverflow.com/q/23665945
type: Tag
tags question: http://stackoverflow.com/q/23633963
tags question: http://stackoverflow.com/q/23743755
tags question: http://stackoverflow.com/q/23712808
tags question: http://stackoverflow.com/q/23625976
tags question: http://stackoverflow.com/q/23744943
tags question: http://stackoverflow.com/q/23715651
tags question: http://stackoverflow.com/q/23640446

http://stackoverflow.com/q/23764903
upvote count: 4
score: 3
accepted answer: http://stackoverflow.com/a/23764927
answer count: 1
favorite count: 0
has body: How can I use a custom JDK path for Android Studio? I don't want to mess with PATH because I don't have admin rights. Is there a config settings file somewhere that allows me to set this up?
tagged with: path
has title: Manually setting JDK path for Android Studio
type: AnsweredQuestion
tagged with: android-studio
tagged with: java
has answer: http://stackoverflow.com/a/23764927
downvote count: 1
type: Question

http://stackoverflow.com/comment/36296632
comment on: http://stackoverflow.com/q/23636456
score: 0
type: Comment
type: QuestionComment
has text: I read the piece you gave me, and I will take your help. Thank you for that.

http://stackoverflow.com/a/49383055
type: Answer
answers question: http://stackoverflow.com/q/23691243
has body: Right click on WebSphere Application, then Server-&gt; Clean It will take some time to publish the server Now launching the application would resolve the issue.
score: 0

http://stackoverflow.com/comment/36510500
score: 0
type: AnswerComment
type: Comment
has text: NSjonas, yes I'm slowly picking things up... Will be a while though before things are clear...
comment on: http://stackoverflow.com/a/23705536

http://stackoverflow.com/q/23633644
has body: I have an existing database and I'd like to add the UNIQUE flag to one of the columns to prevent duplicates. What exactly would be the command to put in the onUpgrade section to achieve this?
tagged with: sql
tagged with: android
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/23633829
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/805363
tagged with: java
linked to: http://stackoverflow.com/q/9843229
type: Question
has answer: http://stackoverflow.com/a/23633829
duplicate of: http://stackoverflow.com/q/9843229
score: 0
has title: Android SQLite alter existing column add unique flag?

http://stackoverflow.com/comment/36562217
type: Comment
has text: Sadly. I can't use this since I can't change the `request` object in grails. Thanks for the help anyway, man.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23773600

http://stackoverflow.com/a/23751480
has comment: http://stackoverflow.com/comment/36516526
has body: If the time you are storing the time in millis, then You may use java.util.Date class and then use SimpleDateFormat to format the Date. Date date=new Date(millis); for example: long l = Long.parseLong("083752"); // mills DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(l); System.out.println(formatter.format(calendar.getTime())); This will return you the date
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23751411
type: Answer
answers question: http://stackoverflow.com/q/23751411
downvote count: 0
score: 1

http://stackoverflow.com/comment/36615348
type: AnswerComment
score: 0
type: Comment
has text: @Elliot If this solves your problem please consider accepting the answer, or upvoting if it was helpful.
comment on: http://stackoverflow.com/a/23762925

http://stackoverflow.com/q/23621258
type: Question
has answer: http://stackoverflow.com/a/23643693
accepted answer: http://stackoverflow.com/a/23643693
tagged with: playframework
answer count: 1
has body: I am trying Play framework 2.2.2 and again I am confused. I have an object (Card.java): @Entity public class Card extends Model { private static final long serialVersionUID = 1L; @Id public final int id; @ManyToOne public Person person; // Card owner @ManyToOne public Speciality speciality; // Card Speciality public Date beginDate; // Begin education date public Date endDate; // end education date @ManyToOne public School school; . . . } Also, I have a form like this (edit.scala.html): @(itemForm: Form[models.entities.Card], person: models.entities.Person, id: Int) @import helper._ @main("Personal card") { @helper.form(action = routes.Cards.save(person.id, id)) { @helper.select(itemForm("school"), options(models.entities.Person.schools()),'_label -&gt; "School name",'_showConstraints -&gt; false) @helper.select(itemForm("speciality"), options(models.entities.Person.specialities()),'_label -&gt; "Speciality name",'_showConstraints -&gt; false) . . . } } After filing form and submitting it, I get validation error for school and speciality fields. I think it's becouse type mismatch (integer and School for example). Is anybody has example such case of forms? How can I pass validation and set object field having only integer key value? Best regards and thanks for wasting your time for me.
tagged with: ebean
type: AnsweredQuestion
has title: How to set object field by using input element
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36271927

http://stackoverflow.com/comment/36519029
comment on: http://stackoverflow.com/a/23742422
has text: Thanks, I tried that, but i still get the same error :(
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24096739
score: 0
answers question: http://stackoverflow.com/q/23714572
type: Answer
has body: Preable: Not sure how good knobs are for the usability of the UI. I would avoid them if not for touch screen interfaces. The is no Java support for components like Knobs so you have to create your own. Here you can find a basic example with a really simple graphic but that consist in proof of concept. If you want to edit that code some suggestions that I give you are: Change the paint method for the paintComponent. If you don't know why here the explanation. Use the antialiasing adding the following line of code at the beginning of the paintComponent method. The picture shows you the difference. Graphics2D g2 = (Graphics2D)g; g2.setRenderingHints( new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) );

http://stackoverflow.com/q/23755960
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/46510630
has body: In my project, I have a TableViewer which needs to show more than 100,000 items and also filter them. Without SWT.VIRTUAL the table takes multiple seconds to display. When trying to use SWT.VIRTUAL, however, I have the following problem: Just implementing ILazyContentProvider as one would usually do is problematic, since it is incompatible with the usual filtering mechanisms in TableViewer and I would therefore have to implement the entire filtering mechanism myself. In my searches, I have found DeferredContentProvider which should solve the problem. But DeferredContentProvider still has many known bugs, one of which (146799) definitely already affects me, so I cannot use that. My question now is: Is there any good alternative I should look at, or do I myself have to implement ILazyContentProvider in a way that handles filtering on its own? If so, what are my chances of not running into the same problems the implementors of DeferredContentProvider ran into regarding refresh problems? Does anybody have any experience with something similar?
downvote count: 0
has comment: http://stackoverflow.com/comment/46510939
favorite count: 0
answer count: 0
upvote count: 2
has title: Alternatives to DeferredContentProvider for supporting filtering in tables with SWT.VIRTUAL
type: UnansweredQuestion
tagged with: swt
tagged with: jface
score: 2

http://stackoverflow.com/comment/36539339
type: AnswerComment
type: Comment
has text: Okay, array `length`s are variables. Remove the brackets, that was my mistake.
comment on: http://stackoverflow.com/a/23762310
score: 0

http://stackoverflow.com/comment/36548241
has text: I also thought about this, but seems to me somehow out of logic, as, I think, it is normal case, when some field of an object is null.. Very strange. Tell me, if you will find something. Thanks!
comment on: http://stackoverflow.com/q/23765990
score: 0
type: Comment
type: QuestionComment

servlets
tags question: http://stackoverflow.com/q/23668701
tags question: http://stackoverflow.com/q/23756244
tags question: http://stackoverflow.com/q/23624442
tags question: http://stackoverflow.com/q/23634837
tags question: http://stackoverflow.com/q/23712286
tags question: http://stackoverflow.com/q/23776277
tags question: http://stackoverflow.com/q/23655503
tags question: http://stackoverflow.com/q/23751965
tags question: http://stackoverflow.com/q/23738176
tags question: http://stackoverflow.com/q/23653036
tags question: http://stackoverflow.com/q/23751189
tags question: http://stackoverflow.com/q/23651572
tags question: http://stackoverflow.com/q/23760002
tags question: http://stackoverflow.com/q/23650824
tags question: http://stackoverflow.com/q/23644111
tags question: http://stackoverflow.com/q/23707468
tags question: http://stackoverflow.com/q/23747714
tags question: http://stackoverflow.com/q/23753377
tags question: http://stackoverflow.com/q/23720350
tags question: http://stackoverflow.com/q/23759718
tags question: http://stackoverflow.com/q/23662952
tags question: http://stackoverflow.com/q/23623594
tags question: http://stackoverflow.com/q/23680579
tags question: http://stackoverflow.com/q/23762211
tags question: http://stackoverflow.com/q/23767810
tags question: http://stackoverflow.com/q/23622974
tags question: http://stackoverflow.com/q/23776644
tags question: http://stackoverflow.com/q/23632771
tags question: http://stackoverflow.com/q/23724716
tags question: http://stackoverflow.com/q/23668269
tags question: http://stackoverflow.com/q/23691243
tags question: http://stackoverflow.com/q/23672827
tags question: http://stackoverflow.com/q/23626304
tags question: http://stackoverflow.com/q/23723262
tags question: http://stackoverflow.com/q/23686801
tags question: http://stackoverflow.com/q/23707955
tags question: http://stackoverflow.com/q/23712510
tags question: http://stackoverflow.com/q/23686457
tags question: http://stackoverflow.com/q/23642734
tags question: http://stackoverflow.com/q/23653358
tags question: http://stackoverflow.com/q/23624374
tags question: http://stackoverflow.com/q/23768735
tags question: http://stackoverflow.com/q/23719298
tags question: http://stackoverflow.com/q/23695236
tags question: http://stackoverflow.com/q/23731110
tags question: http://stackoverflow.com/q/23723299
tags question: http://stackoverflow.com/q/23622274
tags question: http://stackoverflow.com/q/23750147
tags question: http://stackoverflow.com/q/23617691
tags question: http://stackoverflow.com/q/23768602
tags question: http://stackoverflow.com/q/23718034
tags question: http://stackoverflow.com/q/23713329
tags question: http://stackoverflow.com/q/23764475
tags question: http://stackoverflow.com/q/23688362
tags question: http://stackoverflow.com/q/23629075
tags question: http://stackoverflow.com/q/23655338
tags question: http://stackoverflow.com/q/23664111
tags question: http://stackoverflow.com/q/23654395
tags question: http://stackoverflow.com/q/23674157
tags question: http://stackoverflow.com/q/23621122
tags question: http://stackoverflow.com/q/23617238
tags question: http://stackoverflow.com/q/23758206
tags question: http://stackoverflow.com/q/23616540
tags question: http://stackoverflow.com/q/23662675
tags question: http://stackoverflow.com/q/23672796
tags question: http://stackoverflow.com/q/23692914
tags question: http://stackoverflow.com/q/23734873
tags question: http://stackoverflow.com/q/23674589
tags question: http://stackoverflow.com/q/23766423
tag name: servlets
tags question: http://stackoverflow.com/q/23636304
tags question: http://stackoverflow.com/q/23617590
tags question: http://stackoverflow.com/q/23708227
tags question: http://stackoverflow.com/q/23710314
tags question: http://stackoverflow.com/q/23692573
type: Tag
tags question: http://stackoverflow.com/q/23660715
tags question: http://stackoverflow.com/q/23740790
tags question: http://stackoverflow.com/q/23681096
tags question: http://stackoverflow.com/q/23659004

oracle11g
tags question: http://stackoverflow.com/q/23682009
tags question: http://stackoverflow.com/q/23766841
tags question: http://stackoverflow.com/q/23754033
type: Tag
tag name: oracle11g
tags question: http://stackoverflow.com/q/23700376

http://stackoverflow.com/q/23702926
has answer: http://stackoverflow.com/a/23703179
score: 1
possible better answer: http://stackoverflow.com/a/23703024
has body: I am using implicit String constructor that handle byte array..but it results weird. Do I have to do something more for proper output..? Any help will be appreciated. Here is my code.. byte[] arr = { 23, 34, 20, 65, 88, 95 }; String s1 = new String(arr); System.out.println("First: "+s1); String s2 = new String(arr, 1, 3); System.out.println("Second: "+s2); it prints: First: ?"?AX_ Second: ?AX
upvote count: 1
type: AnsweredQuestion
has title: String constructor to handle byte array producing weird result
tagged with: java
has comment: http://stackoverflow.com/comment/36424144
type: Question
accepted answer: http://stackoverflow.com/a/23703179
answer count: 2
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/36423968
favorite count: 0
tagged with: byte
linked to: http://stackoverflow.com/q/10611455
has answer: http://stackoverflow.com/a/23703024
has comment: http://stackoverflow.com/comment/36423903
duplicate of: http://stackoverflow.com/q/10611455

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

http://stackoverflow.com/a/23730945
has comment: http://stackoverflow.com/comment/36478681
answers question: http://stackoverflow.com/q/23678360
has comment: http://stackoverflow.com/comment/36479061
score: 0
has body: Liquibase has a defaultSchemaName property. I haven't used dropwizard myself but it seems they use JDBI and a yaml based config file for the db connection. So, have you tried just putting the option defaultSchemaName into your service configuration file like this: database: # the name of your JDBC driver driverClass: org.postgresql.Driver # the username user: pg-user # the password password: iAMs00perSecrEET # the JDBC URL url: jdbc:postgresql://db.example.com/db-prod # any properties specific to your JDBC driver: properties: charSet: UTF-8 defaultSchemaName: &lt;yourSchemaName&gt;
type: Answer

http://stackoverflow.com/a/23709488
answers question: http://stackoverflow.com/q/23709433
has body: user request.getParameter( "field1" ) in your action servlet String link = request.getParameter( "field1" ) +"sometext" + request.getParameter( "field2" ); where your html is &lt;form action="myServlet" method="post"&gt; &lt;input name="field1"/&gt; &lt;input name="field2"/&gt; &lt;/form&gt;
score: 0
type: Answer

http://stackoverflow.com/a/23651605
accepted answer of: http://stackoverflow.com/q/23650824
answers question: http://stackoverflow.com/q/23650824
has comment: http://stackoverflow.com/comment/36329461
has body: If your table format remains like the one you showed (just change happens in number of tr tags each with two td tags in them):- Then Change your jsp code to this:- <% ArrayList<Integer> values= (ArrayList) request.getAttribute("valuesarray"); %> <% int k=0; int noOfRows=5; int noOftds=4; for(int i = 0; i<noOfRows; i++) { if(k==values.size()){break;} %> <%for(int j = 0; j<noOftds; j++){%> <%=values.get(k) %> <%k++%> <% }%> <% } %> Edit summary :- I have changed code so that you can specify the no of tr tags and no of td tags in each tr tag using the variables.
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36327176
has comment: http://stackoverflow.com/comment/36325521

http://stackoverflow.com/q/23702683
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/30035575
tagged with: jts
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/71696599
type: UnansweredQuestion
has title: How to enumerate vertices in Geometry in JTS?
upvote count: 1
has body: Java Topology Suite has Geometry class, which has getNumPoints() method. According to documentation, it counts all vertices in all constituent geometries. How to enumerate all these points? They can be obtained by getCoordinates() method, but this looks not optimal, since (1) is not iterative and (2) requires to convert each coordinate tuple into Point by GeomertFactory.
type: Question

http://stackoverflow.com/q/23732842
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36481272
has comment: http://stackoverflow.com/comment/36481901
has body: I've been trying to understand how Iterators work and in my tests I am getting java.util.ConcurrentModificationException plenty of times. For what I've found this happens when the Iterator is running through the ArrayList and suddenly a change in its values happens. This can also happen when the method that runs the Iterator is called in an event handler I think. In my code both happen. I know I should run code in background threads when calling methods in event handlers, but I would rather not, because we didn't talk about that in the course I am attending (will do if necessary). Presently I have this: import java.util.ArrayList; import java.util.Iterator; public class Node { private ArrayList&lt;String&gt; value = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; different_value = new ArrayList&lt;String&gt;(); private int differentK = 0; public Node (Tabela table, int column){ for (int i = 1; i&lt;table.get_numLines(); i++){ this.value.add(table.out[column][i]); } Iterator&lt;String&gt; itr = this.value.iterator(); Iterator&lt;String&gt; finder = this.different_value.iterator(); if(this.value.size()!=0) this.different_value.add(this.value.get(0)); while(itr.hasNext()){ while(finder.hasNext()){ if(!itr.next().equals(finder.next())){ this.differentK++; this.different_value.add(itr.next()); } } } System.out.println("This node has "+this.differentK+" different K"); } } And I get Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException in if(!itr.next().equals(finder.next())). I know the problem is probably because I am adding values to the different_value ArrayList, but what I want to do is iterate the value ArrayList and store the different values taken by the previous in the different_value ArrayList. FootNote: I also found that it is not recommended to change values in an ArrayList when using Iterators through that ArrayList. Should I use a more simple foreach: approach?
score: 1
tagged with: java
type: Question
has title: ArrayList of the different values of an ArrayList using Iterators
tagged with: iterator
has comment: http://stackoverflow.com/comment/36481234
tagged with: arraylist
upvote count: 1
has answer: http://stackoverflow.com/a/23733388
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36481294
favorite count: 0

http://stackoverflow.com/a/23760637
has body: There are four things you need to understand: If you don't specify any explicit constructor call, the compiler inserts a call to super() for you. There must be exactly one constructor call for any constructor- either explicit or the implicit super() call. (You've got three in your Child(int, int, int) constructor. An explicit constructor call must be the very first statement in the constructor body. You can only call a constructor which actually exists - so a call to super() from Child is looking for a parameterless constructor in Parent, which doesn't exist. One frequent pattern is to have a "master" constructor which other constructors in the same class chain to, and then that one chains to the superclass. For example: Child(int x) { this(x, 0); // Chains to the Child(int, int) constructor, defaulting y to 0 } Child(int x, int y) { // Chains to the Child(int, int, int) constructor, defaulting z to 0 this(x, y, 0); } Child(int x, int y, int z) { super(x, y, z); System.out.println("Creating child"); }
downvote count: 0
answers question: http://stackoverflow.com/q/23760537
type: Answer
score: 2
upvote count: 2

ruby-on-rails
tags question: http://stackoverflow.com/q/23712305
type: Tag
tag name: ruby-on-rails

http://stackoverflow.com/comment/36369927
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23673143
has text: If I don't use this, video is perfect but it is upside down.
score: 0

http://stackoverflow.com/comment/36389983
type: AnswerComment
type: Comment
has text: @RCola Show us your code; show us the line that is throwing this exception
comment on: http://stackoverflow.com/a/23684574
score: 0

http://stackoverflow.com/comment/36276750
type: Comment
score: 0
type: QuestionComment
has text: @DASA, Really not remember. can you describe some more in detail?
comment on: http://stackoverflow.com/q/23625051

http://stackoverflow.com/comment/36406037
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23692893
has text: @user3295607 If this helps, The factorial's just a shortcut for repeated multiplication on all positive integers less than or equal to the number you operate on. So "4 factorial" is equivalent to `4!`, which is equivalent to `4 * 3 * 2 * 1`. And "5 factorial" is equivalent to `5!`, which is equivalent to `5 * 4 * 3 * 2 * 1`. See a pattern?

http://stackoverflow.com/a/23740079
score: 2
has body: One thing you can do is do away with the entire TriLogic class and have your methods in the enum itself: public enum Logic { TRUE { @Override public Logic disj(Logic op) {} @Override public Logic neg() {} @Override public Logic conj(Logic op) {} }, FALSE { @Override public Logic disj(Logic op) {} @Override public Logic neg() {} @Override public Logic conj(Logic op) {} }, UNKNOWN { @Override public Logic disj(Logic op) {} @Override public Logic neg() {} @Override public Logic conj(Logic op) {} }; public abstract Logic disj(Logic op); public abstract Logic neg(); public abstract Logic conj(Logic op); } Yes, it's a lot more typing. It works, though. I'd actually prefer this, as you don't need to do if-else checks and/or switches for the logic methods, and it could be more convenient to use too (e.g. TRUE.neg().conj(FALSE);, for example). Your call. You could also add static methods to operate on two Logic values, but that would be optional. In fact, now that I think about it, the static methods would be really easy to implement: public static Logic disj(Logic op1, Logic op2) { return op1.disj(op2);}
accepted answer of: http://stackoverflow.com/q/23739557
upvote count: 2
answers question: http://stackoverflow.com/q/23739557
type: AcceptedAnswer
type: Answer
downvote count: 0

hsqldb
tags question: http://stackoverflow.com/q/23761480
tags question: http://stackoverflow.com/q/23760687
tags question: http://stackoverflow.com/q/23672933
tag name: hsqldb
type: Tag

http://stackoverflow.com/q/23720672
answer count: 3
has title: Java does not find class file
accepted answer: http://stackoverflow.com/a/23720691
upvote count: 1
tagged with: eclipse
downvote count: 1
tagged with: command-line-interface
possible better answer: http://stackoverflow.com/a/23720810
has answer: http://stackoverflow.com/a/23720810
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23720853
has answer: http://stackoverflow.com/a/23720691
favorite count: 0
type: Question
has body: i have problem running JAVA program from CLI: As you can see, i run javac Main.java to get Main.class file. And when trying to execute java Main, java can't find Main class. There is my class in Eclipse: What am i doing wrong?
score: 0
tagged with: java

http://stackoverflow.com/comment/36293646
has text: Even if line is empty (has nothing beside line separator `\n`) it is still line so `readLine` correctly returns empty String. What you should be interested in is `next` method, not `nextLine`. Also you probably should using `[\n\r]+` as delimiters if you want to ignore empty lines.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23635037

http://stackoverflow.com/q/23630668
tagged with: 3d
upvote count: 7
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/23631351
accepted answer: http://stackoverflow.com/a/23631351
has answer: http://stackoverflow.com/a/23630901
type: AnsweredQuestion
downvote count: 0
has title: Java 3D array assign values
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/23632190
has answer: http://stackoverflow.com/a/23630786
type: Question
has comment: http://stackoverflow.com/comment/65396431
has body: I have an array that looks like this static String[][][] School= new String[1000][20][5]; In the first bracket I save the class name In the second I save an ID of a student In the third I save information about the student (his name, family name etc). First I assign all the class names, after that I assign to every class its student ID and then I can fill in their information. How can I do it? I tried it with for example School[i] = "A1"; but it's not working. EDIT: Or is there an other way to save this all 3 things? (class name, its students and its iformation)
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23630901

http://stackoverflow.com/comment/36558000
score: 0
has text: *"to recreate desktop shortcut icons"* `<head-desk />` Try using it to register a ***file association***.
type: Comment
comment on: http://stackoverflow.com/q/23750594
type: QuestionComment

http://stackoverflow.com/q/23721422
has body: I use Eclipse for Java that works well and for AS3 use IntelliJ that is much better. But IntelliJ do not know create working jar file for ANE. Does anyone know how to set the project/artifact in IntelliJ for correct and working jar file?
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27310812
has title: How to create jar file for ANE in IntelliJ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27310812
tagged with: java
type: Question
tagged with: artifact
tagged with: intellij-idea
answer count: 1

http://stackoverflow.com/q/23684596
tagged with: aes
type: AnsweredQuestion
tagged with: java
has title: AES decrypt in Ruby and Scala (or Java)
type: Question
score: 0
has body: I'm encoding using AES-CBC-128 in Ruby and I'm trying to decode it in Java but I can't get it to work. Here is the code I use to decrypt in Ruby : require 'openssl' iv = "\x30\xd2\xff\x5d\x08\xac\x83\x95\x02\x0f\x23\x20\x81\xc9\xc1\xe4" key = "1234567890ABCDEF1234567890ABCDEF" message = "\xb8\x9f\x27\x30\xe5\x4d\x81\xf3\xa9\x3d\x0b\xe3\xaa\x52\x50\x15" openssl_cipher = OpenSSL::Cipher.new('aes-128-cbc') openssl_cipher.decrypt openssl_cipher.key = key openssl_cipher.iv = iv result = openssl_cipher.update(message) result &lt;&lt; openssl_cipher.final puts result If you run this snippet it will output the string matt Now I'm trying to achieve the same thing in Scala, using the implementation of the Java API. Here is my non-working code : import javax.crypto.Cipher import javax.crypto.spec.{SecretKeySpec, IvParameterSpec} object Main { def main(argv: Array[String]) { val iv = Array(0x30,0xd2,0xff,0x5d,0x08,0xac,0x83,0x95,0x02,0x0f,0x23,0x20,0x81,0xc9,0xc1,0xe4).map { _.toByte } val keyBytes = "1234567890ABCDEF1234567890ABCDEF".getBytes("UTF-8") //val keyBytes = Array(0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF).map { _.toByte } val message = Array(0xb8,0x9f,0x27,0x30,0xe5,0x4d,0x81,0xf3,0xa9,0x3d,0x0b,0xe3,0xaa,0x52,0x50,0x15).map { _.toByte } val key = new SecretKeySpec(keyBytes, "AES") val cipher = Cipher.getInstance("AES/CBC/NoPadding") cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)) val result = cipher.doFinal(message) println(new String(result, "UTF-8")) } } I've tried both keyBytes, but none is working. I don't see what I'm missing to make it work.
answer count: 2
possible better answer: http://stackoverflow.com/a/23684949
tagged with: ruby
has answer: http://stackoverflow.com/a/23686091
accepted answer: http://stackoverflow.com/a/23686091
tagged with: scala
tagged with: encryption
has answer: http://stackoverflow.com/a/23684949
has comment: http://stackoverflow.com/comment/36390213

http://stackoverflow.com/q/23625440
accepted answer: http://stackoverflow.com/a/23625868
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/729379
has answer: http://stackoverflow.com/a/23625821
linked to: http://stackoverflow.com/q/18314609
tagged with: java
possible better answer: http://stackoverflow.com/a/23625681
has comment: http://stackoverflow.com/comment/36274667
has answer: http://stackoverflow.com/a/23625804
type: Question
has body: Let's imagine, that we have a process, which accepts data of the following type: {"date":"2014-05-05", "url":"http://some.website.com","counter":3} This data should be validated formally: value of date should be a parseable date, url should also conform the normal url syntax. Also, this data should be validated logically: date should be in the future, url should be an accessible address, returning 200 OK. To make it clean, one must separate those two validation routines into different units (classes, utils, whatever). The desired final behaviour, however, must give user clear understanding of ALL violations, that are present in data. Something like: {"Errors":[ "Specified date is not in the future",//Formal validation failed "Specified URL has invalid syntax"//Logical validation failed ]} I have seen some implementations of the required behaviour, but they use those make use of Error objects and are full of checks like Error.hasErrors() or error==null, which does not look elegant. I have also seen the implementation of javax.validation, which gives you all violations on all field at once. Same approach could be implemented for content validation, but I am not sure, that this is the best way to do this. Question: what is the best practice for handling multiple exceptions/violations of various nature? UPD: short digest of answers: collect Violations, build an Exception, containing their context, cause and description, use an interceptor to render. See reference links from answers: http://beanvalidation.org/1.0/spec/ JSR 303 specification http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/validation.html Spring Bean Validation http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html Java EE validation Which Design Pattern To Use For Validation Why not use exceptions as regular flow of control?
has comment: http://stackoverflow.com/comment/36276367
linked to: http://stackoverflow.com/q/23408923
has answer: http://stackoverflow.com/a/23625868
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/23639340
has comment: http://stackoverflow.com/comment/36274864
has comment: http://stackoverflow.com/comment/36274776
favorite count: 0
has comment: http://stackoverflow.com/comment/36275513
tagged with: exception
answer count: 5
score: 6
tagged with: design-patterns
has title: Design pattern for cumulative validation violations
has answer: http://stackoverflow.com/a/23625681
upvote count: 6

http://stackoverflow.com/comment/36370161
has text: That absolutely the way to go but the problem still would be where to start. At least that's what I read from the OP's question.
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/23674642
type: Comment

http://stackoverflow.com/a/23623508
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23623435
accepted answer of: http://stackoverflow.com/q/23623435
score: 1
has body: Also you can use JavaDB (formerly Derby) : http://www.javaquizplayer.com/blogposts/blogpost6.html

http://stackoverflow.com/a/23637435
has body: do/while is precisely suitable when you always want to execute at least once, but you want to check whether or not to keep going at the end of the loop instead of at the start. You can easily emulate it with a while loop, but sometimes the code becomes less clear that way. All three loop types can be emulated with each other, with more or less mess - but as all three are available, you should just pick the most appropriate loop for the job in hand. I personally use both while loops and do/while loops less often than for loops, but sometimes a do/while is the most readable option.
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/23637381

http://stackoverflow.com/comment/36300361
has text: How does this apply to `//` comments? I understand `\n` and `\r`, but how does this apply to comments?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23638692

http://stackoverflow.com/q/23681822
accepted answer: http://stackoverflow.com/a/23682719
has comment: http://stackoverflow.com/comment/36385623
type: AnsweredQuestion
has body: I have a web app that takes an array of IDs, queries an external webservice for each ID one at a time and publish each result as it arrives to a WebSocket client via a STOMP broker. I can get this to work using simple Futures, but I'm trying to use Spring 4's new ListenableFutures and provide a callback. The working code uses a ThreadPoolTaskExecutor that is defined in my root config. I have a class called "SosQuery" with a method called "test" that is annotated with @Async and returns an AsyncResult. Here is my working code being called from a root context service class: @Override public void test(String[] oids) throws Exception { List&lt;Future&lt;String&gt;&gt; futures = new ArrayList&lt;Future&lt;String&gt;&gt;(); for (String oid : oids) { futures.add(sosQuery.test(oid)); } while (!futures.isEmpty()) { List&lt;Future&lt;String&gt;&gt; done = new ArrayList&lt;Future&lt;String&gt;&gt;(); for (Future&lt;String&gt; future : futures) { if (future.isDone()) { messagingTemplate.convertAndSendToUser("me", "/queue/observation", future.get()); done.add(future); } } futures.removeAll(done); } } This works fine and I see the responses arriving in my client. I modified the SosQuery method that is defined with the @Async annotation to simply return "String", and created a SimpleAsyncTaskExecutor in my root config. Here is the modified method to use ListenableFuture: @Override public void test(String[] oids) throws Exception { for (final String oid : oids) { ListenableFuture&lt;String&gt; task = asyncTaskExecutor.submitListenable(new Callable&lt;String&gt;(){ @Override public String call() throws Exception { String result = sosQuery.test(oid); logger.debug("result for sosQuery: " + result); return result; } }); task.addCallback(new ListenableFutureCallback&lt;String&gt;() { @Override public void onSuccess(String result){ if (result == null){ result = "ITS NULL"; } messagingTemplate.convertAndSendToUser("me", "/queue/observation", result); } @Override public void onFailure(Thro…
has title: Using Spring 4.0's new ListenableFuture With Callbacks - Odd Results
tagged with: threadpool
score: 7
tagged with: java
tagged with: java.util.concurrent
type: Question
has comment: http://stackoverflow.com/comment/36386048
downvote count: 0
has comment: http://stackoverflow.com/comment/36385056
has comment: http://stackoverflow.com/comment/36386905
has answer: http://stackoverflow.com/a/23682719
has comment: http://stackoverflow.com/comment/36385745
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36386137
upvote count: 7
tagged with: spring

http://stackoverflow.com/comment/45001337
type: AnswerComment
type: Comment
has text: I'm pretty sure he means alignment of the baselines of the label and the first line of the text area, because that's also what I'm looking for. I ended up using "aligny top, gaptop 3". An ugly work-around and it may not look the same on every operating system but it's good enough until I have time to dive into the MigLayout source code. "aligny top" alone is definitely not the solution.
comment on: http://stackoverflow.com/a/23805206
score: 0

http://stackoverflow.com/a/23756473
type: Answer
has body: It works ... public class java_main{ public static void main(String[] args) { // TODO Auto-generated method stub Myclass my = new Myclass(3,4); Myclass your = new Myclass(); System.out.println("keval"); } } class Myclass { public int a,b; public Myclass(int i, int j) { a = i; b = j; } public Myclass() { a = 1; b = 2; } }
answers question: http://stackoverflow.com/q/23756304
score: 0

http://stackoverflow.com/q/23725600
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has title: FileAppender creating new log file for each day
has comment: http://stackoverflow.com/comment/36468160
answer count: 0
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/5117758
has comment: http://stackoverflow.com/comment/36468061
type: Question
has body: I have created an appender that create and write logs to file with current date in filename, like this: filename_18052014.log The problem is that my appender should create new file at 00:00:00 every day and write logs there. But it doesn't happen, it still writes to old file and new file is not created... My code: package com.comarch.log4j; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.log4j.FileAppender; public class DateFormatFileAppender extends FileAppender { private String fileName = ""; public DateFormatFileAppender() { setFile(""); } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public void setFile(String fileName, boolean append, boolean bufferedIO, int bufferSize) throws IOException { super.setFile(generateFileName(), append, bufferedIO, bufferSize); } private String generateFileName() { SimpleDateFormat df = new SimpleDateFormat("ddMMyyyy"); String dateString = df.format(new Date()); return String.format("%s_%s.log", getFileName(), dateString); } } Have you any idea, how to do it? What do you think about this solution? Method append is extended. package com.comarch.log4j; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.log4j.FileAppender; public class DateFormatFileAppender extends FileAppender { private String fileName = ""; private int day; public DateFormatFileAppender() { setFile(""); } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public void setFile(String fileName, boolean append, boolean bufferedIO, int bufferSize) throws IOException { if (!getFile().equals("")) super.setFile(fileName, append, bufferedIO, bufferSize); } public void append(LoggingEvent event) { if (Calendar.DAY_OF_MONTH != day) { setFile(generateFileName()); activateOptions(); } super.append(event); } private String generateF…
has comment: http://stackoverflow.com/comment/36467445
has comment: http://stackoverflow.com/comment/36470632
downvote count: 0
has comment: http://stackoverflow.com/comment/36470391

http://stackoverflow.com/q/23733566
answer count: 1
accepted answer: http://stackoverflow.com/a/23803558
has body: I have a Vaadin tab menu, each tab contains of course different content. Now, if the content is an own class with dynamically generated content, how can I force the content to be updated if a tab is selected? My content class implements View, thus it as a enter(ViewChangeEvent event) that would be normally triggered if I use the Navigator to change the view. However, then I use a tab to change the content, there is no ViewChangeEvent fired. How can I though trigger the enter() method of the specific view content of the tab? @VaadinComponent @UIScope public class MyView extends CssLayout implements View { private Label label; public MyView() { label = new Label("empty"); } @Override public void enter(ViewChangeEvent event) { label.setValue("entered"); } } @VaadinComponent @UIScope public class MyMenu extends CssLayout { private TabSheet tabs; public MyMenu() { tabs = new TabSheet(); addComponent(tabs); } @Autowired private MyView myview; @PostConstruct public void init() { tabs.addComponent(myview); //some more tabs } }
tagged with: vaadin4spring
has answer: http://stackoverflow.com/a/23803558
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
tagged with: vaadin-navigator
has title: How to update content in a vaadin tab on selection change?
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36482637

http://stackoverflow.com/a/23718691
answers question: http://stackoverflow.com/q/23718679
downvote count: 0
type: Answer
upvote count: 5
score: 5
has body: Because of type erasure, the Java compiler will (according to Java docs): Replace all type parameters in generic types with their bounds or Object if the type parameters are unbounded... Insert type casts if necessary to preserve type safety. Generate bridge methods to preserve polymorphism in extended generic types. In other words, the Java compiler will convert the code to: MyClass(Set setOfA) { ... } MyClass(Set setOfB) { ... } so both will have the same parameters. That's the cause of the error.

http://stackoverflow.com/comment/36494013
score: 2
comment on: http://stackoverflow.com/q/23739711
has text: Actually I would not use an regular expression here but just check whether the read line was empty. If you insist on using a regexp, you are probably looking for \s which will match all whitespaces (including line-breaks).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23828779
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23753439
has comment: http://stackoverflow.com/comment/41353955
answers question: http://stackoverflow.com/q/23753439
has body: Possible causes: You are giving localhost as IP, ensure to match it with the IP on which appium started including port. You are running test on an Emulator with android version lower than 4.2
score: 5
type: AcceptedAnswer
upvote count: 6

http://stackoverflow.com/q/23713756
favorite count: 0
has title: Separate data using java String.split() method
possible better answer: http://stackoverflow.com/a/23713822
tagged with: regex
has answer: http://stackoverflow.com/a/23713822
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23713815
type: Question
has body: I've been trying to use the String.split() method in the java programming language to retrieve data from a string. The data in my string is in a weird format. Let me give you an example: let's say I have the following string: String s="My name is : John Smith 13 75,5"; I need to split the string in such a way that everything (except whitespaces) before : goes to a string, then, in what's left, everything (except whitespaces) before the first number to another string, then the first number to another string and the last number to another string, such that, considering the String s in my example I would have the following output: My name is John Smith 13 75,5 I tried the following code: data= s.split("\\s*\\:\\s*|\\s+|\\s+"); But the output was: My name is John Smith 13 75,5 I've tried many other regular expressions but with no success (I believe that proves how much of a beginner I am with regex...) Can somebody help me? Note: I think it wouldn't be too difficult to write my own split method for my data and maybe it's much better in terms of performance but I would really like to understand how to do this using regex.
answer count: 2
has comment: http://stackoverflow.com/comment/36444239
downvote count: 0
accepted answer: http://stackoverflow.com/a/23713815

http://stackoverflow.com/q/23700849
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36419836
tagged with: java
has body: I am trying to connect to a website where the site database adds a name to a list based on the url you connect with. I can't connect. The site works and I can access it in a browser. The error is an IOException. if ((Boolean) value) { System.out.println("setValue"); try { URL myURL = new URL("http://app.bannervision.tv/api/add/" + data.name.get(row)); URLConnection myURLConnection = myURL.openConnection(); myURLConnection.connect(); } catch (MalformedURLException e) { System.out.println("MalformedURLException"); // ... } catch (IOException e) { System.out.println("IOException"); System.out.println("http://app.bannervision.tv/api/add/" + data.name.get(row)); // openConnection() failed // ... } }
has comment: http://stackoverflow.com/comment/36419631
type: Question
has comment: http://stackoverflow.com/comment/36420536
tagged with: url
has comment: http://stackoverflow.com/comment/36419810
score: 0
has title: Can't connect with URL connection
tagged with: connection

http://stackoverflow.com/comment/36644815
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23768775
has text: So I changed it to use JTA and am still having the same issues. Since I am using Spring, I don't have a specific Persistence.xml file - instead, it is located in the Spring configuration XML file. Does WebLogic require the actual persistence.xml file?

http://stackoverflow.com/comment/36420700
type: Comment
score: 0
has text: @JanEglinger I added the code, I have tried a couple of things. I hope its not to messy.
comment on: http://stackoverflow.com/q/23699949
type: QuestionComment

http://stackoverflow.com/comment/36481113
comment on: http://stackoverflow.com/a/23731227
has text: I'm using apache-tomee-plus-1.6.1
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36434421
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23708399
score: 0
has text: OK thanks.. I am blind thanks. So will it always typically show a line? or in some cases does it just show all the other files? How do all those other files come in to play that I did not make? Those are from the SDK?

http://stackoverflow.com/q/23713038
tagged with: cassandra
has answer: http://stackoverflow.com/a/23716274
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23716274
upvote count: 1
type: Question
has body: I am developing a cloud platform and I want to Store documents and video files. First concept was to use MongoDB for the simple documents and for large video files cassandra. But i have read that with cassandra i'll have a problem if the file is larger than 64 MB. On the other hand mongoDB has GridFS that allows files larger than 100MB. I have connected mongoDB with Java. At start the database was 80MB, when I inserted a 1.80GB video file with GridFS into MongoDB i was expecting the Database to capture something like 1.9GB disk spase, but it captured 6 GB .... 3 times the size of the file. Here is the code i used: MongoClient mongo = new MongoClient("localhost", 27017); DB db = mongo.getDB("testdb"); DBCollection table = db.getCollection("user"); String newFileName = "Video"; File videoFile = new File("e:\\Magnificent.mp4"); GridFS gfsText = new GridFS(db, "video"); GridFSInputFile gfsFile = gfsText.createFile(videoFile); gfsFile.setFilename(newFileName); gfsFile.save(); Also, after run the application and save the file into mongodb the following files are created into the DB folder. Pease notice the size of the files: 1st question is why it captures so much disk space ?? 2ond question: Is there any chance to use cassandra for storing video files 500MB-1GB ??? Thanks for any advice
has title: NoSQL MongoDB vs Cassandra
has comment: http://stackoverflow.com/comment/36446907
score: 1
tagged with: java
tagged with: mongodb
tagged with: mongodb-java
downvote count: 0
answer count: 1
favorite count: 0

java-8
tags question: http://stackoverflow.com/q/23731680
tags question: http://stackoverflow.com/q/23699371
tags question: http://stackoverflow.com/q/23704355
tags question: http://stackoverflow.com/q/23743949
tags question: http://stackoverflow.com/q/23642529
tags question: http://stackoverflow.com/q/23756966
tags question: http://stackoverflow.com/q/23771022
tags question: http://stackoverflow.com/q/23745861
tags question: http://stackoverflow.com/q/23718383
tags question: http://stackoverflow.com/q/23744024
tags question: http://stackoverflow.com/q/23622426
tags question: http://stackoverflow.com/q/23674624
tags question: http://stackoverflow.com/q/23620360
tags question: http://stackoverflow.com/q/23721759
tags question: http://stackoverflow.com/q/23665502
tags question: http://stackoverflow.com/q/23732542
tags question: http://stackoverflow.com/q/23649389
tags question: http://stackoverflow.com/q/23746464
tags question: http://stackoverflow.com/q/23628631
tags question: http://stackoverflow.com/q/23701943
tags question: http://stackoverflow.com/q/23641846
tags question: http://stackoverflow.com/q/23642422
tags question: http://stackoverflow.com/q/23712248
tags question: http://stackoverflow.com/q/23696317
tags question: http://stackoverflow.com/q/23677977
tags question: http://stackoverflow.com/q/23682243
tags question: http://stackoverflow.com/q/23748612
tags question: http://stackoverflow.com/q/23699178
tags question: http://stackoverflow.com/q/23618361
tag name: java-8
tags question: http://stackoverflow.com/q/23689341
tags question: http://stackoverflow.com/q/23687944
tags question: http://stackoverflow.com/q/23658956
tags question: http://stackoverflow.com/q/23688967
tags question: http://stackoverflow.com/q/23684083
type: Tag
tags question: http://stackoverflow.com/q/23660416
tags question: http://stackoverflow.com/q/23773024

http://stackoverflow.com/q/23760809
has comment: http://stackoverflow.com/comment/36534295
tagged with: javascript
has title: Unable to reference javascript variable in java call
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23762203
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23760876
has answer: http://stackoverflow.com/a/23760897
tagged with: java
tagged with: eclipse
type: Question
has body: I'm trying to reference a javascript variable in a java call but unfortunately I get the error the variable (userURL) cannot be resolved. How can I reference the variable? &lt;%@ page language="java" %&gt; &lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt; &lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt; &lt;%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %&gt; &lt;%@ page import="java.net.*, org.owasp.esapi.ESAPI, org.owasp.esapi.Validator" %&gt; &lt;script type="text/javascript" language="javascript"&gt; function validateForm() { var userURL = "http://www.google.com"; var isValidURL = &lt;% ESAPI.validator().isValidInput("URLContext", userURL, "URL", 255, false); %&gt; if (isValidURL) { alert("true"); } else { alert("false"); } } &lt;/script&gt;

http://stackoverflow.com/comment/36489120
comment on: http://stackoverflow.com/q/23736142
score: 0
has text: hmm... `-bash: /opt/oracle/7/jdk1.7.0_55/bin/java: No such file or directory`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23750705
upvote count: 1
answers question: http://stackoverflow.com/q/23748384
has body: I would divide this problem into two parts. The first part is to figure out whether the string has time zone information in it. The second is to parse the string the way you want. I believe the following will work for the first part. First, create two DateTimeFormatter objects with different time zones. Now, parse the string with both objects. Now call getDate() on both results. If both dates are the same, the string had a time zone in it, and specified an instant in time, which was appropriately adjusted by both DateTimeFormatter objects. If the dates are different, the string had no time zone in it, and specified a local date and time, which was assumed by each DateTimeFormatter to be its own time zone. Now you can do the second part, choosing whether to use a DateTimeFormatter withOffsetParsed() or one withZone() in the user's time zone, depending on whether the string has the time zone. This requires four different DateTimeFormatter objects, but it's straightforward if not simple. It can be optimized to use only three different DateTimeFormatter objects, by using one with the user's time zone as one of the two that are used in the first part of the solution - in which case you have to reparse in the second part of the solution only if the string had a time zone in it.
has comment: http://stackoverflow.com/comment/36515772
downvote count: 0
has comment: http://stackoverflow.com/comment/36542767
type: Answer
score: 1

http://stackoverflow.com/a/23763718
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23757756
accepted answer of: http://stackoverflow.com/q/23757756
has body: Your script is stored in DOS/Windows format, with a carriage return followed by linefeed (sometimes written "\r\n") at the end of each line; unix uses just a linefeed ("\n") at the end of lines, and so bash is mistaking the carriage return for part of the command. When it sees while read line\r do\r it doesn't recognize "do\r" as a keyword, just a regular command, so it continues forward looking for the "do" keyword. When it sees "done" instead, it gets confused and gives the error you see. BTW, the way I can tell this is the problem is from the error 'ddmvn.sh: line 6: `done &lt; &lt;(find . -name "*.jar") Note that the close quote is at the beginning of the line, rather than the end. That tells me that the actual error is: addmvn.sh: line 6: `done &lt; &lt;(find . -name "*.jar")\r' ... and the carriage return is sending it back to the beginning of the line so the close quote overwrites the "a" in the script name. Solution: convert the script to unix format; I believe you'll have the dos2unix command available for this, but you might have to look around for alternatives. In a pinch, you can use perl -pi -e 's/\r\n?/\n/g' /path/to/script (see http://www.commandlinefu.com/commands/view/5088/convert-files-from-dos-line-endings-to-unix-line-endings). Then switch to a text editor that saves in unix format rather than DOS.
score: 0

http://stackoverflow.com/comment/36314128
has text: I just want to discard the entity that fired the constraint exception. The rest must be persisted. It also ocurred to me that i can use the flush method, but yet again, not sure about the performance impact.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23645661
score: 0

http://stackoverflow.com/comment/36468260
type: Comment
has text: So change `ratingText.setText(rating + "/" + ratings);` as `ratingText.setText(rating + "/" + ratings.toString());`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23719684

http://stackoverflow.com/comment/43786881
comment on: http://stackoverflow.com/a/23749338
has text: Works great, except a typo in the format. The Z should be 'Z'. The format is: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/23728430
tagged with: public
favorite count: 0
tagged with: static
type: UnansweredQuestion
has title: How to access variables from the main method in another class
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36473417
upvote count: 1
has answer: http://stackoverflow.com/a/23728465
tagged with: methods
has comment: http://stackoverflow.com/comment/36473434
has body: This is probably a noob question but oh well, I need to collect the frameWidth and frameHeight variables from my main method frame.java public static void main(String[] args) { ..... ....... int frameWidth = frame.getContentPane().getWidth(); int frameHeight = frame.getContentPane().getHeight(); } Board.java public class board extends JPanel { private frame Frame; public board() { Frame = new frame(); int FrameWidth = frame.main().frameWidth; int FrameWidth = frame.main().frameHeight; } } What is the proper way of accessing the variable?
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36473453
has answer: http://stackoverflow.com/a/23728455

http://stackoverflow.com/a/23662843
has body: it looks , you are using jdk 1.4 or lower one, there autoboxing is not supported. so it can not convert Double to double. but that should give you a compile time error if you are using IDE like eclipse. OR may be the method you are calling has different signature. try to check the jdk version and post whole class if above one does no solve your problem.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36349046
answers question: http://stackoverflow.com/q/23662575

http://stackoverflow.com/comment/36526291
type: Comment
has text: I will have to do some POC for Quartz and JDBCJobStore, never worked with these.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23750208

http://stackoverflow.com/comment/36539620
type: Comment
type: QuestionComment
has text: There's no goto in Java so I'm not sure what the "equivalent" would be in Applescript
score: 0
comment on: http://stackoverflow.com/q/23763629

http://stackoverflow.com/comment/36267518
comment on: http://stackoverflow.com/q/23621369
score: 0
type: Comment
type: QuestionComment
has text: I don't understand why this was downvoted and closed. The question referenced as a duplicate is not a duplicate. If you read my question, as well as that question and the answers, you will see that I'm requesting clarification on a specific concept that is related to the language. There is no confusion on my part, or within the question, about what "this" means. I believe people glanced at the question and downvoted / closed because they made an assumption.

http://stackoverflow.com/q/23718190
has body: My application stops working without any log when I use the API 19 instead of the API 8 I'm using the code from this tutorial: http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ This is the gradle configuration that works perfectly: apply plugin: 'android' android { compileSdkVersion 8 buildToolsVersion "19.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 8 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } I want to update it so it works with another code that I'm using and requires a recent API, so I modify the gradle configuration to: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.1" defaultConfig { minSdkVersion 11 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } It suddenly stops working when openning a particular screen without any log message, this is the .java of that screen that fails when it gets openned (it receives data from a json call on a .php script and displays it on a webView): package com.example.androidhive; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.webkit.WebView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class JobDescriptionActivity extends Activity { TextView txtJobID; TextView txtCompanyName; TextView txtCompanyHeadline; TextView txtJobLocation; WebView webViewDesc; String job_id; // Progress Dialog private ProgressDialo…
has title: Android: API Compatibility issues in build.gradle
tagged with: java
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/36453046
has comment: http://stackoverflow.com/comment/36453015
has comment: http://stackoverflow.com/comment/36453079
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23718251
has comment: http://stackoverflow.com/comment/36453096
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23729406
tagged with: java
has comment: http://stackoverflow.com/comment/36475280
tagged with: recurrence
has comment: http://stackoverflow.com/comment/36483258
has answer: http://stackoverflow.com/a/23747030
type: Question
tagged with: math
has comment: http://stackoverflow.com/comment/36508117
has comment: http://stackoverflow.com/comment/36484098
has comment: http://stackoverflow.com/comment/36475921
tagged with: time-complexity
answer count: 1
downvote count: 0
has body: First of all, this is not homework: I submitted some Java code on CodeEval. The challenge boils down to the following question: Start with a number n. If it's a palindrome, stop. Otherwise, reverse the digits of n, add them to n, and repeat this process. Report how many steps are necessary before the number converges to a palindrome. It wasn't difficult at all. Moreover, once I submitted the code and received 100% on the challenge I began looking over my code again - I wanted to determine the time complexity of my recursive call method and my method being called within the recursive method. Wherein, I came up with: //adds the i'th integer in String[] data to its reversed integer: private final int add(int x) { //if x is 0, then don't do anymore computation if(x==0) { count++; return x; } //if x equals its reversal, the palindrome has been found if(x==rev(x)) { return x; } //keep adding and reversing else { //if MAX has been reached, STOP if (count==MAX) return 0; //increment the count count++; _intTmp=rev(x); //get the reversal return add(x + _intTmp); //recursive call: keep adding }//else:end } //Main::add() end So ... I calculated T(N): 1 + log(1/n) //reverse the integer: worst case is O(N) private final int rev(int orig) { int reversed=0; while(orig&gt;0) { //adds the last digit from orig to reversed reversed=reversed*10+orig%10; orig=orig/10; //gets rid of the last digit } return reversed; //return the reversed integer }//Main::final end I calculated: O(N) The overall time complexity, of this code snippet, is: O(1+log(1/n)+n) ~ O(N) Am I right, or did I mess up somewhere? Thank you for your time and advice ...
favorite count: 0
has title: Reverse-then-add sequence: Big-O runtime of my solution?
type: UnansweredQuestion
tagged with: big-o
score: 2
upvote count: 2

http://stackoverflow.com/q/23728108
has answer: http://stackoverflow.com/a/23737412
type: AnsweredQuestion
has title: JPA2 Criteria API runtime cast from varchar(25) to decimal
tagged with: java
accepted answer: http://stackoverflow.com/a/23737412
type: Question
downvote count: 0
answer count: 1
has body: So I've seen all threads on stack overflow on similar subjects but I've found no solution to my problem. I'm trying to create a Criteria query and I get this SQL (1st SQL, simplified): SELECT latitude FROM stations WHERE (ABS(latitude - 45.893227) &lt;= 0.2) but it gives me this error: java.sql.SQLDataException: The resulting value is outside the range for the data type DECIMAL/NUMERIC(31,31). That's because my latitude is of type varchar(25). So this fixes it (2nd SQL): SELECT latitude FROM stations WHERE (ABS(CAST(latitude AS DECIMAL) - 45.893227) &lt;= 0.2) But now I need to do it in Criteria syntax. This is my method: public List&lt;Stations&gt; searchStations(Float distance, List&lt;Address&gt; addresses) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Stations&gt; cq = cb.createQuery(Stations.class); Root&lt;Stations&gt; stations = cq.from(Stations.class); //this &lt;Float&gt; cast actually does nothing: Expression&lt;Float&gt; Lat = stations.get("latitude"); Expression&lt;Float&gt; Lon = stations.get("longitude"); //make a list of conditions List&lt;Predicate&gt; predicates = new ArrayList&lt;&gt;(); for (Address a : addresses) { Float aLat = Float.valueOf(a.getLatitude()); Float aLon = Float.valueOf(a.getLongitude()); //condition: |station.Lat - address.Lat| &lt;= distance //le() = lessThan, abs() = absolute, diff() = subtraction Predicate condLat = cb.le(cb.abs(cb.diff(Lat, aLat)), distance); Predicate condLon = cb.le(cb.abs(cb.diff(Lon, aLon)), distance); //if I do: Lat.as(Float.class) it won't cast on runtime! predicates.add(condLat); predicates.add(condLon); } //add the array of conditions to the WHERE expression, connected with AND: cq.where(cb.and(predicates.toArray(new Predicate[predicates.size()]))); TypedQuery&lt;Stations&gt; q = em.createQuery(cq); return q.getResultList(); } With that code I'm getting the 1st SQL, and I want the 2nd one.I just can't get that runtime cast functionality. The Criteria type cast functions that I've tr…
upvote count: 6
favorite count: 0
score: 6
tagged with: criteria-api

http://stackoverflow.com/comment/36297127
comment on: http://stackoverflow.com/q/23637076
score: 1
has text: You'll need to include some actual code; as posted nothing makes any sense and it's impossible to help.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36330607
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23619936
score: 0
has text: I have posted an update to my original posting and tried to clarify matters.

http://stackoverflow.com/a/38648146
score: 0
has body: you should inject the interface not the class itself !
answers question: http://stackoverflow.com/q/23626293
type: Answer

http://stackoverflow.com/comment/36377023
type: AnswerComment
comment on: http://stackoverflow.com/a/23677193
type: Comment
has text: @XxRoboticaXx Story of my life. They give me shit, I polish it, they complain it's still shit...
score: 0

http://stackoverflow.com/q/23758637
tagged with: timer
accepted answer: http://stackoverflow.com/a/23758777
tagged with: multithreading
tagged with: swing
has title: Event Dispatch Thread divided from logic thread,prevent blocking UI
type: AnsweredQuestion
tagged with: java
type: Question
has body: how i can separate the logic from the EDT,because as you can see logic and render are related into loop and how i can separate code in a pretty way, i' m getting in trouble with this,trying to find out how to do. Any suggestion/helps/advices? main class public class MainFrame { private static MainFrame mainFrame = null; private final JFrame frame; private MainFrame() { frame = new JFrame(); frame.setUndecorated(true); frame.add(new GamePanel()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static final MainFrame getMainFrameInstance() { if (mainFrame == null) { mainFrame = new MainFrame(); } return mainFrame; } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { try {// set look and feel to nimbus for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } MainFrame.getMainFrameInstance(); } }); } } gamePanel class on which i start the game loop public class MyPanel extends JPanel implements Runnable { private static final long serialVersionUID = 1L; // thread and loop private Thread thread; private boolean running; private int FPS = 60; private long targetTime = 1000 / FPS; private long start; private long elapsed; private long wait; // image public BufferedImage image; // foo private Foo foo; private Render render = Render.getRenderManagerInstance(); public MyPanel() { setPreferredSize(new Dimension(700, 700)); setFocusable(true); requestFocus(); } public void addNotify() { super.addNotify(); if (thread == null) { thread = new Thread(this); thread.start(); } } private void initGraphic() { image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); foo = new Foo(); running = true; } public void run() { initGraphic(); // loop while (…
answer count: 1
has answer: http://stackoverflow.com/a/23758777
score: 0

http://stackoverflow.com/q/23742354
tagged with: swingworker
tagged with: java
accepted answer: http://stackoverflow.com/a/23742894
score: 0
has comment: http://stackoverflow.com/comment/36498986
has answer: http://stackoverflow.com/a/23742894
answer count: 1
has comment: http://stackoverflow.com/comment/36499275
has body: the data included in a jList's model, gets updated from a swingworker. the problem is that I subclassed the SwingWorker class in an independent *.java file. So I can't access the GUI components (in this case, the model and the jList). In fact i think it's better not to put this subclass in the JFrame form, to avoid it being a mess, but that's the only way I can figure out to make it work. If I put this subclass in the jframe form, i guess I could update the model and the Jlist using the done() method of the swingworker abstract class. but is there any way to access the GUI components (jList &amp; model) from the swingworker, when the swingWorker is in another *.java file? I call the swingworker here using INVOKE LATER. right after i try to update the models, but it seems that it doesn't wait for the swingworker to end its job, so when it updates the model, the swingworker hasn't finished yet, so the data is not updated yet. as you can see in the next piece of code, i also tried to put the update code in an INVOKE LATER after the first one, but it doesn't seem to synchronize either. private void jMenuItem2MousePressed(java.awt.event.MouseEvent evt) { // BOTON DESCARGAR DATOS DEL SERVIDOR OPCION DEL MENU File filePref = new File("preferencias.config"); if (filePref.exists()) { int n = JOptionPane.showConfirmDialog( this, "¿Está seguro de que desea descargar todos los datos del servidor" + " (datos e imágenes)a local? Todos los datos locales serán reemplazados" + " y no se podrán recuperar.", "Confirmación de descarga", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { // *** THIS invokeLater() calls the SwingWorker subclass to update the data javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { DescargarDatosDelServidor.createAndShowGUI(); } }); // *** THIS invokeLater() updates the model and the jList SwingUtilities.invokeLater(new Runnable() { public void run() { // BORRAMOS MODELO DE LOS JList modelo.clear(); modelo2.clear(); mod…
tagged with: jlist
has title: updating JList from swingworker, or after the swingworker
has comment: http://stackoverflow.com/comment/36499915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36499800
tagged with: event-dispatch-thread
linked to: http://stackoverflow.com/q/7053865
tagged with: swing
type: Question

http://stackoverflow.com/a/23705253
type: Answer
has comment: http://stackoverflow.com/comment/36430356
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36430316
has comment: http://stackoverflow.com/comment/36429743
has comment: http://stackoverflow.com/comment/36429701
score: 0
has body: The URLConnection you are getting is actually an HttpURLConnection. You have opened the connection but not closed it. To request that the HttpURLConnection be closed, you should call its disconnect() method. It could be that the connection needs to be closed in order to ensure that the server completely receives your request and processes it. For example, you can replace your first try/catch block with this: HttpURLConnection myURLConnection = null; try { String bvURL = "http://app.sitename.tv/api/add/" + data.name.get(row); URL myURL = new URL(bvURL); myURLConnection = (HttpURLConnection) myURL.openConnection(); myURLConnection.connect(); System.out.println(bvURL); } catch (MalformedURLException e) { System.err.println("MalformedURLException: " + e); } catch (IOException e) { System.err.println("IOException: " + e); } finally { if (myURLConnection != null) { myURLConnection.disconnect(); myURLConnection = null; } } If this still does not work, you may need to get the InputStream from the connection, using getInputStream(), and consume all the input data before disconnecting.
answers question: http://stackoverflow.com/q/23704721

http://stackoverflow.com/q/23655462
tagged with: sha512
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29439159
downvote count: 0
possible better answer: http://stackoverflow.com/a/52500347
tagged with: java
has answer: http://stackoverflow.com/a/52500347
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/36334293
has comment: http://stackoverflow.com/comment/36332964
score: 4
tagged with: hmac
has comment: http://stackoverflow.com/comment/36333262
has title: Hash value generation using hmac/sha512 in java and c#
answer count: 3
has answer: http://stackoverflow.com/a/72463001
has body: in c# public static string HashToString(string message, byte[] key) { byte[] b=new HMACSHA512(key).ComputeHash(Encoding.UTF8.GetBytes(message)); return Convert.ToBase64String(b); } client.DefaultRequestHeaders.Add("X-Hash", hash); var encryptedContent = DataMotion.Security.Encrypt(key, Convert.FromBase64String(iv), serializedModel); var request = client.PostAsync(ApiUrlTextBox.Text,encryptedContent,new JsonMediaTypeFormatter()); in java: protected String hashToString(String serializedModel, byte[] key) { String result = null; Mac sha512_HMAC; try { sha512_HMAC = Mac.getInstance("HmacSHA512"); SecretKeySpec secretkey = new SecretKeySpec(key, "HmacSHA512"); sha512_HMAC.init(secretkey); byte[] mac_data = sha512_HMAC.doFinal(serializedModel.getBytes("UTF-8")); result = Base64.encodeBase64String(mac_data); }catch(Exception e){ } } o/p: ye+AZPqaKrU14pui4U5gBCiAbegNvLVjzVdGK3rwG9QVzqKfIgyWBDTncORkNND3DA8jPba5xmC7B5OUwZEKlQ== i have written hashtostring method in java based on c# code. is this currect? (output is different because every time process is dynamic in both cases.)
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/36333732
accepted answer: http://stackoverflow.com/a/29439159

http://stackoverflow.com/comment/36396497
comment on: http://stackoverflow.com/a/23687650
score: 0
type: AnswerComment
type: Comment
has text: 3 point is little unclear to me could explain it? Please

htmlunit
tags question: http://stackoverflow.com/q/23692338
type: Tag
tags question: http://stackoverflow.com/q/23670863
tags question: http://stackoverflow.com/q/23712989
tags question: http://stackoverflow.com/q/23774241
tag name: htmlunit
tags question: http://stackoverflow.com/q/23697516

http://stackoverflow.com/comment/36525036
type: QuestionComment
type: Comment
has text: Instead adding the elements to a List (dataLine) add them to the bean and then add the bean to csvData (changing the generic from List<String> to your bean class)
comment on: http://stackoverflow.com/q/23755838
score: 0

ejb-3.0
tags question: http://stackoverflow.com/q/23756244
tags question: http://stackoverflow.com/q/23640079
tags question: http://stackoverflow.com/q/23737958
tag name: ejb-3.0
type: Tag

schedule
tags question: http://stackoverflow.com/q/23635906
tag name: schedule
tags question: http://stackoverflow.com/q/23720464
type: Tag

http://stackoverflow.com/q/23777807
has comment: http://stackoverflow.com/comment/36569348
type: Question
has body: I'm working on a maven modular project and now I'm trying to release it. I have successfully executed half on release:prepare, but when the plugin in tries to tag the progect i get unable to tag error. Now I try to explain you the trouble. My modular project is composed from a few modules (model,services,rest,web-app, etc), |-- parent |-- model pom.xml |-- services pom.xml |-- rest pom.xml |-- web-app pom.xml pom.xml I decided to use the same version for all modules then I run the following command: mvn release:prepare -DautoVersionSubmodules=true During the process the version number of all my Poms is updated in a correct way and maven successfully commit them in my scm repository. I configured maven:release plugin in this way: <plugin> org.apache.maven.plugins maven-release-plugin 2.2.2 com.google.code.maven-scm-provider-svnjava maven-scm-provider-svnjava 2.1.1 <providerImplementations> javasvn </providerImplementations> <checkModificationExcludes> <checkModificationExclude>.project</checkModificationExclude> <checkModificationExclude>.settings</checkModificationExclude> <checkModificationExclude>.classpath</checkModificationExclude> </checkModificationExcludes> -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true <plugin> I had to add the arguments tag because I use artifactory like repository manager over https. The release:prepare is failing with this error when it attempts to create the tag for the release and throws this error: Caused by: org.apache.maven.shared.release.scm.ReleaseScmCommandException: Unable to tag SCM Provider message: SVN tag failed. Command output: svn: E175002: connection refused by the server svn: E175002: OPTIONS request failed on '/home/svn/myCompany/test/trunk/parent' at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:136) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:206) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(Defau…
has answer: http://stackoverflow.com/a/23780001
score: 0
tagged with: maven
answer count: 1
tagged with: maven-release-plugin
tagged with: svn
tagged with: java
accepted answer: http://stackoverflow.com/a/23780001
type: AnsweredQuestion
has title: Unable to tag issue using release plugin
tagged with: maven-3

http://stackoverflow.com/comment/36351877
type: QuestionComment
has text: What are you trying to do by running `cd` using `Runtime.getRuntime().exec()`? Are you trying to change the current directory of the Java class you're running (`A`)?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23664789

http://stackoverflow.com/a/45920031
has body: Simple: return map.containsValue(myURL.toString()); for example. Or, using java8 streams: return map.values().stream().anyMatch(v -&gt; v.equals(myURL.toString())) But as you ask for efficient solutions, I suggest you go with the old-school non stream version. Because the second version is most likely using noticeably more CPU cycles. Only if your map has zillions of entries, and you are looking at response time only, then maybe using parallelStream() could give you the answer more quickly.
type: Answer
answers question: http://stackoverflow.com/q/23632529
score: 13
upvote count: 13
downvote count: 0

http://stackoverflow.com/q/23637845
has answer: http://stackoverflow.com/a/23648856
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has title: org.omg.CORBA.INTERNAL: CONNECTIONINTERCEPTOR_INVALID_CLASSNAME vmcid: 0x49421000 minor code: 5B completed: No
tagged with: java
has body: Recently I migrated the application from WAS 6.0 to WAS 7.0 and java 1.4 to java 5, when I am trying to launch the application from WAS 7 server I got the below error but it works fine with my RAD 7.5 environment. org.omg.CORBA.INTERNAL: CONNECTIONINTERCEPTOR_INVALID_CLASSNAME vmcid: 0x494210 00 minor code: 5B completed: No at com.ibm.ws.orbimpl.transport.WSTransport.init(WSTransport.java:208) at com.ibm.rmi.corba.PluginRegistry.initPlugin(PluginRegistry.java:224) at com.ibm.rmi.corba.PluginRegistry.initPlugins(PluginRegistry.java:210) at com.ibm.rmi.corba.PluginRegistry.initPlugin(PluginRegistry.java:193) at com.ibm.rmi.corba.ORB.initializePrereqPlugins(ORB.java:576) at com.ibm.rmi.corba.ORB.orbParameters(ORB.java:1299) at com.ibm.rmi.corba.ORB.set_parameters(ORB.java:1225) at com.ibm.CORBA.iiop.ORB.set_parameters(ORB.java:1681) at org.omg.CORBA.ORB.init(ORB.java:364) at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:82) at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174) at com.ibm.ejs.oa.EJSClientORBImpl.&lt;init&gt;(EJSClientORBImpl.java:97) at com.ibm.ejs.oa.EJSClientORBImpl.&lt;init&gt;(EJSClientORBImpl.java:73) at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386) at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:285) at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(Ws nInitCtxFactory.java:373) I am new to WAS 7 server, please help me out. Many thanks in advance.
score: -1
type: Question
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36271226
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23623669
has text: Try moving `Scanner in = new Scanner(System.in);` to before the `while` statement.

http://stackoverflow.com/comment/36263643
type: AnswerComment
type: Comment
has text: @user3369008 The problem is what MadProgrammer said; don't override paint of top level components. However I don't have enough of your code to be able to fix it, but I think you should be able to at this point.
comment on: http://stackoverflow.com/a/23618952
score: 0

http://stackoverflow.com/comment/36397751
comment on: http://stackoverflow.com/q/23688231
type: Comment
type: QuestionComment
score: 0
has text: hey, can anyone help me with this?????????? I have to take a String, form its substrings of length 10, and then for each substring I have to find 'k' using the same formula and save value that we get from each substring into a array of integer

http://stackoverflow.com/comment/36323975
type: AnswerComment
comment on: http://stackoverflow.com/a/23650792
score: 0
has text: Such an easy fix! I don't know why I couldn't find this myself, but it works now. Thank you very much and have a nice day!
type: Comment

jaws-screen-reader
tags question: http://stackoverflow.com/q/23760631
tag name: jaws-screen-reader
type: Tag

http://stackoverflow.com/comment/36365303
has text: @Sparky you should get a expcetion check the stactrace. check my post
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671817

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/23660163
tag name: csv
tags question: http://stackoverflow.com/q/23659736
tags question: http://stackoverflow.com/q/23676681
tags question: http://stackoverflow.com/q/23722078
tags question: http://stackoverflow.com/q/23640390
tags question: http://stackoverflow.com/q/23754010
tags question: http://stackoverflow.com/q/23624970
tags question: http://stackoverflow.com/q/23736600
tags question: http://stackoverflow.com/q/23758109
tags question: http://stackoverflow.com/q/23651280
tags question: http://stackoverflow.com/q/23754735
tags question: http://stackoverflow.com/q/23657136
tags question: http://stackoverflow.com/q/23778094
tags question: http://stackoverflow.com/q/23652098
tags question: http://stackoverflow.com/q/23755838
tags question: http://stackoverflow.com/q/23737633
tags question: http://stackoverflow.com/q/23695595
tags question: http://stackoverflow.com/q/23625918
tags question: http://stackoverflow.com/q/23630553

http://stackoverflow.com/q/23637277
tagged with: button
has comment: http://stackoverflow.com/comment/36297277
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23637320
has answer: http://stackoverflow.com/a/23637527
has title: Change background image on button click
score: 0
has answer: http://stackoverflow.com/a/23637320
has body: I'm using eclipse to code my android app and I'm wondering how I can change the background image of my MainActivity when I click a button. I have img1.png and img2.png. The background is currently set on img1.png with the following xml code: I'm just unsure what java code I would use to change the background image on btn1 click.
possible better answer: http://stackoverflow.com/a/23637527
answer count: 3
has answer: http://stackoverflow.com/a/28155556

http://stackoverflow.com/comment/36383582
has text: `All JPanels has absolute Layout (I suppose it is also a problem)` - yes that is the problem. Components will not resize when you use absolute layout. `but I am not very friendly with Layouts.` - well that is the solution you need to use, so you need to spend some time learning how to use each of the different layout to get your desired look. Start by reading the section from the Swing tutorial on [How to Use Layouts](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) for more information and working examples.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23679665
type: QuestionComment

http://stackoverflow.com/comment/36409940
comment on: http://stackoverflow.com/q/23682009
score: 0
type: Comment
has text: Everything looks alright. Make sure you are pointing to the same database in test as well as from the application(via jsp).
type: QuestionComment

http://stackoverflow.com/comment/36448864
comment on: http://stackoverflow.com/a/23716027
score: 0
type: AnswerComment
type: Comment
has text: As was mentioned, you can't, because multiple can be selected.

http://stackoverflow.com/comment/36492905
comment on: http://stackoverflow.com/a/23727317
score: 0
type: Comment
has text: Then +1 for you in store.
type: AnswerComment

http://stackoverflow.com/comment/36512745
comment on: http://stackoverflow.com/q/23749326
type: Comment
type: QuestionComment
has text: You simply need to understand how an if/else, for, while, do/while, or switch statement would translate into assembly language, figure out which sort of statement you have, and translate it back. It's only work, no magic.
score: 2

http://stackoverflow.com/a/23617411
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23617372
has body: Because on the first code, you'll never write the first element down, because you're calling next() without using it. Then you call next() 2 times in each loop, so you'll get only 1 over 2 result
type: Answer

http://stackoverflow.com/comment/36595361
comment on: http://stackoverflow.com/a/23770301
has text: Basically, instead of using Map<Image, List<JInternalFrame>> use Map<Image, JInternalFrame>. Obviously, we won't need the other references to List in the code ;)
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23640793
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36304677
score: 0
tagged with: soapui
has title: Response XML without NameSpaces
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: spring
has comment: http://stackoverflow.com/comment/36305716
has comment: http://stackoverflow.com/comment/36306262
has body: I'm using a endpoint SOAP created On Spring Framework using JAXB, but I want that my anwers(Expected Response) return without prefix when I Send Request One, but this is returned like is showed on Current Response:. How can I do to return a message SOAP without namespaces? Request One <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style"> <soapenv:Header/> <soapenv:Body> <urn:ZProveerDatosPagoProveed2> RG10 S 00000000 </urn:ZProveerDatosPagoProveed2> </soapenv:Body> </soapenv:Envelope> Current Response: <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header/> <soap-env:Body> <n0:ZProveerDatosPagoProveed2Response xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style"> 0000 0000 0000 0000 ES0000 ROBLES AVN TH XXXXX ROBLES AVN 0000 A0000 ROBLES AVN XXXXX <Text1_052>ROBLES AVN</Text1_052> Z000 </n0:ZProveerDatosPagoProveed2Response> </soap-env:Body> </soap-env:Envelope> Expected Response: <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header/> <soap-env:Body> <ZProveerDatosPagoProveed2Response xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style"> 0000 0000 0000 0000 ES0000 ROBLES AVN TH XXXXX ROBLES AVN 0000 A0000 ROBLES AVN XXXXX <Text1_052>ROBLES AVN</Text1_052> Z000 </ZProveerDatosPagoProveed2Response>

http://stackoverflow.com/comment/36770390
has text: I cannot reprocude that with my little dummy project even after your question update. I have changed files, closed the project, reverted changes. So (a) have you verified that encodings.xml was updated when you fixed the encodings? Has anything changed there when you reloaded the files and they were displayed with wrong encoding? (b) How did you revert? Git command line IDEA? How exactly? Please give me a way to reproduce this.
comment on: http://stackoverflow.com/q/23778015
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36494204
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23738633
has text: By the way, you can use `switch` on `String kind` instead of all the `if else`.

http://stackoverflow.com/comment/36699706
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23771022
has text: Just out of curiosity, how does Parallel.ForEach fare?
score: 0

http://stackoverflow.com/q/23725681
tagged with: swing
accepted answer: http://stackoverflow.com/a/23738516
type: Question
tagged with: jbutton
tagged with: arrays
has comment: http://stackoverflow.com/comment/36473722
score: 0
has comment: http://stackoverflow.com/comment/36468495
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36467758
has body: So im linking a java class with array lists and a random array generator to a separate GUI in the same project. Its a Jeopardy Game, so I need the buttons to "get" the strings from the array list and "check" the answer in another. I need to know how to make the GUI "get" info from the other "classes". Thanks. (Question&amp;Answer Class Example) Random generator = new Random(); int random_int = generator.nextInt(10) + 1; double random_int = Math.random() * ( 0 - 24 ); String[] am = new String[25]; String[] ama = new String[25]; am[0] = "Sam";ama[0] = "Sam"; am[1] = "Sam";ama[1] = "Sam"; am[2] = "Sam";ama[2] = "Sam"; ... am[23] = "Sam";ama[23] = "Sam"; am[24] = "Sam";ama[24] = "Sam"; String am_qu = am[random_int]; String am_an = ama[random_int]; (GUI Jpanel button "Action" Example) private void am1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JOptionPane.showMessageDialog(null,""+am_qu+); &lt;--That is what I need to work! } The Jeopardy game will have buttons that you click which will show dialog box with question, a button that says answer and when that is clicked it will open an input box to check answer after the final submit.
has comment: http://stackoverflow.com/comment/36476869
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23738516
has title: Connect a java class to a separate GUI Jpanel button and/or textarea?
tagged with: java

http://stackoverflow.com/comment/36473636
score: 0
type: Comment
type: QuestionComment
has text: @user3580294 Thanks, that fixed it, sorry i'm new to this, thank you very much for helping me.
comment on: http://stackoverflow.com/q/23728493

http://stackoverflow.com/comment/36359357
score: 3
has text: You can't use Scanner class to do that. Probably you might want to read [this](http://stackoverflow.com/questions/18037576/how-do-i-check-if-the-user-is-pressing-a-key)
comment on: http://stackoverflow.com/q/23668349
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23698220
type: Question
accepted answer: http://stackoverflow.com/a/23699043
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23698716
has answer: http://stackoverflow.com/a/23698716
has body: I'm trying to create a JComboBox that will hold Playlist objects in it. I want to have it hold the Playlist's String title, which is the key/display value, and a reference to the actual Playlist so it can be directly accessed when a user clicks a button relating to the selected Playlist. The contents of the combo box will be dynamically changed by the user so someone in another question suggested using the DefaultComboBoxModel to allow it to update itself. I saw this question Adding items to a JComboBox recommended wrapping the item in a new class. I tried this but now my combo box comes up blank. My old code: String[] playlistsStringArray = {"Library"}; JComboBox playlists = new JComboBox(playlistsStringArray); DefaultComboBoxModel model; // worked but only held strings. I was having trouble referencing the playlist itself model = new DefaultComboBoxModel(playlistsStringArray); playlists.setModel(model); My current code: ComboItem myLibCombo = new ComboItem("Library", myLibrary); DefaultComboBoxModel model; ComboItem[] comboItems = new ComboItem[0]; JComboBox comboPlaylists = new JComboBox(comboItems); // empty combo box model = new DefaultComboBoxModel(comboItems); comboPlaylists.setModel(model); comboPlaylists.addItem(myLibCombo); Also tried: ComboItem myLibCombo = new ComboItem("Library", myLibrary); DefaultComboBoxModel model; ComboItem[] comboItems = {myLibCombo}; JComboBox comboPlaylists = new JComboBox(comboItems); // empty combo box model = new DefaultComboBoxModel(comboItems); comboPlaylists.setModel(model); Is there an easier way to do this? Or is my best option to have the playlists held in an array and search for a matching title each time? Any suggestions would be appreciated, thanks.
has answer: http://stackoverflow.com/a/23699043
tagged with: jcombobox
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/17887927
has title: Creating a JComboBox with objects that hold values

http://stackoverflow.com/a/23768393
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36554751
score: 2
has comment: http://stackoverflow.com/comment/36549642
downvote count: 0
has body: Thus is not a crash. It is called a deadlock. Both peers are waiting for the other to send them something. This is an application protocol error. I suggest you write down the sequence of things you are sending and receiving, and see where they don't marry up.
answers question: http://stackoverflow.com/q/23766607
has comment: http://stackoverflow.com/comment/36552714

http://stackoverflow.com/comment/36488766
comment on: http://stackoverflow.com/q/23734105
has text: `public class X extends X`? That's a new one...
score: 0
type: QuestionComment
type: Comment

actionlistener
tags question: http://stackoverflow.com/q/23747620
tags question: http://stackoverflow.com/q/23726416
tags question: http://stackoverflow.com/q/23717382
tags question: http://stackoverflow.com/q/23674363
tags question: http://stackoverflow.com/q/23693777
tags question: http://stackoverflow.com/q/23772701
tags question: http://stackoverflow.com/q/23725835
tags question: http://stackoverflow.com/q/23652558
tags question: http://stackoverflow.com/q/23648272
tags question: http://stackoverflow.com/q/23685745
tags question: http://stackoverflow.com/q/23727379
tags question: http://stackoverflow.com/q/23761132
tags question: http://stackoverflow.com/q/23719085
tags question: http://stackoverflow.com/q/23724659
type: Tag
tags question: http://stackoverflow.com/q/23716863
tags question: http://stackoverflow.com/q/23647892
tag name: actionlistener
tags question: http://stackoverflow.com/q/23756583
tags question: http://stackoverflow.com/q/23661694

http://stackoverflow.com/comment/36269549
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23622731
has text: Spring MVC uses Jackson library.

http://stackoverflow.com/q/23711071
tagged with: amazon-s3
tagged with: java
has title: Copy an Object Using the AWS SDK for Java taking lot of time
has comment: http://stackoverflow.com/comment/36454562
type: Question
has body: I have used AWS SDK for java to copy from one bucket to another File Size : 299mb Code: CopyObjectRequest copyObjRequest = new CopyObjectRequest(sourceBucketName,sourceKeyName,destinationBucket,destinationKeyName); s3client.copyObject(copyObjRequest); It is taking 1min 20 sec to copy But if do it with s3cmd cp command it is taking 33sec to copy the same file. Kindly suggest any solution to speed up the copy process using java sdk
tagged with: amazon-web-services
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36441639
answer count: 0

http://stackoverflow.com/comment/36620579
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23744669
has text: @AndreaF Please update the question with your code as is right now.

http://stackoverflow.com/comment/36413611
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23697196
has text: @Gimby probably this is answer to my question , if I restart server i should not worry about it.
score: 0

http://stackoverflow.com/a/23642404
has comment: http://stackoverflow.com/comment/36333365
accepted answer of: http://stackoverflow.com/q/23642276
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36333266
answers question: http://stackoverflow.com/q/23642276
type: Answer
has body: You have created a cyclic dependencies of the object SimpleTableDemo as shown below that results into StackOverflowError Constructor -> Method -> Constructor -> Method -> ... public SimpleTableDemo() { super(new GridLayout(1, 0)); ... createAndShowGUI(); } private static void createAndShowGUI() { ... //Create and set up the content pane. SimpleTableDemo newContentPane = new SimpleTableDemo(); ... } Do in this way public SimpleTableDemo() { super(new GridLayout(1, 0)); ... // pass the reference of this object createAndShowGUI(this); } private static void createAndShowGUI(SimpleTableDemo newContentPane ) { ... //remove this line //SimpleTableDemo newContentPane = new SimpleTableDemo(); ... } Screenshot:
score: 3
upvote count: 3

http://stackoverflow.com/a/23713838
has body: You're not comparing characters but one-length Strings. And your custom Comparator&lt;String&gt; returns the result of comparing the second string against the first, thus getting a reverse order. Note that the code in the comparator can be easily reduced to: class MyComp implements Comparator&lt;String&gt; { public int compare(String a ,String b) { /* System.out.println(a+" "+b); String aStr,bStr; aStr=a; bStr=b; int g = bStr.compareTo(aStr); return g; */ return b.compareTo(a); } } More info: String#compareTo TreeSet&lt;E&gt; uses the provided Comparator&lt;E&gt; to evaluate the order of the elements when inserting them. Let's follow the code (you should debug it): ts.add("c"); //comparator will compare "c" and "c" (very silly but that's how is implemented) //"c" will be the root of the tree ts.add("e"); //comparator will compare "e" and "c" //since "e" is lower than "c", "e" will be placed to the left of "c". ts.add("b"); //comparator will compare "b" and "c" //since "b" is greater than "c", "b" will be placed to the right of "c" ts.add("a"); //comparator will compare "a" and "c" //since "a" is greater than "c", "a" will be placed to the right of "c" //but on its right is "b", so comparator will compare "a" and "b" //since "a" is greater than "b", "a" will be placed to the right of "b" ts.add("d"); //comparator will compare "d" and "c" //since "d" is lower than "c", "d" will be placed to the left of "c" //but on its left is "e", so comparator will compare "d" and "e" //since "d" is greater than "e", "d" will be placed to the right of "e" ts.add("g"); //comparator will compare "g" and "c" //since "g" is lower than "c", "g" will be placed to the left of "c" //but on its left is "e", so comparator will compare "g" and "e" //since "g" is lower than "e", "g" will be placed to the left of "e" ts.add("f"); //comparator will compare "f" and "c" //since "f" is lower than "c", "f" will be placed to the left of "c" //but on its left is "e", so comparator will compare "f" and …
answers question: http://stackoverflow.com/q/23713816
type: Answer
has comment: http://stackoverflow.com/comment/36444913
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36444408
has comment: http://stackoverflow.com/comment/36444467
accepted answer of: http://stackoverflow.com/q/23713816
type: AcceptedAnswer
downvote count: 0

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/23765894
type: Tag

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/23721972

http://stackoverflow.com/comment/36563448
type: Comment
score: 0
has text: Yes, specify as input in the Driver class of job 2, the output path of job 1. See the tutorial that I sent you
type: AnswerComment
comment on: http://stackoverflow.com/a/23764442

http://stackoverflow.com/a/23628321
type: Answer
downvote count: 0
has body: I have found that after executing the query at rs = stmt.executeQuery(query); I close the connection and this is the code that runs after the modification: public ResultSet exec() { ResultSet rs = null; try { stmt= connection.createStatement(); rs = stmt.executeQuery(query); } catch (SQLException ex) { ex.printStackTrace(); } // try { // connection.close(); //this is what was wrong with the code // } catch (SQLException ex) { // ex.printStackTrace(); // } return rs; }
score: 1
answers question: http://stackoverflow.com/q/23628217
has comment: http://stackoverflow.com/comment/36279857
upvote count: 1

http://stackoverflow.com/q/23620855
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/23621110
type: Question
has body: I am trying to use the JAXB Unmarshaller to translate an xml document into a java object tree. The XML document looks like this: <Shape/> <Color/> <Shape/> <Color/> <Shape/> <Color/> <Shape/> <Color/> I created very basic classes to hold each component: Levels.java: @XmlRootElement public class Levels { private List levels = new ArrayList (); @XmlElementRef(name="Level") public List getLevels() { return levels; } public void setLevels(List levels) { this.levels = levels; } } Level.java: @XmlRootElement(name="Levels") public class Level { private Solution solution = new Solution(); private Clues clues = new Clues(); @XmlElementRef(name="Solution") public Solution getSolution() { return solution; } public void setSolution(Solution solution) { this.solution = solution; } @XmlElementRef(name="Clues") public Clues getClues() { return clues; } public void setClues(Clues clues) { this.clues = clues; } } The rest of the classes are formatted the same as these(same annotations and only getter and setter methods) The code I use to unmarshal the xml is: File file = new File("res/levelTest.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Levels.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Object o = jaxbUnmarshaller.unmarshal(file); System.out.println(o); The problem I am getting is that when I print the object, it prints newXML.Solution@*** not newXML.Levels@*** which is the root element. This means that the unmarshaller is returning an element other than the root element. I have searched google and stack overflow but I couldn't find an explanation for this. Any help is appreciated.
downvote count: 0
answer count: 1
has title: JAXB unmarshal returns non-root element
favorite count: 0
has answer: http://stackoverflow.com/a/23621110
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/q/23675662
type: Question
tagged with: database
tagged with: glassfish
downvote count: 4
accepted answer: http://stackoverflow.com/a/23676507
upvote count: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
tagged with: netbeans
has body: I am attempting to build a database that will allow a user to upload their music to be accessed by someone else/third party. How would I create it so that the music can be uploaded to a database but providing a path for it to be accessed from where it is stored? As in A Band upload “Song” and it is then streamed by A Fan. If it can't upload to a database I need to upload it to a server. We are building the back end in Java and the front end in HTML. We are also using Glassfish and Netbeans for writing the code.
score: -4
type: AnsweredQuestion
has title: Building a database
tagged with: java
has answer: http://stackoverflow.com/a/23676507

http://stackoverflow.com/comment/36321997
comment on: http://stackoverflow.com/q/23649802
type: Comment
type: QuestionComment
has text: Basically you are looking for an alternative to RabbitMQ that can be embedded. Are you sure RabbitMQ doesn't have embedding options itself? ActiveMQ does for example. http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
score: 0

http://stackoverflow.com/a/23713110
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23713081
score: 1
has body: None of the elements of your arrays of Dimensions are initialized. i.e. all Player0Positions[i]s and Player1Positions[i]s are null so when you try to invoke .setSize on them you get NPE. So, you might want to initialized them first - for(int i = 0; i &lt; 4; ++i) { Player0Positions[i] = new Dimension(); Player0Positions[i].setSize(bufferArray[(2*i)], bufferArray[(2*i + 1)]); Player1Positions[i] = new Dimension(); Player1Positions[i].setSize(bufferArray[(2*i + 8)], bufferArray[(2*i + 9)]); }
answers question: http://stackoverflow.com/q/23713081
type: Answer

http://stackoverflow.com/comment/36346865
comment on: http://stackoverflow.com/q/23662195
score: 0
type: Comment
type: QuestionComment
has text: The second line also leads to the thread error

http://stackoverflow.com/a/23647115
has comment: http://stackoverflow.com/comment/36340445
has body: The Instant class does not have a time zone. It gets printed like it's in the UTC zone because it has to be printed in some zone(you wouldn't want it to be printed in ticks, would you?), but that's not it's time zone - as demonstrated in the following example: Instant instant=Instant.now(); System.out.println(instant);//prints 2014-05-14T06:18:48.649Z System.out.println(instant.atZone(ZoneId.of("UTC")));//prints 2014-05-14T06:18:48.649Z[UTC] The signatures of ZoneOffset.from and OffsetDateTime.from accept any temporal object, but they fail for some types. java.time does not seem to have an interface for temporals that have a timezone or offset. Such an interface could have declare getOffset and getZone. Since we don't have such interface, these methods are declared separately in multiple places. If you had a ZonedDateTime you could call it's getOffset. If you had an OffsetDateTime you could also call it's offset - but these are two different getOffset methods, as the two classes don't get that method from a common interface. That means that if you have a Temporal object that could be either you would have to test if it's an instanceof both of them to get the offset. OffsetDateTime.from simplifies the process by doing that for you - but since it also can't rely on a common interface, it has to accept any Temporal object and throw an exception for those that don't have an offset.
score: 19
answers question: http://stackoverflow.com/q/23641846
has comment: http://stackoverflow.com/comment/36335998
has comment: http://stackoverflow.com/comment/36650469
has comment: http://stackoverflow.com/comment/36327436
has comment: http://stackoverflow.com/comment/36329309
has comment: http://stackoverflow.com/comment/102311117
downvote count: 0
has comment: http://stackoverflow.com/comment/36341934
has comment: http://stackoverflow.com/comment/55560419
has comment: http://stackoverflow.com/comment/36650414
has comment: http://stackoverflow.com/comment/36338005
type: Answer
upvote count: 19

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/23761242
tags question: http://stackoverflow.com/q/23662306

http://stackoverflow.com/q/23649948
has comment: http://stackoverflow.com/comment/36322156
tagged with: collections
has answer: http://stackoverflow.com/a/23650068
answer count: 4
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/801993
has answer: http://stackoverflow.com/a/23650090
accepted answer: http://stackoverflow.com/a/23650090
tagged with: java
has comment: http://stackoverflow.com/comment/36322354
possible better answer: http://stackoverflow.com/a/23650068
has answer: http://stackoverflow.com/a/23650042
type: Question
score: 4
has body: Can I use the standard Collections classes (as opposed to the concurrent ones) as long as I ensure the code makes no data changes on multiple threads. The code that I'm talking about is completely under my control, and I'm not mutating it after the initial (single-threaded) population phase. I know that some classes such as DateFormat are not threadsafe because they store intermediate states as they are being used. Are the collections (ArrayList, Tree Map, etc.) safe though?
has answer: http://stackoverflow.com/a/23650062
upvote count: 4
favorite count: 0
has title: Are Java collections safe if read but not modified on multiple threads?

http://stackoverflow.com/comment/36336282
score: 0
has text: I'm reading now about it and i don't understand one thing. On first page i would like to have 3 radio button in the center and 1 button below them. When i clik this button it should remove everything and on the left corner should be some text then 9x9 text field and below all button. How should i do it?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23655547

http://stackoverflow.com/comment/36623537
type: AnswerComment
comment on: http://stackoverflow.com/a/23763943
type: Comment
has text: Agree, if you only want to check that your string begins with a predefined string you don't need a regexp for that.
score: 0

http://stackoverflow.com/comment/36495934
comment on: http://stackoverflow.com/q/23727678
score: 0
type: Comment
type: QuestionComment
has text: @NeilBartlett I don't want to define java.lang.String. I want to define a completely new class which has e.g. an input parameter of type String. Christian, I updated the question so that you can make yourself a more precise picture of the problem.

http://stackoverflow.com/comment/36460433
score: 0
type: Comment
has text: @Snowbird actually, its not that bad, you are getting around 20K writes per second which is pretty good considering you are creating new files like this. If you wanted say over a million transactions per second, you would need a different approach.
comment on: http://stackoverflow.com/a/23721905
type: AnswerComment

http://stackoverflow.com/a/23665303
answers question: http://stackoverflow.com/q/23665119
has body: I think the problem is in the while condition while(helperLeft &lt;= curr &amp;&amp; curr &lt;=helperRight) In this you never check if helperLeft or helperRight exceed the Array index. Modify it as folows : while(helperLeft &lt; arr.length &amp;&amp; helperRight&lt; arr.length &amp;&amp; helperLeft &lt;= curr &amp;&amp; curr &lt;=helperRight) { // do something }
score: 0
type: Answer

http://stackoverflow.com/q/23642783
has comment: http://stackoverflow.com/comment/36308846
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23642991
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23642991
accepted answer: http://stackoverflow.com/a/23642898
tagged with: android
has answer: http://stackoverflow.com/a/23642898
has body: So I'm building an application with a dev, test and release version. I have additional fragments in the dev and test version which I don't want to show up in the release version. Currently hide those fragments in the actionbar and prevent the user from swiping to different fragments (thereby preventing them from going to the hidden fragments). I have a final static variable which I set to dev, test or release which then builds the app with/without the tabs. Can I make it somehow that it doesn't even compile those fragments in the release version? I know I could possibly recreate 3 projects with the differences in them but I was looking for just one copy of the source code so I don’t have to keep track of changes in the core app.
type: AnsweredQuestion
tagged with: java
has title: Exclude certain classes from compiling in android

http://stackoverflow.com/q/23757228
tagged with: restful-url
possible better answer: http://stackoverflow.com/a/23757604
tagged with: amazon-ec2
tagged with: amazon-web-services
favorite count: 0
score: 0
has body: I am new to the restful web services. So my knowledge is minimal about the topic. I am developing a restful service in Java &amp; I want to call an Amazon web service API from inside the service. Is this possible? How many ways can I do this?
tagged with: rest
has title: How to make an API call from a RESTful service in Java?
has answer: http://stackoverflow.com/a/23757604
upvote count: 1
has comment: http://stackoverflow.com/comment/36528124
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23758305
accepted answer: http://stackoverflow.com/a/23758305
type: Question
answer count: 2

http://stackoverflow.com/comment/36381729
type: QuestionComment
score: 0
has text: I have edited the title to not be so generic
type: Comment
comment on: http://stackoverflow.com/q/23677544

http://stackoverflow.com/a/44409704
answers question: http://stackoverflow.com/q/23751193
type: Answer
score: 0
has body: This works for me: All pageable request use MyCustomPage and use a default page and size if not found in request. If size (number of record exceed the max value) i set a default value, which in this case 50. public class MyCustomPage extends PageRequest{ Integer MAX_PAGE_SIZE = 50 //constructor public MyCustomPage(Integer page, Integer size) { super(page,(size&gt;MAX_PAGE_SIZE)?MAX_PAGE_SIZE:size); } }

http://stackoverflow.com/comment/36364259
type: AnswerComment
comment on: http://stackoverflow.com/a/23647377
type: Comment
score: 0
has text: @Rgjerry : Glad to help and you got it working. I'm surprised you had to explicitly provide port 80 as part of the URL as HTTP normally defaults to that port although when programming I suppose it is different. The key thing is to remember the `doInBackground` method runs on a different thread to other Android components and should never attempt to access things like EditTexts in the Activity (for example). It IS safe, however, to use any of the other methods of an AsyncTask to access UI components.

http://stackoverflow.com/comment/36480074
has text: Great. I'll make an actual answer from that comment.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23731387

http://stackoverflow.com/q/23756304
answer count: 6
has comment: http://stackoverflow.com/comment/36525810
has comment: http://stackoverflow.com/comment/36525908
has comment: http://stackoverflow.com/comment/36525874
has comment: http://stackoverflow.com/comment/59243119
has comment: http://stackoverflow.com/comment/36526029
has answer: http://stackoverflow.com/a/23756487
has comment: http://stackoverflow.com/comment/36525755
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/9560600
tagged with: constructor
has comment: http://stackoverflow.com/comment/36525966
has answer: http://stackoverflow.com/a/23756441
has answer: http://stackoverflow.com/a/23756454
has comment: http://stackoverflow.com/comment/36526038
has comment: http://stackoverflow.com/comment/36525909
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23756441
accepted answer: http://stackoverflow.com/a/23756454
score: 1
has body: This is my first day learning java (on my own), so I need some help. This is my code: public class java_main { public static void main(String[] args) { MyClass my = new MyClass(3,4); MyClass your = new MyClass(); } public class MyClass { public int a,b; public Myclass(int i, int j) { a = i; b = j; } public Myclass() { a = 1; b = 2; } } } I'm getting this error: No enclosing instance of type java_main is accessible. Must qualify the allocation with an enclosing instance of type java_main (e.g. x.new A() where x is an instance of java_main). Any suggestions? Thanks in advance!!!
tagged with: java
has title: Java: Using different constructors
upvote count: 1
has comment: http://stackoverflow.com/comment/36525940
has answer: http://stackoverflow.com/a/23756732
type: Question
has answer: http://stackoverflow.com/a/23757045
has answer: http://stackoverflow.com/a/23756473
has comment: http://stackoverflow.com/comment/36525806

http://stackoverflow.com/comment/36414403
comment on: http://stackoverflow.com/q/23697869
score: 0
has text: @ZouZou I will admit, though--it's not NEARLY as bad as MathExchange. That place is horrendous for new users. At least here, you almost always get an answer, and there's generally pretty helpful and friendly users amongst the crowd.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36335212
has text: I tried creating an instance of MyTestRunListener in the same class that launches the ILaunchConfiguration. The ClassNotFoundException is referring to org.eclipse.jdt.junit.TestRunListener
type: Comment
comment on: http://stackoverflow.com/a/23633002
score: 0
type: AnswerComment

http://stackoverflow.com/a/23729089
type: Answer
has body: Instead of Scanner class, use BufferReader class to read a file line by line. When you read each line, save it into Array or ArrayList of int. When you read the whole file, convert Array or ArrayList to 2D array. For example: Reading a file line by line and save each line into an array or arrayList File file = new File(filename); FileReader reader = new FileReader(file); BufferedReader buffReader = new BufferedReader(reader); String line = buffReader.readLine(); while(line!=null){ lines.add(line); line = buffReader.readLine(); } convert array or arraylist to 2D dimensional array
answers question: http://stackoverflow.com/q/23728525
score: 0

http://stackoverflow.com/a/23691392
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36404647
type: Answer
accepted answer of: http://stackoverflow.com/q/23690494
answers question: http://stackoverflow.com/q/23690494
has comment: http://stackoverflow.com/comment/41863961
has comment: http://stackoverflow.com/comment/36405142
has body: HTTP (and other textual internet protocols) mandate the use of ASCII CR+LF for line break sequences - CR being the "carriage return" character (\r) and LF being the "line feed" character (\n). This escape sequence - \r\n - is also the file separator used on Windows systems, and thus is what gets returned by your call to System.getProperty("line.separator") and then gets appended by your call to sb.append(lineSeparator) to the output string. This is happening both in your tests and when "the code is executed on the actual server" - in both instances (I presume), the code is being executed on your windows server, and thus the same string generated. This sequence is not being translated to &amp;#13, as you suggest. If it was, then your entire output would appear on a single line, with &amp;#13 inserted where newlines are expected. However, it doesn't sound like that's the case - it sounds like you're getting the line breaks where you expect them but with an unexpected &amp;#13 at the end of each line. This makes sense when we recognize that a lone \n is sufficient to represent a line break in most programming languages and environments, and that 13 is the decimal representation of the carriage return character I presume that your tests are displaying the strings generated in raw string form (perhaps simply by a call to println(sb.toString()), in which case the \r\n is being interpreted and displayed as you expect it to be. I also presume that your TransactionMessage class is transmitting messages not as raw strings but rather as HTML, because &amp;#13 would be the HTML entity code for the decimal representation of the carriage return character. I can't tell you exactly why (at least without knowing more about your particular situation), but for some reason the LR character is being converted to its decimal representation, and your chosen method for displaying the resultant string on the client doesn't recognize that representation as a control character and therefore i…

http://stackoverflow.com/q/23688394
has comment: http://stackoverflow.com/comment/36397905
has comment: http://stackoverflow.com/comment/36397612
has comment: http://stackoverflow.com/comment/36397630
has comment: http://stackoverflow.com/comment/36397530
score: 0
accepted answer: http://stackoverflow.com/a/23688893
answer count: 1
has comment: http://stackoverflow.com/comment/36397559
has comment: http://stackoverflow.com/comment/36397759
has title: Why am I getting a PatternSyntaxException in my Android program?
has comment: http://stackoverflow.com/comment/36397828
has answer: http://stackoverflow.com/a/23688893
tagged with: exception
tagged with: android
tagged with: regex
has comment: http://stackoverflow.com/comment/36397191
has comment: http://stackoverflow.com/comment/36397534
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36397489
type: Question
has body: I have a Java regex Pattern consisting of a group of any characters at the end of a string with a positive look-behind. It compiles and runs just fine when I use the 1.6 JDK outside of Android but when I place it in my Android app's code it throws a PatternSyntaxException. Here is the line: Pattern namePat = Pattern.compile("(?&lt;=DISCOVERY,\\d,[0-9A-F]{12},\\d,[+-][\\d]{3},\\d,[\\d]{4})(.*)$"); and here is the error message: 4784:D/com.example.MyTestApp.DiscoverThread( 4255): java.util.regex.PatternSyntaxException: Look-behind pattern matches must have a bounded maximum length near index 56: 4785:D/com.example.MyTestApp.DiscoverThread( 4255): (?&lt;=DISCOVERY,\d,[0-9A-F]{12},\d,[+-][\d]{3},\d,[\d]{4})(.*)$ 4786:D/com.example.MyTestApp.DiscoverThread( 4255): ^ 4787:D/com.example.MyTestApp.DiscoverThread( 4255): at java.util.regex.Pattern.compileImpl(Native Method) 4788:D/com.example.MyTestApp.DiscoverThread( 4255): at java.util.regex.Pattern.compile(Pattern.java:411) 4789:D/com.example.MyTestApp.DiscoverThread( 4255): at java.util.regex.Pattern.&lt;init&gt;(Pattern.java:394) 4790:D/com.example.MyTestApp.DiscoverThread( 4255): at java.util.regex.Pattern.compile(Pattern.java:381) 4791:D/com.example.MyTestApp.DiscoverThread( 4255): at com.example.MyTestApp.Parser$DiscoveryParser.&lt;init&gt;(Parser.java:146) 4792:D/com.example.MyTestApp.DiscoverThread( 4255): at com.example.MyTestApp.DiscoverThread.run(DiscoverThread.java:61) 4793:D/com.example.MyTestApp.DiscoverThread( 4255): at java.lang.Thread.run(Thread.java:841) As far as I can tell, the length of the look-behind is fully specified. Am I missing something? The app is running on an Android 4.4.2 device

http://stackoverflow.com/a/27555994
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/49595810
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23730328
has body: This is caused due to problems on the device which is beyond your control. Even I get similar reports in dev console, but after extensive research I have concluded that you simply cannot prevent this crash from your side by using any conventional means because it is not caused by any fault in your app but a fault on user's system. You cannot control your user's system and many crashes which are caused due to unexpected behavior of the system cannot be "fixed", not by app developers.

http://stackoverflow.com/q/23660715
type: UnansweredQuestion
has title: Impact on performance by using external jars in servlets
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23660774
tagged with: eclipse
tagged with: servlets
score: 0
has body: I am using Eclipse WTP for a project. It requires few libraries to be used. Few are small in size and few are larger. My question is, what happens when we use external jars in servlets ? If I am importing a heavy-weight library in a Servlet, does it impacts webpage load time ? Or Java just compiles my program including libraries to give results. I understand heavy-weight jar will take time to load once even on my local machine, but I can manage them to be initiated only once (by creating a separate class and initiate static variables and use them from other classes). But seems like, this can't be done in Servlets and every time a page is loaded, servlet has to load all those heavy jars. Is it good to use Guava and Solrj in Servlets ? Do they slow down (asking because I feel Solrj is slowing down webpage load time) ?
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/36489784
score: 2
type: QuestionComment
type: Comment
has text: Do you know unary operators?
comment on: http://stackoverflow.com/q/23737430

http://stackoverflow.com/q/23713374
answer count: 1
downvote count: 2
tagged with: android
favorite count: 0
tagged with: netbeans
upvote count: 0
has body: How can I run my android application that I have created using Netbeans on an Android mobile? I have read this "How to run J2ME application directly on the mobile from NetBeans?" and the answer was: In Netbeans, right click your project and click on 'Build'. Now navigate to the directory where your project is stored and go to the folder called 'dist'. In that, you will find a JAR file with the name of your project. Copy that to your cellphone and execute it. Does this works for Android as well? THANKS
has answer: http://stackoverflow.com/a/23713430
accepted answer: http://stackoverflow.com/a/23713430
has title: Create Android app in Netbeans to Android Mobile
type: AnsweredQuestion
tagged with: java
type: Question
score: -2

http://stackoverflow.com/q/23771124
has comment: http://stackoverflow.com/comment/36554797
downvote count: 0
has title: How to make a specific thread to sleep?
has comment: http://stackoverflow.com/comment/36554776
score: 1
tagged with: java
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/23771231
has comment: http://stackoverflow.com/comment/36554844
has comment: http://stackoverflow.com/comment/36554779
has comment: http://stackoverflow.com/comment/36554816
linked to: http://stackoverflow.com/q/1508278
tagged with: thread-sleep
upvote count: 1
has body: I have 9 threads that do some calculations . I want to make one of them , or more , to go to sleep . The code : public class CalcArray { private static int[] m_array = null; private static int sum = 0; private final static int MAX_VALUE = 80; /** * */ public static void putValues() { for (int i = 0; i &lt; MAX_VALUE ; i++) { m_array[i] = 1; } } /** * * @param args * @throws InterruptedException */ public static void main(String[] args) throws InterruptedException { m_array = new int[80]; putValues(); int lowBound = 0; int upperBound = 9; Thready[] threadsArray = new Thready[10]; for (int j = 0; j &lt; 8 ; j++) { threadsArray[j] = new Thready(lowBound , upperBound); lowBound += 10; upperBound += 10; } // start the threads for (int q = 0; q &lt; 8; q++) { if (q == 5) { // make the thread with #5 to take a nap // Thread.sleep(3000); } threadsArray[q].run(); } System.out.println("Main Thread is done!"); System.out.println(sum); } /** * * @author X * */ public static class Thready implements Runnable { int lower = 0; int upper = 0; public Thready(int paramLower , int paramUpper) { lower = paramLower; upper = paramUpper; } @Override public void run() { synchronized(m_array) { for (int i = lower ; i &lt;= upper ; i++) { sum += m_array[i]; } System.out.println("The current value is :" + sum); } } } } I want to make thread number #5 to take a nap . If I use Thread.sleep(3000); it would cause the Main Thread to go to sleep . So how can I tell thread #5 to go to sleep ?
answer count: 1
has comment: http://stackoverflow.com/comment/36555113
duplicate of: http://stackoverflow.com/q/1508278
has comment: http://stackoverflow.com/comment/36554989
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39062123
score: 1
comment on: http://stackoverflow.com/q/23708571
type: Comment
type: QuestionComment
has text: I solved the problem, I used only one thread. Thanks for pointing me towards the thread problem @Jared

http://stackoverflow.com/comment/36526710
has text: it's likely you're right, the correct regex would be `\r|\n|(\r\n)`. Or just `(\r?\n)|\r`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23756541
type: Comment

spring
tags question: http://stackoverflow.com/q/23676254
tags question: http://stackoverflow.com/q/23668008
tags question: http://stackoverflow.com/q/23738187
tags question: http://stackoverflow.com/q/23672319
tags question: http://stackoverflow.com/q/23692101
tags question: http://stackoverflow.com/q/23682644
tags question: http://stackoverflow.com/q/23754634
tags question: http://stackoverflow.com/q/23714530
tags question: http://stackoverflow.com/q/23732089
tags question: http://stackoverflow.com/q/23630933
tags question: http://stackoverflow.com/q/23638815
tags question: http://stackoverflow.com/q/23730090
tags question: http://stackoverflow.com/q/23695817
tags question: http://stackoverflow.com/q/23730333
tags question: http://stackoverflow.com/q/23624985
tags question: http://stackoverflow.com/q/23671227
tags question: http://stackoverflow.com/q/23649525
tags question: http://stackoverflow.com/q/23637788
tags question: http://stackoverflow.com/q/23743469
tags question: http://stackoverflow.com/q/23731948
tags question: http://stackoverflow.com/q/23690919
tags question: http://stackoverflow.com/q/23674691
tags question: http://stackoverflow.com/q/23669523
tags question: http://stackoverflow.com/q/23625794
tags question: http://stackoverflow.com/q/23699203
tags question: http://stackoverflow.com/q/23739468
tags question: http://stackoverflow.com/q/23636410
tags question: http://stackoverflow.com/q/23624873
tags question: http://stackoverflow.com/q/23645543
tags question: http://stackoverflow.com/q/23668052
tags question: http://stackoverflow.com/q/23681822
tags question: http://stackoverflow.com/q/23692094
tags question: http://stackoverflow.com/q/23621723
tags question: http://stackoverflow.com/q/23734604
tags question: http://stackoverflow.com/q/23732439
tags question: http://stackoverflow.com/q/23679513
tags question: http://stackoverflow.com/q/23658019
tags question: http://stackoverflow.com/q/23658628
tags question: http://stackoverflow.com/q/23679990
tags question: http://stackoverflow.com/q/23686116
tags question: http://stackoverflow.com/q/23695079
tags question: http://stackoverflow.com/q/23759620
tags question: http://stackoverflow.com/q/23649389
tags question: http://stackoverflow.com/q/23638861
tags question: http://stackoverflow.com/q/23730427
tags question: http://stackoverflow.com/q/23701279
tags question: http://stackoverflow.com/q/23766446
tags question: http://stackoverflow.com/q/23677319
tags question: http://stackoverflow.com/q/23739691
tags question: http://stackoverflow.com/q/23708230
tags question: http://stackoverflow.com/q/23687012
tags question: http://stackoverflow.com/q/23659038
tags question: http://stackoverflow.com/q/23732675
tags question: http://stackoverflow.com/q/23713732
tags question: http://stackoverflow.com/q/23742474
tags question: http://stackoverflow.com/q/23714671
tags question: http://stackoverflow.com/q/23756553
tags question: http://stackoverflow.com/q/23753496
tags question: http://stackoverflow.com/q/23710827
tags question: http://stackoverflow.com/q/23697431
tags question: http://stackoverflow.com/q/23627600
tags question: http://stackoverflow.com/q/23778134
type: Tag
tags question: http://stackoverflow.com/q/23645091
tags question: http://stackoverflow.com/q/23678908
tags question: http://stackoverflow.com/q/23753533
tags question: http://stackoverflow.com/q/23777270
tags question: http://stackoverflow.com/q/23759942
tags question: http://stackoverflow.com/q/23674046
tags question: http://stackoverflow.com/q/23631868
tags question: http://stackoverflow.com/q/23644915
tags question: http://stackoverflow.com/q/23731729
tags question: http://stackoverflow.com/q/23734570
tags question: http://stackoverflow.com/q/23677808
tags question: http://stackoverflow.com/q/23744364
tags question: http://stackoverflow.com/q/23618602
tags question: http://stackoverflow.com/q/23665107
tags question: http://stackoverflow.com/q/23774241
tags question: http://stackoverflow.com/q/23740924
tags question: http://stackoverflow.com/q/23685597

http://stackoverflow.com/q/23624558
linked to: http://stackoverflow.com/q/16918959
type: Question
has comment: http://stackoverflow.com/comment/36272750
tagged with: testing
has answer: http://stackoverflow.com/a/30987096
has comment: http://stackoverflow.com/comment/36275610
has comment: http://stackoverflow.com/comment/36272908
tagged with: nio
has comment: http://stackoverflow.com/comment/36275721
has title: The type java.nio.CharBuffer cannot be resolved
has answer: http://stackoverflow.com/a/33252430
has comment: http://stackoverflow.com/comment/36281020
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36272981
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36275864
has comment: http://stackoverflow.com/comment/36275537
has answer: http://stackoverflow.com/a/24770595
has answer: http://stackoverflow.com/a/31781497
has body: I' am using java jdk1.8.0_05. In the project i get an error as 'The type java.nio.CharBuffer cannot be resolved. It is indirectly referenced from required .class files' in the line: new FileReader(filename).read(buffer); How to solve this.
has comment: http://stackoverflow.com/comment/36306882
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36280867
tagged with: java
has answer: http://stackoverflow.com/a/30156713

http://stackoverflow.com/comment/36465142
has text: Thanks Richard, I just ignored that while writing code. Generally I return null in the else of Factory & catch the NullPointerException at appropriate place.
type: Comment
comment on: http://stackoverflow.com/a/23724315
score: 0
type: AnswerComment

http://stackoverflow.com/q/23690446
type: Question
tagged with: swing
has title: How to display on root window in Java?
tagged with: screensaver
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36401370
has comment: http://stackoverflow.com/comment/36401179
tagged with: fullscreen
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36401806
answer count: 0
has body: I made a Windows screensaver with Java Swing and Launch4J, and I want to port it to Linux. The obvious method is to use Xscreensaver to display the screensaver, as it just requires a single line added to a config. My question is how to tell Java (either in code or as a command line argument to the JVM) to display a Swing app on the X server root window, as is required for Xscreensaver.
tagged with: linux

cucumber
tags question: http://stackoverflow.com/q/23732814
tags question: http://stackoverflow.com/q/23675126
tags question: http://stackoverflow.com/q/23672842
type: Tag
tag name: cucumber
tags question: http://stackoverflow.com/q/23678406
tags question: http://stackoverflow.com/q/23674574

http://stackoverflow.com/comment/36337115
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23657498
has text: The field `variable` is static, so it can be accessed. That's basically the same concept as with a top-level class.

http://stackoverflow.com/comment/36478914
type: Comment
has text: What does the println print?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23731478

http://stackoverflow.com/a/23698233
has body: You can scale the image and create an ImageIcon. Something like this: ImageIcon icon = new ImageIcon("img.png"); Image scaledImg = icon.getImage().getScaledInstance(newWidth, newHeight, java.awt.Image.SCALE_SMOOTH); icon = new ImageIcon(scaledImg); JButton button = new JButton(icon); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.CENTER);
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23698092
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/36395190
type: Comment
score: 0
has text: can u let me the error ? is it null pointer or something else ? also what the package names for main activity and unity game package plzzz...
type: AnswerComment
comment on: http://stackoverflow.com/a/23687307

http://stackoverflow.com/q/23707748
tagged with: count
tagged with: swing
has body: So basically i use a keybinding on a jpanel to start a timer. I am trying to figure out how to use the keybinding again but while the timer is still going in order to increase the count. m2.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke (KeyEvent.VK_LEFT,0,true),"left"); m2.getActionMap().put("left",new Actions()); public void Timer(boolean startTimer){ if(startTimer==true){ long staTime = System.currentTimeMillis(); while(startTimer==true){ System.out.println(System.currentTimeMillis()/1000.0-staTime/1000.0); } } } public class Actions extends AbstractAction { private static final long serialVersionUID = 1L; int start = 0; int count = 0; public void actionPerformed(ActionEvent e) { Begin b = new Begin(); if(start==0){ start++; b.Timer(true); } count++; System.out.println(count); if(count==10){ b.Timer(false); } }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36443914
type: Question
has answer: http://stackoverflow.com/a/23712860
accepted answer: http://stackoverflow.com/a/23712860
has title: Timer and keybinding at the same time
has comment: http://stackoverflow.com/comment/36434068
score: 0
answer count: 1
tagged with: timer

http://stackoverflow.com/a/23696704
type: Answer
has body: Thanks for the advice. Currently I am running 1.7 on my machine. I can run DTRACE from terminal and inside the installer there is a window displaying all my variables and checks. The check for the JRE returns true so i know it is working. My main problem is I do not know what could cause my bin file to run when run from terminal and what would keep it from working when .jar is launched through finder. Thanks again I will try virtual box to see if that clears anything up.
score: 0
answers question: http://stackoverflow.com/q/23688417

http://stackoverflow.com/comment/36388445
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23683954
type: AnswerComment
has text: thanks for the help. But when iam modifying scope in ManagedBean to ViewScoped as you mentioned, its throwing the error " ViewScoped cannot be resolved to a type".

http://stackoverflow.com/q/23633657
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23801459
has body: I need to build a panel which contains 2 internal panels, ordered left to right, with fixed height and varied width. The width expansion, or in other words - the x filling wight, is dependent upon the parent container's width. The scenario is that up to a certain width of the parent container, I want only the right panel to fill it's needed horizontal space, and from that width to a larger width, only the left panel to expand, and so on. I tried 2 ways - switching the GridBagConstraints of the 2 children panels, or using BorderLayout and similarly removing the children and re-add them with the respective BorderLayout.CENTER for the expanded component, or BorderLayout.EAST (or west). This switching will be upon the calculation of the result width interval, by using ComponentResized calls by adding ComponentAdapter to the parent container. The problem is that the resize events are not sequential - e.g. I receive events for widths: 317, 322, 330, not necessarily for all the numbers in between, and it is triggered only AFTER the components are resized and painted. This results in a very annoying flickering when we see the panel expanded up to the width it shouldn't. Thanks in advance for any help.
tagged with: swing
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36290531
type: Question
tagged with: layout
has comment: http://stackoverflow.com/comment/36716230
answer count: 1
downvote count: 0
has title: How to dynamically set components expansion property dependent on container's width
favorite count: 0

http://stackoverflow.com/a/23676136
type: AcceptedAnswer
has body: It looks like the reason why the Remainder is growing is the growth of the number of Activity instances in the back stack (e.g. 13 instances of the "List" Activity + 13 instances of the "Main" Activity). I've changed my Navigation Drawer so that when the user clicks the "Home" button (which takes him to the App's "Dashboard") I set the Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK flags: the Activity is re-used and the back stack is cleared (as recommended by the Android guidelines, actually). In fact, I should have done this already as I don't want several instances of the Dashboard ("Home") activity to be created. By doing this I can see that the Activities are destroyed and allocated heap size (including the "Remaining" slice) decreases: While fixing this, I also noticed that one of my Activities and a Bitmap used by it were not being destroyed, even if the back stack had been cleared (leak). After analysing with MAT I concluded that the source of this sub-problem was a reference to an ImageView that I kept in the Activity. By adding this code to the onStop() method, I've managed to get both the activity and Bitmap to be destroyed: @Override protected void onStop() { super.onStop(); ImageView myImage = (ImageView) findViewById(R.id.myImage ); if(myImage .getDrawable() != null) myImage.getDrawable().setCallback(null); RoundedImageView roundImage = (RoundedImageView) findViewById(R.id.roundImage); // a custom View if(roundImage.getDrawable() != null) roundImage.getDrawable().setCallback(null); } I then generalized all my Activity and FragmentActivity so that they call unbindDrawables(View view) in onDestroy(): private void unbindDrawables(View view) { if (view.getBackground() != null) { view.getBackground().setCallback(null); } if (view instanceof ViewGroup &amp;&amp; !(view instanceof AdapterView)) { for (int i = 0; i &lt; ((ViewGroup) view).getChildCount(); i++) { unbindDrawables(((ViewGroup) view).getChild…
type: Answer
downvote count: 0
score: 11
accepted answer of: http://stackoverflow.com/q/23652549
upvote count: 11
answers question: http://stackoverflow.com/q/23652549

http://stackoverflow.com/q/23764791
has comment: http://stackoverflow.com/comment/36542807
type: Question
has title: Can't render html in Wicket
score: 0
answer count: 2
tagged with: javascript
has body: Let's consider I have a HTML markup: 1-8 10-30 30-40 40-50 50-60 from45 .dropdown-menu { padding: 0; margin: 0; left: -1px; top: 37px; font-size: 13px; -webkit-box-shadow: 0px 0px 25px 0px rgba(100, 100, 100, 0.5); -moz-box-shadow: 0px 0px 25px 0px rgba(100, 100, 100, 0.5); box-shadow: 0px 0px 25px 0px rgba(100, 100, 100, 0.5); border: 1px solid #d1d4d3; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; background-color: #f9f9f9; } .dropdown-menu li > a { color: #4d5357; padding: 8px 20px; } .spec_width { width: 72px; min-width: 72px; left: 50% !important; margin-left: -36px; max-height: 150px; min-height: 30px; float: left; overflow: hidden; display: block !important; visibility: hidden; } .spec_width li { line-height: 29px; width: 100%; text-align: center; padding: 4px 0; } .spec_width li:hover { background: #e1e1e1; } .spec_width li a { padding: 0px 0; background: none !important; width: 100%; text-align: center; } I use that markup in ModalWindow, and it works pretty good, but when I apply CSS class to tag I don't see it in the browser, but when I inspect element, it generates in HTML code. I think that it must be because I use it in ModalWindow, and something(script, style) is conflicted. Any ideas?
has answer: http://stackoverflow.com/a/23801151
tagged with: wicket
tagged with: http://stackoverflow.com/tag/html
tagged with: css
accepted answer: http://stackoverflow.com/a/23771297
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23771297
has comment: http://stackoverflow.com/comment/36541946
possible better answer: http://stackoverflow.com/a/23801151
tagged with: java
has comment: http://stackoverflow.com/comment/36541943
has comment: http://stackoverflow.com/comment/36559810

http://stackoverflow.com/a/23824517
has body: If several classes with same package/name are present in a classpath, the first one will be taken into account.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23615698

http://stackoverflow.com/a/23628953
has comment: http://stackoverflow.com/comment/36281673
score: 0
answers question: http://stackoverflow.com/q/23628736
type: Answer
has body: As per your code while(inputFile.hasNextLine()){ String line = inputFile.nextLine(); ArrayList&lt;String&gt; PPIData = new ArrayList&lt;String&gt;(); Scanner scanner = new Scanner(line); scanner.useDelimiter("\t"); while(scanner.hasNext()){ PPIData.add(scanner.next()); } scanner.close(); System.out.println(PPIData); } inputFile.close(); } The arraylist is locally scoped so you can't use it outside the while loop. In case you want to use it later some point to count the occurances of letter, then declare it above the while loop. Steps for solution: Iterate through the arrayList Get the first element which will contain [A, MANBA] as string Split the string based on comma, get the value A Now pass the value A to a function where you will check the occurrences of A in the ArrayList. Mostly this will give you concurrency exception as you will be processing same arraylist. Better solution: Use guava-libraries Multimap which will be easier for your scenario

http://stackoverflow.com/comment/36412841
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23697300
type: Comment
has text: This is incorrect. The OP wants *two* means: the mean for all keys smaller than the last inserted key and the mean for all keys larger than the last inserted key. There is no way to achieve this by keeping a single sum.

http://stackoverflow.com/comment/36513924
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23624228
score: 0
has text: [printedPDF(by PDFCreater,landscape,A3).pdf](https://dl.dropboxusercontent.com/u/33134610/testPrintPDF/printedPDF%28by%20PDFCreater%2Clandscape%2CA3%29.pdf) [printedPDF(by Bullzip PDF Printer,landscape,A3).pdf](https://dl.dropboxusercontent.com/u/33134610/testPrintPDF/printedPDF%28by%20Bullzip%20PDF%20Printer%2Clandscape%2CA3%29.pdf)

http://stackoverflow.com/q/23656857
has title: Not recognised the import of media type
upvote count: 5
tagged with: java
answer count: 2
score: 5
tagged with: restful-architecture
has comment: http://stackoverflow.com/comment/36335842
has answer: http://stackoverflow.com/a/23658670
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36335741
has answer: http://stackoverflow.com/a/35759771
type: UnansweredQuestion
has body: I m trying to make a RESTful web services, i have added the following jar files but when I add the import javax.ws.rs.core.MediaType; It is underlined with red line and it says that the "import javax.ws.rs.core.MediaType;" collides with another statement. I have tried to organize my imports with ctrl+shift+O and it automatically removes the above import. The result is that the MediaType.TEXT_PLAIN is not recognized.
type: Question

http://stackoverflow.com/a/48789061
score: 0
has body: replace code line: HtmlPage newPage = submit.click(); with: TextPage newPage = submit.click();
type: Answer
answers question: http://stackoverflow.com/q/23774241

http://stackoverflow.com/q/23677459
has comment: http://stackoverflow.com/comment/45049662
tagged with: dependencies
favorite count: 0
has comment: http://stackoverflow.com/comment/56354015
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56309916
has title: Excluding .class files from Gradle dependency
linked to: http://stackoverflow.com/q/7870265
has body: I'm trying to import https://github.com/Kickflip/kickflip-android-sdk using gradle into my android build and I'm getting : UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/codec/binary/Base64; Commons.codec is a dependency of my project, but not directly of the kick-flip project, I think its coming from one of the jars included there. I can see the .class files if I open Kickflip's classes.jar. How can I exclude Base64.class from being imported from kickflip into the final build? I've looked at using ziptree to exclude things but haven't been able to get anything to work. Thanks My build.gradle is: apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 10 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' exclude 'META-INF/ASL2.0' } android.applicationVariants.all{ variant -&gt; // This is an annoying hack to get around the fact that the Gradle plugin does not support // having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread) // but Android Maps Utils supports 8 (Froyo) still variant.processManifest.doFirst { File manifestFile = file("${buildDir}/exploded-aar/io.kickflip/sdk/0.9.9/AndroidManifest.xml") if (manifestFile.exists()) { println("Replacing minSdkVersion in Android Maps Utils") String content = manifestFile.getText('UTF-8') content = content.replace…
has comment: http://stackoverflow.com/comment/46900824
tagged with: java
has comment: http://stackoverflow.com/comment/46904060
tagged with: gradle
has comment: http://stackoverflow.com/comment/47052044
type: Question
score: 20
upvote count: 20
downvote count: 0
tagged with: jar
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/30346668

http://stackoverflow.com/comment/36392900
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23680826
has text: That was only half my issue.
score: 0

http://stackoverflow.com/comment/36369039
type: Comment
comment on: http://stackoverflow.com/a/23672030
has text: The above code is able to getting Privatekey but when doing decryption using Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, pk); descryptedData = cipher.doFinal(data); Getting an exception of java.security.InvalidKeyException: unknown key type passed to RSA at com.android.org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.engineInit(CipherSpi.java:277)
score: 0
type: AnswerComment

http://stackoverflow.com/q/23678518
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36378913
tagged with: android
has comment: http://stackoverflow.com/comment/36380331
has title: HttpPost takes more than 3 sec.to get a result
has comment: http://stackoverflow.com/comment/36379877
answer count: 0
has comment: http://stackoverflow.com/comment/36378778
has comment: http://stackoverflow.com/comment/36379656
has comment: http://stackoverflow.com/comment/36379179
upvote count: 1
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/36378037
has comment: http://stackoverflow.com/comment/36379879
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36385027
has comment: http://stackoverflow.com/comment/36378205
has body: Im facing a very bad/ugly Problem. My Android App needs to send/receive JSON Strings and the Problem is it takes between 3 to 9 Seconds to receive the answer. The Server responses very quick if i use the Postman Chrome Extension. Here is the Code: public class JSONHandler{ private HttpClient client; private HttpPost post; public JSONHandler(){ HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); client = new DefaultHttpClient(params); post = new HttpPost("http://secretserver.net/index.php"); post.setHeader("Content-type", "application/json"); } private JSONObject sendJSON(JSONObject obj){ StringEntity se = null; try { se = new StringEntity(obj.toString()); Log.d("JSON Angekommen",se.toString()); } catch (UnsupportedEncodingException e) { Log.e("Encoding", "Exception while encoding"); } se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(se); try { HttpResponse response = client.execute(post); //TODO: Timeout Handling String json_string = EntityUtils.toString(response.getEntity()); return new JSONObject(json_string); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return null; } } And in this Code i am executing the Method in an Async Task: public class Updater extends AsyncTask&lt;Activity,String,String&gt;{ private boolean connected; private Activity main; @Override protected void onPreExecute() { ConnectionHandler conn = new ConnectionHandler(context); connected = conn.isConnected(); } @Override protected String doInBackground(Activity... acs) { main = acs[0]; String json_String; if(connected){ JSONHandler json = new JSONHandler(); json_String = json.sendRegister("Peter", "peter@gmx.de", "Feld 2", "Happy", "Developer").toString(); return json_String; }else{ return "Not Working!"; } } @Override protected void onPostExecute(String result){ Notificator.doNotifyNoClicka…
tagged with: apache
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36386774
has comment: http://stackoverflow.com/comment/36379036

http://stackoverflow.com/comment/36469363
type: AnswerComment
comment on: http://stackoverflow.com/a/23726427
type: Comment
has text: @masonc15: it should be obvious why you're getting null. See latest edit, and then fix your code.
score: 0

http://stackoverflow.com/comment/36394789
score: 0
type: AnswerComment
type: Comment
has text: Ok, I see what you're saying now, and you're right. But I guess my point is that the point of *overriding* the base clone() method (which is what the question is about) is to ensure by design that a deep copy is performed. If you simply implement the Cloneable interface, and no more, then a shallow copy is what you get, as that interface does not require that you override the clone() method.
comment on: http://stackoverflow.com/a/23645253

http://stackoverflow.com/comment/36479785
type: Comment
score: 1
has text: @ZouZou - still you gave a 6 line explaination :)
comment on: http://stackoverflow.com/q/23731866
type: QuestionComment

http://stackoverflow.com/comment/36502360
comment on: http://stackoverflow.com/a/23743844
has text: Edited my answer to be correct as well. Please note that the `"GET".equals(this.httpMethod)` style will not throw a `NullPointerException` if `httpMethod` is `null`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23760998
has answer: http://stackoverflow.com/a/23761102
tagged with: java
possible better answer: http://stackoverflow.com/a/23761102
answer count: 5
has comment: http://stackoverflow.com/comment/36534490
accepted answer: http://stackoverflow.com/a/23761083
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23761103
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36534508
type: Question
upvote count: 2
tagged with: exception
tagged with: android
has body: I'm a beginner in Android development. I am making a basic square equations solver. I use the code below to get strings from EditText elements: a = mA.getText().toString(); b = mB.getText().toString(); c = mC.getText().toString(); Then I use Double.valueOf() method to convert them into doubles and solve the equatation(s is a Solver instance): mSolution.setText(s.solve(Double.valueOf(a), Double.valueOf(b), Double.valueOf(c))); If EditText is empty, an attempt to solve it gives me an exception java.lang.NumberFormatException: Invalid double: "" I guess, the .toString() method returns null or "", but the if statement doesn't work here :c.
has answer: http://stackoverflow.com/a/23761108
has title: Exception on using Double.valueOf() method
tagged with: android-edittext
has answer: http://stackoverflow.com/a/23761083
has answer: http://stackoverflow.com/a/23761181

http://stackoverflow.com/comment/36522859
type: Comment
has text: I can't use img = ImageIO.read(getClass().getResourceAsStream("0qzCf.jpg")); to read the image resource and it will throw an exception which is "Exception in thread "main" java.lang.IllegalArgumentException: input == null!".I use img = ImageIO.read(getClass().getResourceAsStream("0qzCf.jpg")); and it works.
comment on: http://stackoverflow.com/a/23710023
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36570709
type: Comment
comment on: http://stackoverflow.com/a/23778976
score: 0
has text: Yes maximum thing are same,added query as well
type: AnswerComment

http://stackoverflow.com/comment/36272235
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23618613
has text: Yes thanks i've tested it and it works. c:import have a context parameter, what is this ?
type: Comment

http://stackoverflow.com/comment/36421604
type: Comment
has text: You could also just take an `IntStream.range(a, b)` and then use a `filter(n -> n % 2 == 0)` to filter out the uneven numbers, thus generating a `+2` variant.
comment on: http://stackoverflow.com/a/23696487
type: AnswerComment
score: 0

date
tags question: http://stackoverflow.com/q/23762324
tags question: http://stackoverflow.com/q/23658365
tag name: date
tags question: http://stackoverflow.com/q/23701253
tags question: http://stackoverflow.com/q/23673122
tags question: http://stackoverflow.com/q/23684709
tags question: http://stackoverflow.com/q/23740634
tags question: http://stackoverflow.com/q/23673317
tags question: http://stackoverflow.com/q/23628302
tags question: http://stackoverflow.com/q/23633522
tags question: http://stackoverflow.com/q/23697675
tags question: http://stackoverflow.com/q/23672326
tags question: http://stackoverflow.com/q/23674380
tags question: http://stackoverflow.com/q/23688854
type: Tag
tags question: http://stackoverflow.com/q/23643243
tags question: http://stackoverflow.com/q/23646803
tags question: http://stackoverflow.com/q/23735181
tags question: http://stackoverflow.com/q/23617427
tags question: http://stackoverflow.com/q/23686370
tags question: http://stackoverflow.com/q/23712780
tags question: http://stackoverflow.com/q/23768536
tags question: http://stackoverflow.com/q/23702041

http://stackoverflow.com/q/23730620
type: Question
has title: Two c3p0 pools from same database schema when using JPA/Hibernate
tagged with: jpa
answer count: 1
tagged with: c3p0
accepted answer: http://stackoverflow.com/a/23887125
linked to: http://stackoverflow.com/q/12922351
score: 0
has answer: http://stackoverflow.com/a/23887125
type: AnsweredQuestion
tagged with: spring-ws
tagged with: java
tagged with: hibernate
has body: My question is somewhat related to this; Can I use multiple C3P0 datasources for DB instance? I have two Spring web services which accesses the same mySQL database schema. And I am using c3p0 to pool database connections. I am accessing the database using JPA/Hibernate I have configured two data base pools, entitity manager factories and transaction managers similar to the above question. In the first service In the second service Also I have annotated the two data access classes with relevant transaction manager @Transactional("transactionManager1") public class JPADataAccessObject1<T, ID extends Serializable> implements DataAccessObject<T, ID> @Transactional("transactionManager2") public class JPADataAccessObject2<T, ID extends Serializable> implements DataAccessObject<T, ID> One of my services has a spring message channel which uses a jpa-inbound-channel-adapter <int:channel id="testChannel"> <int:priority-queue capacity="20" /> </int:channel> <int-jpa:inbound-channel-adapter channel="testChannel" entity-class="com.test.TestObject" entity-manager-factory="entityManagerFactory1" auto-startup="true" jpa-query="SELECT x FROM TestObject AS x WHERE x.testColumns LIKE '1'" delete-after-poll="true"> <int:poller fixed-rate="5000"> <int:transactional propagation="REQUIRED" transaction-manager="transactionManager1" /> </int:poller> </int-jpa:inbound-channel-adapter> Now the problem is when I deploy both services in tomcat 7 they become not responding. Any idea on this?

http://stackoverflow.com/comment/36555228
has text: You can actually change it by moving the init of a into the sub constructor, then having the sub constructor call `super()` *after* the array has been inited.
score: 0
comment on: http://stackoverflow.com/q/23771186
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23752202
accepted answer: http://stackoverflow.com/a/23752307
tagged with: selenium-webdriver
score: 2
type: AnsweredQuestion
has title: .isDisplayed condition in while loop gives "Element Not Found Exception"
tagged with: java
has answer: http://stackoverflow.com/a/23753004
type: Question
answer count: 2
has body: I am trying to get all columns on this particular page and using below, there is something that I am not doing right, because it is giving element not found exception. According to me it should not go inside while loop as condition doesn't hold true, then whats the mistake here. public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); String xpathstart = "html/body/div[2]/div/ul/li["; String xpathends="]/a"; driver.get("http://www.timeanddate.com/worldclock/"); int i=1; while(driver.findElement(By.xpath(xpathstart+i+xpathends)).isDisplayed()){ System.out.println("current column value is"+i); i++; } System.out.println("total colored columns are "+i); } I didn't ask alternative of while loop (to use for loop, that i already know) What it is working in selenium RC while(selenium.isElementPresent(xpathstarts+i+xpathends)) { }
possible better answer: http://stackoverflow.com/a/23753004
downvote count: 0
has answer: http://stackoverflow.com/a/23752307
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/23775710
answers question: http://stackoverflow.com/q/23774353
accepted answer of: http://stackoverflow.com/q/23774353
has comment: http://stackoverflow.com/comment/36565187
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Two more options :) These would help mark the test as skipped instead of failed or passed catch the exception you are expecting and throw a SkipException from your @Test methods Or Implement IInvokedMethodListener and in the afterInvocation method do something like public void afterInvocation(IInvokedMethod method, ITestResult testResult) { if(testResult.getThrowable().getClass().equals(YourExceptionClass.class)) testResult.setStatus(TestResult.SKIP); }
score: 1
upvote count: 1

web-services
tags question: http://stackoverflow.com/q/23669595
type: Tag
tags question: http://stackoverflow.com/q/23773609
tags question: http://stackoverflow.com/q/23664186
tags question: http://stackoverflow.com/q/23667626
tags question: http://stackoverflow.com/q/23753025
tags question: http://stackoverflow.com/q/23675105
tags question: http://stackoverflow.com/q/23768757
tags question: http://stackoverflow.com/q/23759810
tags question: http://stackoverflow.com/q/23751481
tags question: http://stackoverflow.com/q/23758634
tags question: http://stackoverflow.com/q/23691593
tags question: http://stackoverflow.com/q/23678432
tags question: http://stackoverflow.com/q/23701253
tags question: http://stackoverflow.com/q/23758823
tags question: http://stackoverflow.com/q/23756125
tags question: http://stackoverflow.com/q/23622687
tags question: http://stackoverflow.com/q/23726845
tags question: http://stackoverflow.com/q/23652823
tags question: http://stackoverflow.com/q/23734985
tags question: http://stackoverflow.com/q/23642171
tags question: http://stackoverflow.com/q/23689765
tags question: http://stackoverflow.com/q/23649305
tags question: http://stackoverflow.com/q/23682334
tags question: http://stackoverflow.com/q/23737656
tags question: http://stackoverflow.com/q/23691662
tags question: http://stackoverflow.com/q/23745766
tags question: http://stackoverflow.com/q/23672354
tags question: http://stackoverflow.com/q/23646368
tags question: http://stackoverflow.com/q/23747751
tags question: http://stackoverflow.com/q/23654067
tags question: http://stackoverflow.com/q/23730325
tags question: http://stackoverflow.com/q/23627244
tag name: web-services
tags question: http://stackoverflow.com/q/23737498
tags question: http://stackoverflow.com/q/23766789
tags question: http://stackoverflow.com/q/23630881
tags question: http://stackoverflow.com/q/23751066
tags question: http://stackoverflow.com/q/23679868
tags question: http://stackoverflow.com/q/23673810
tags question: http://stackoverflow.com/q/23769407
tags question: http://stackoverflow.com/q/23764537
tags question: http://stackoverflow.com/q/23675907
tags question: http://stackoverflow.com/q/23699594
tags question: http://stackoverflow.com/q/23640793
tags question: http://stackoverflow.com/q/23637034
tags question: http://stackoverflow.com/q/23775945
tags question: http://stackoverflow.com/q/23737261
tags question: http://stackoverflow.com/q/23667954

http://stackoverflow.com/comment/37409208
type: QuestionComment
comment on: http://stackoverflow.com/q/23682090
has text: @LuiggiMendoza: If you can edit out arbitrary constraints (such as "you must be using Eclipse in order for this to compile because it has a shortcut that I've used") whilst otherwise maintaining the integrity of the testcase, then you should absolutely go right ahead. Anyway, it looks like you probably agree with me on that and think that Jeroen was trying to add in `syso`, whereas in fact it's the opposite: the OP had written `syso` and Jeroen was correcting it to valid Java, because this clearly wasn't the question at hand.
score: 0
type: Comment

http://stackoverflow.com/comment/36308142
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23640811
has text: @selena I added a split pane.
type: AnswerComment

http://stackoverflow.com/comment/36567826
score: 0
type: AnswerComment
has text: @mastercork889 it is `"Cost:".length()` that is 5
type: Comment
comment on: http://stackoverflow.com/a/23776626

http://stackoverflow.com/comment/36381310
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23679970
type: QuestionComment
has text: Check the result of delete. If it is `false`, maybe there's an outside problem.

plugins
tags question: http://stackoverflow.com/q/23693165
tags question: http://stackoverflow.com/q/23752684
tags question: http://stackoverflow.com/q/23697714
tags question: http://stackoverflow.com/q/23653961
tags question: http://stackoverflow.com/q/23632119
tag name: plugins
tags question: http://stackoverflow.com/q/23745918
tags question: http://stackoverflow.com/q/23769444
tags question: http://stackoverflow.com/q/23733268
tags question: http://stackoverflow.com/q/23676282
type: Tag
tags question: http://stackoverflow.com/q/23737488
tags question: http://stackoverflow.com/q/23703656

http://stackoverflow.com/comment/36447527
comment on: http://stackoverflow.com/a/23710368
has text: Could you add the entire stacktrace to your question please
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36471809
type: AnswerComment
has text: Im very new to java so i dont know how to get resultPane the method
comment on: http://stackoverflow.com/a/23727693
type: Comment
score: 0

http://stackoverflow.com/comment/36536651
type: QuestionComment
has text: @Mad Physicist absolutely no problem with this .That was made through the copy from my IDE. Thank you by the way, but i have the exceptionChecks so i am sure that the problem is around CallStaticObjectMethod
score: 0
comment on: http://stackoverflow.com/q/23757428
type: Comment

http://stackoverflow.com/comment/36266873
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23619447

http://stackoverflow.com/q/23714221
has comment: http://stackoverflow.com/comment/36445265
has answer: http://stackoverflow.com/a/32431203
answer count: 2
downvote count: 0
tagged with: connection
favorite count: 0
linked to: http://stackoverflow.com/q/10009804
has answer: http://stackoverflow.com/a/23714355
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
has body: I am writing an app which sends some data to the server by POST method and receives a response. To do this, I firstly need to check if network is available. I am using this method: private boolean isNetworkAvailable() { ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connManager.getActiveNetworkInfo(); return activeNetworkInfo != null &amp;&amp; activeNetworkInfo.isConnected(); } However, this function is not very accurate. For example, sometimes my device network indicator in status bar shows that it is currently connected to an EDGE network or a 3G network, but when I try to access the network, it starts changing immediately to another network type and changing back and there is no actual valid connection, but this function still returns true. How to make sure that the network connection is valid and data can be sent through it?
upvote count: 1
type: Question
has title: How to check if network is available
tagged with: network-programming

http://stackoverflow.com/comment/36514273
type: QuestionComment
comment on: http://stackoverflow.com/q/23750221
type: Comment
has text: I'm guessing this is android. What invokes this code? Are you running this in a separate thread? If so the thread may not have the ability to update the UI unless you set it up with the ability.
score: 1

java-io
tags question: http://stackoverflow.com/q/23769486
tags question: http://stackoverflow.com/q/23747982
tags question: http://stackoverflow.com/q/23645746
type: Tag
tags question: http://stackoverflow.com/q/23720050
tag name: java-io
tags question: http://stackoverflow.com/q/23676834

http://stackoverflow.com/comment/36388396
score: 0
has text: Sir, thank you very much! I've edited my question once again, but someone got what I was searching for! Again, thank you so very much for your concern!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23655225

http://stackoverflow.com/comment/36473397
score: 0
type: Comment
type: QuestionComment
has text: How are you accessing to the xhtml file, I mean, which URL are you using?
comment on: http://stackoverflow.com/q/23728388

http://stackoverflow.com/a/23651100
has comment: http://stackoverflow.com/comment/36326883
has body: I know it is a bit egotistical to answer your own questions, but after much research I have finally found my answer. Here is a working method that will rotate a slick-util texture according to an 'r' given in degrees. public static void drawTexture(Texture texture, int x, int y, int r) { int width = texture.getTextureWidth(); int height = texture.getTextureHeight(); GL11.glTranslatef(x + width / 2, y + height / 2, 0); GL11.glRotatef(r, 0, 0, 1); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex3f(-width / 2, -height / 2, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex3f(width / 2, -height / 2, 0); GL11.glTexCoord2f(1, 1); GL11.glVertex3f(width / 2, height / 2, 0); GL11.glTexCoord2f(0, 1); GL11.glVertex3f(-width / 2, height / 2, 0); GL11.glEnd(); GL11.glLoadIdentity(); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23648197

http://stackoverflow.com/comment/36628879
has text: I was referring in cases where you can avoid joining multiple tables by using simple subselects and id IN (SELECT...) expressions.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23771442

http://stackoverflow.com/comment/36492299
type: QuestionComment
comment on: http://stackoverflow.com/q/23727362
score: 0
type: Comment
has text: Just a side note, unrelated to this error: you're probably going to want to use a buffer for the captured images and a separate thread to write them. Unless you are on a really fast computer, capturing, converting and encoding will take really long. And as your current code will not capture any new images during that time, the frame rate will vary and often drop, which video players do not like.

http://stackoverflow.com/q/23646643
tagged with: selenium
has comment: http://stackoverflow.com/comment/36349437
type: Question
has answer: http://stackoverflow.com/a/23647352
score: 0
has title: XPath Syntax for conditions
answer count: 2
linked to: http://stackoverflow.com/q/3354987
has body: I am in search of conditional XPath syntax. My xpath is as follows: //div[@id='contenttext']/form/table/tbody/tr[7]/td[2]/input[1] Now the scenario is that the above mentioned input field can be found at tr[7] (already mentioned) and tr[6]. So in brief I need one syntax to test that the input field should be present either at tr[7] or tr[6]. i.e.: //div[@id='contenttext']/form/table/tbody/tr[7]/td[2]/input[1] //div[@id='contenttext']/form/table/tbody/tr[6]/td[2]/input[1] Both the above mentioned XPath should be combined and the test should return true if the input[1] is present at either tr[7] or tr[6]. PS: tr[position()=7 or position()=6] is not working. The code tries to find the element at lower position mentioned. i.e tr[6]
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23647045
tagged with: xpath
tagged with: java

http://stackoverflow.com/a/56168021
type: Answer
score: 4
has body: Right click the scenario line in your feature file, there will be a Run 'Scenario: My scenario' option. At least in IntelliJ 2019
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23732814

http://stackoverflow.com/comment/36265403
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23620525
has text: Is there any reason why you would like to create such method? If you want to reduce `System.out.println` you remove `System` by static import of `System.out`.
score: 0

http://stackoverflow.com/comment/36344745
score: 3
comment on: http://stackoverflow.com/a/23658546
has text: That all depends on the JVM implementation and the Java language makes no requirement on how it works under the covers. The JVM specification (different than the JLS specification) would give more details, but even then the exact layout in the JVM could be anything really. A common and likely method would be to have a pointer from the String object to a char[] object which would have a 0 length property and no elements.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23770062
upvote count: 1
answers question: http://stackoverflow.com/q/23769240
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36553623
has body: There is no such thing as a 32 character AES key. AES keys are 256 bits or 32 bytes for AES-256. If you create random bytes - as you should - then not every byte will represent a printable character. So if you "decode" the bytes to a String instance (e.g. using new String(bytes) then you may lose data. If you require Strings, please take a look at my answer here. Note that you should not use ECB mode encryption, which is the default if you specify "AES" as algorithm for Cipher. Never use defaults either.

http://stackoverflow.com/q/23710221
has comment: http://stackoverflow.com/comment/36437910
has comment: http://stackoverflow.com/comment/36438496
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36438224
has comment: http://stackoverflow.com/comment/43541991
has title: Android exit app on close
downvote count: 0
has comment: http://stackoverflow.com/comment/36437782
has answer: http://stackoverflow.com/a/45012600
has comment: http://stackoverflow.com/comment/36438283
favorite count: 0
has comment: http://stackoverflow.com/comment/36438368
has comment: http://stackoverflow.com/comment/36437705
tagged with: android
has comment: http://stackoverflow.com/comment/36438154
tagged with: splash-screen
has comment: http://stackoverflow.com/comment/36437921
tagged with: back
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36437878
has answer: http://stackoverflow.com/a/23710485
has body: Hi in my android app I included a splash screen after this activity whenever I pressed the back button it is going to the previous pages of MainActivity. But I needed to exit from application if user press back button from MainActivity. But now currently mainactivity is not the start activity and splash screen is the activity. So i checked some methods and I saw intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this will clear the previous activities.. But in MainActivty why I need an intent.. I gave finish(); in every intent of each activity so the activity will be cleared. But that is affecting my app's entire structure .. whenever user press back button app is going to home page. So any one suggest a solution.. so that I can exit directly from MainActivity if user presses a back button. this is my backpress code for mainActivity @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); finish(); } and my splashscreen WebView wv; // Splash screen timer private static int SPLASH_TIME_OUT = 4000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_flash); wv = (WebView) findViewById (R.id.webView1); wv.setHorizontalScrollBarEnabled(false); wv.loadUrl("file:///android_asset/Finally-320.gif"); new Handler().postDelayed(new Runnable() { /* * Showing splash screen with a timer. This will be useful when you * want to show case your app logo / company */ @Override public void run() { // This method will be executed once the timer is over // Start app main activity Intent i = new Intent(SplashScreen.this, MainActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); // close this activity finish(); } }, SPLASH_TIME_OUT); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); f…
score: 1
tagged with: java

http://stackoverflow.com/comment/36275458
type: Comment
has text: It *is* a duplicate, please read the documentation, it should answer your question.
comment on: http://stackoverflow.com/q/23625947
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36346806
comment on: http://stackoverflow.com/q/23662195
has text: the error is 05-14 19:24:27.836: W/dalvikvm(3826): threadid=1: thread exiting with uncaught exception (group=0x40e402a0)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36454597
comment on: http://stackoverflow.com/a/23718086
score: 0
type: AnswerComment
has text: I agree but I asked the other way first because I didn't really want to loop and I figured people would just tell me to loop if I asked
type: Comment

http://stackoverflow.com/comment/36475386
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23729483
has text: When I do this, my `ListView` goes empty.
score: 0

http://stackoverflow.com/comment/36344071
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23660943
has text: @Ordous It's a different problem, having to do with the return value, not the parameters. The OP's code ignores the return value instead of returning it.

http://stackoverflow.com/a/23751402
score: 1
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23751172
has body: DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm a"); more patterns you can find here

http://stackoverflow.com/a/23669671
type: Answer
answers question: http://stackoverflow.com/q/23666732
has body: If you can't see values appearing inside MySQL Workbench but your unit tests are passing, it is because Spring automatically rolls back the transaction when the unit test has finished. So if you could instantly refresh MySQL Workbench at the precise moment the transaction was committed, then you would see your values for about 0.2 milliseconds before the transaction was rolled back and the values were lost. Your join table is working, otherwise your assertions would fail.
score: 1
has comment: http://stackoverflow.com/comment/36399387
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/36469359
has text: First of all thank you for the explanation and quick response. Is there any way that I can talk to you faster? Like chat or something? I have something related to ask if you don't mind.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23726402
type: Comment

http://stackoverflow.com/a/23730099
score: 2
has comment: http://stackoverflow.com/comment/36482474
has comment: http://stackoverflow.com/comment/36482420
has body: Edit: as per advice by Andrew Thompson - a picture. Here is an example of how to do it using BorderLyout for the search / submit row and table, and adding the title in a border title instead of a label: public class Search extends JFrame { private final static String TITLE = "Fetching Search Results"; private final static String[] COLUMN_HEADERS = {"Section name", "Report name", "Contact", "Link"}; private final static String[] SEARCH_OPTIONS = {"AAAAA", "BBBBB"}; Search() { JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), TITLE, TitledBorder.CENTER, TitledBorder.TOP, new Font("Arial", Font.PLAIN, 20), Color.RED)); JPanel topPanel = new JPanel(); JLabel searchLabel = new JLabel("Search:"); JComboBox&lt;String&gt; searchBox = new JComboBox&lt;&gt;(SEARCH_OPTIONS); JButton submitButton = new JButton("Submit"); topPanel.add(searchLabel); topPanel.add(searchBox); topPanel.add(submitButton); JTable table = new JTable(new String[34][4], COLUMN_HEADERS); mainPanel.add(topPanel, BorderLayout.PAGE_START); mainPanel.add(new JScrollPane(table)); setContentPane(mainPanel); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String args[]) { new Search(); } } If you want the title as a label, you can put another panel for it.
has comment: http://stackoverflow.com/comment/36484592
answers question: http://stackoverflow.com/q/23729224
upvote count: 3
has comment: http://stackoverflow.com/comment/36483121
has comment: http://stackoverflow.com/comment/36483878
type: Answer
has comment: http://stackoverflow.com/comment/36483033
downvote count: 1

http://stackoverflow.com/comment/36520444
type: Comment
has text: @deepwinter What was the root cause of the problem?
comment on: http://stackoverflow.com/a/23673680
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36466784
type: Comment
comment on: http://stackoverflow.com/a/23725042
has text: I can create a executable jar file with GUI... But if the jar have no GUI then what to do??
type: AnswerComment
score: 0

http://stackoverflow.com/a/23651815
type: Answer
has comment: http://stackoverflow.com/comment/36326482
has comment: http://stackoverflow.com/comment/36326900
score: 4
answers question: http://stackoverflow.com/q/23651751
upvote count: 4
has comment: http://stackoverflow.com/comment/36325818
has body: By not trying to cast a String to an Object[]. Look at the return value of the methods you're using, and use variables typed appropriately to store those return values. JComboBox#getSelectedItem returns an Object (in this case apparently a String), not an array (of any kind). But in this line: Object row[] = (Object[])combocourse.getSelectedItem(); ...you're trying to cast it to be an Object[] (array of Object) so you can store it in an Object[]. You can't do that. It seems like row should just be Object or String, not Object[], and that when you use it you should just use it directly, not as row[1]: Object row = combocourse.getSelectedItem(); System.out.println("id"+row ); Or String row = (String)combocourse.getSelectedItem(); System.out.println("id"+row ); In a comment you asked: I called coursename in combobox but i should save course id in my database. How can I get courseId? I don't know JComboBox. Fundamentally, you need to store something that contains both values (the ID and name) and then use that something when you get the selected item. Unless JComboBox has some functionality for this built in, you might need a simple class for that that holds the values and implements toString by returning courseName. Something vaguely like: class CourseItem { private String courseName; private String courseId; // Or int or whatever CourseItem(String courseName,String courseId) { this.courseName = courseName; this.courseId = courseId; } public String getCourseName() { return this.courseName; } public String getCourseId() { return this.courseId; } public String toString() { // For display return this.courseName; } } Then: public void coursename() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Query query = session.createQuery("select a.courseName,a.courseId from Semester e inner join e.course as a"); for (Iterator it = query.iterate(); it.hasNext();) { Object row[] = (Object[]) it.next(); combocourse.addItem(new Cour…
accepted answer of: http://stackoverflow.com/q/23651751
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36326098

http://stackoverflow.com/comment/36279937
has text: You want to remove this : (1) or (2) or whatever (num) is ?
comment on: http://stackoverflow.com/q/23628338
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23649668
possible better answer: http://stackoverflow.com/a/23649690
tagged with: android-assets
has answer: http://stackoverflow.com/a/23649690
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23649795
has comment: http://stackoverflow.com/comment/36322527
score: 0
has comment: http://stackoverflow.com/comment/36322595
tagged with: http://stackoverflow.com/tag/xml
has title: Java Android android content res Resources NotFoundException:
has body: I developed an application Java Android and i have a problem :) I want to load an XML file. AssetManager assetManager = getAssets(); InputStream questionsFile = assetManager.open("questions.xml"); document = builder.parse(questionsFile); NodeList nList = document.getElementsByTagName("question"); The XML is located in the Asset folder but i get an res Resources NotFoundException. Thx for the help ! This is my XML file : Stanley Kubrick Steven Spielberg Ridley Scott Roland emmerich Palo Alto Philadelphie Dallas Boston 1 5 7 9 In fact my XML is loading but this code : NodeList nList = document.getElementsByTagName("question"); Toast.makeText(getBaseContext(),nList.getLength(), Toast.LENGTH_LONG).show(); Only work in Java not android. Thank all for the answers /////////////////////////////////////////////////////// Its working, with this code : AssetManager assetManager = getAssets(); document = builder.parse(assetManager.open("XML/questions.xml")); NodeList nList = document.getElementsByTagName("question"); textViewQuestion = (TextView) findViewById(R.id.textViewQuestion); textViewQuestion.setText(nList.item(0).getAttributes().getNamedItem("text").getNodeValue());
accepted answer: http://stackoverflow.com/a/23649795
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36322098
tagged with: java

http://stackoverflow.com/a/23709490
has comment: http://stackoverflow.com/comment/36436411
has body: String link = String.format("www.mysite.com/%s/sometext/%s",field1.getText(),field2.getText());
answers question: http://stackoverflow.com/q/23709433
has comment: http://stackoverflow.com/comment/36436442
score: 0
type: Answer

http://stackoverflow.com/comment/36503965
comment on: http://stackoverflow.com/a/23742404
has text: Very helpful guidelines ! But I'm still puzzled about your easier solution to create a new TableModel and replace the TableModel in the existing table. Really puzzled as to where I should modify in my code. It would be really great if you could show me in my code. Thanks !
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23774996
score: 0
has comment: http://stackoverflow.com/comment/36561988
tagged with: junit
has answer: http://stackoverflow.com/a/23775132
has title: java pass subclass value to superclass
tagged with: subclass
type: UnansweredQuestion
has body: Working on Junit testing, running into a problem. I have a vehicle superclass, and motorcycle and car subclasses. I need to use the methods in the superclass to retrieve information in the subclass (string ID, int arrival) public class MotorCycle extends Vehicle { public String bikeID; public int arrivalTimeA; public MotorCycle(String vehID, int arrivalTime) throws VehicleException { super(bikeID, arrivalTimeA); bikeID = vehID; arrivalTimeA = arrivalTime; Which is the subclass that I am working with, and I want to use the methods from the superclass vehicle to retrieve the information from motorcycle public Vehicle(String vehID,int arrivalTime) throws VehicleException { vehicleID = vehID; arrivalTimeA = arrivalTime; if (arrivalTime &lt;=0){ throw new VehicleException("Vehicle"); } public String getVehID() { return vehicleID; } Tried using super(vehID, arrivalTime) in the subclass, but I have to make the variables static which is no good for this program. Whenever I add super(vehID, arrivalTime), I keep getting errors saying "Make variables static", if I don't it just doesn't run properly and fails. What I have for my test is: @Test public void testGetVehID() throws VehicleException { moto = new MotorCycle("b1234", 600); veh = moto; String id = veh.getVehID(); assertEquals("b1234", id);// TODO } veh is just an empty Vehicle class object. I'm having problems accessing the information. Everytime i run this test or something similar, the value is either 0 for int, or null for Strings
tagged with: superclass
has comment: http://stackoverflow.com/comment/36561524
linked to: http://stackoverflow.com/q/14076730
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36561565
has answer: http://stackoverflow.com/a/23775807
tagged with: inheritance
has comment: http://stackoverflow.com/comment/36561760

http://stackoverflow.com/comment/36431397
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23706779
has text: There's no guesswork here, though; MadProgrammer's answer nails the two super obvious issues here.

http://stackoverflow.com/comment/36527045
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23756553
has text: @geoand I just want to avoid Defining interface for each entity in my application e.g. interface UserRepo extends JpaRepository<User,Integer> and interface PlaceRepo extends JpaRepository<Place,Integer> instead of this I want make one common repository for all my entities.How can I achiev that??

http://stackoverflow.com/comment/36316678
type: Comment
score: 0
type: AnswerComment
has text: So simply try to debug that code and see what is wrong :-) upvote is appriciated because of lot of work that i put into.
comment on: http://stackoverflow.com/a/23628801

http://stackoverflow.com/q/23691732
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23691984
accepted answer: http://stackoverflow.com/a/23691984
has comment: http://stackoverflow.com/comment/36403707
has answer: http://stackoverflow.com/a/23691816
tagged with: java
has comment: http://stackoverflow.com/comment/36403702
has body: Here is what I am asked to do: 1. Create a class called Square that takes a width parameter in the constructor. The Square class should have a draw() method that will draw the square on the screen. Create a class called TestSquare that will take width from the user, create an object of Square, and invoke the draw() method on the square object. Here is what I have, but the problem I am having is passing the draw() method to the test method. I know see that I need to move the for loops from the test to the class, so that i can call it in the test main method. public class Square { /** the width of square*/ int width; /** construct the square*/ Square(){ } /**construct a square */ Square(int newWidth){ width = newWidth; } /**show the square*/ void draw(){ for (int i=0; i&lt;width; i++) { for (int j=0; j&lt;width; j++) { System.out.print("* ");} System.out.println(); } } } import java.util.Scanner; public class TestSquare { /** Main method */ public static void main(String[] args) { // Create a scanner input Scanner input = new Scanner(System.in); // prompt user to enter width System.out.println("Creating a Square ..."); System.out.print("Please enter its width:"); int width = input.nextInt(); Square square = new Square(width); System.out.println("Here is the Square:"); square.draw(); } }
type: Question
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/36420515
upvote count: 0
has comment: http://stackoverflow.com/comment/36403777
has comment: http://stackoverflow.com/comment/36420420
has comment: http://stackoverflow.com/comment/36403640
possible better answer: http://stackoverflow.com/a/23691816
favorite count: 0
has comment: http://stackoverflow.com/comment/36421403
has comment: http://stackoverflow.com/comment/36403717
has comment: http://stackoverflow.com/comment/36421100
has comment: http://stackoverflow.com/comment/36403956
score: -4
has title: Java Square Class
has comment: http://stackoverflow.com/comment/36403820
has comment: http://stackoverflow.com/comment/36403763

http://stackoverflow.com/a/23691058
has comment: http://stackoverflow.com/comment/36402744
answers question: http://stackoverflow.com/q/23690990
has body: The jar-with-dependencies assembly mechanism uses the maven dependencies you've declared, and not from what's in your resources directory. If you want to use a newer version of a jar, declare a newer version as the dependency in your .pom file.
score: 0
has comment: http://stackoverflow.com/comment/36403043
type: Answer

http://stackoverflow.com/comment/36268687
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23622074
type: AnswerComment
has text: I will. I am very new to this and am taking intro classes at the moment. But I really enjoy the topic. I really appreciate your help! Thank you!

http://stackoverflow.com/comment/36461879
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23720357
has text: Can you show the code where you load the fxml?
score: 0

http://stackoverflow.com/comment/36555390
comment on: http://stackoverflow.com/q/23771458
has text: Why does the border have to be any kind of class at all?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24312363
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23633034
score: 2
accepted answer of: http://stackoverflow.com/q/23633034
has body: This was indeed a bug. Thanks for reporting it. This has been fixed in trunk and will be included in the next release (rc2).
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23650006
has body: Author of the chosen anwser seems to have problems using past tense and speak to present nearly all time, but at one point he exactly say I removed this code setting buffer size and then it strated receving all the packets So in fact it was changing datagram buffer size wich seems to have caused it's problem. By the way, your method to set buffersize probably work, in fact log message respond to you with your platform buffer size, wich you can't change, see Android DatagramSocket receive buffer size.
type: Answer
answers question: http://stackoverflow.com/q/23649120
has comment: http://stackoverflow.com/comment/36326449
has comment: http://stackoverflow.com/comment/36334012
score: 0

http://stackoverflow.com/q/23718489
has answer: http://stackoverflow.com/a/23728415
has title: Eclipse JSF Server issue 'the file "" could not be found'
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36456046
has comment: http://stackoverflow.com/comment/36461270
tagged with: tomcat7
type: Question
tagged with: java
tagged with: jsf-2.2
tagged with: eclipse
has body: I am encountering a problem in which upon selecting an xhtml file from my project and selecting run on server (apache tomcat) I get the following error 'The file "http://localhost:8080/projectname/faces/index.xhtml" could not be found. I tried following an example, to make sure I was doing things correctly (setup, creating files correctly), example site: http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jst.jsf.doc.user%2Fhtml%2Fgettingstarted%2Ftutorial%2FJSFTools_tutorial_JSF20.html However it returns similar error only with instead of index as above it is login. Hope this is enough information, I can supply more info such configuration details as well as images if they are needed. I hope someone has had this exact same problem! Thanks!
score: 0

http://stackoverflow.com/comment/36477754
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23730855
has text: why is fis.close() commented out?
score: 0

http://stackoverflow.com/a/23685502
has comment: http://stackoverflow.com/comment/36409705
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23681949
has body: Since Java web start applications are basically regular Java applications and are not appearing in the DOM, you can't access them using WebDriver. The best tool I know for testing AWT/Swing application is Jemmy. I usually use it for testing standalone Swing applications, but I am sure you can use it also for applications that are launched using the web start mechanism.
type: Answer
score: 1

http://stackoverflow.com/comment/36344262
type: QuestionComment
has text: i think you should use a normal for- loop for it...
comment on: http://stackoverflow.com/q/23661085
score: 0
type: Comment

http://stackoverflow.com/a/23769538
has comment: http://stackoverflow.com/comment/36552438
answers question: http://stackoverflow.com/q/23769460
has comment: http://stackoverflow.com/comment/36552042
has body: You could use a Stack of users. When there is more than one user in the stack (length > 1) you could .pop() the users off the stack. This would work well because when you .push() a user onto the stack he/she would be last to be popped off (creating the order of pairs you want). Logic: User clicks button User gets put in stack Check if stack.length > 1 If true, pop() twice and pair users, if false go to 1
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23769460
has comment: http://stackoverflow.com/comment/36551891
score: 1

http://stackoverflow.com/q/23760759
answer count: 3
has answer: http://stackoverflow.com/a/23761058
accepted answer: http://stackoverflow.com/a/23761058
has comment: http://stackoverflow.com/comment/36534413
possible better answer: http://stackoverflow.com/a/23760821
tagged with: interface
score: 6
has comment: http://stackoverflow.com/comment/36534056
has comment: http://stackoverflow.com/comment/36534148
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36534327
tagged with: java
type: Question
has title: Java Docs says interfaces cannot have fields.Why?
has answer: http://stackoverflow.com/a/23760851
has answer: http://stackoverflow.com/a/23760821
has comment: http://stackoverflow.com/comment/36534167
upvote count: 6
downvote count: 0
favorite count: 0
has body: I was reading this and it clearly states that One significant difference between classes and interfaces is that classes can have fields whereas interfaces cannot.How could this be possible because Java Docs also says all fields in interface are public,static and final.
has comment: http://stackoverflow.com/comment/36534170
has comment: http://stackoverflow.com/comment/36534008

http://stackoverflow.com/comment/53819695
comment on: http://stackoverflow.com/a/28356586
score: 0
type: AnswerComment
type: Comment
has text: From the link:`for more fine-grained control of the Developer Console's log level display, the logging framework must use a java.util.logging adapter.`

http://stackoverflow.com/comment/36530395
type: Comment
has text: I don't think this will work as expected. Looking at it, I think you'll end up with a deck of 52 cards, each with the largest values for `suit` and `value`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23758764

http://stackoverflow.com/q/23639064
type: AnsweredQuestion
has body: Need help with parsing line where keywords included in brackets []. I tried but have wrong result: public class App { public static void main(String[] args) { Matcher mtr = Pattern.compile("(\\w+-\\w+|\\w+)+").matcher("[foo-bar] [baz][qux]"); if (mtr.find()) for (int i = 0; i &lt; mtr.groupCount(); i++) { System.out.println(mtr.group(i)); } } } Result(wrong): foo-bar Me need: foo-bar baz qux What should be regex that parse string as on last example ?
tagged with: java
accepted answer: http://stackoverflow.com/a/23639129
has answer: http://stackoverflow.com/a/23639171
type: Question
possible better answer: http://stackoverflow.com/a/23639135
has answer: http://stackoverflow.com/a/23639135
has answer: http://stackoverflow.com/a/23639189
score: 0
has comment: http://stackoverflow.com/comment/36301107
tagged with: regex
tagged with: parsing
has answer: http://stackoverflow.com/a/23639148
has title: Java & Regular expression
answer count: 5
has answer: http://stackoverflow.com/a/23639129

http://stackoverflow.com/comment/36277733
has text: Have you tried non-zero timeout just in case?
score: 0
comment on: http://stackoverflow.com/q/23627154
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36483236
has text: Cool, thanks. I would like to upvote you now, after your edit; but I can't because I upvoted you before your edit.
score: 1
comment on: http://stackoverflow.com/a/23733737
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23626225
favorite count: 0
has comment: http://stackoverflow.com/comment/36276299
upvote count: 1
type: AnsweredQuestion
has title: Converting with Xuggler
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/16291843
tagged with: xuggler
has answer: http://stackoverflow.com/a/23698248
accepted answer: http://stackoverflow.com/a/23698248
has body: I'm trying to convert a video using Java and Xuggler. But when im trying to run this code I get the following error message. Do I need to specify the format manually or is it mp4 per default? converting Exception in thread "main" java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian is supported. at javax.sound.sampled.AudioSystem.getLine(Unknown Source) at com.xuggle.mediatool.MediaViewer.getJavaSoundLine(MediaViewer.java:730) at com.xuggle.mediatool.MediaViewer.getAudioQueue(MediaViewer.java:575) at com.xuggle.mediatool.MediaViewer.onAddStream(MediaViewer.java:440) at com.xuggle.mediatool.AMediaToolMixin.onAddStream(AMediaToolMixin.java:78) at com.xuggle.mediatool.MediaReader.getStreamCoder(MediaReader.java:375) at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:461) at at.jku.tk.mms.xuggler.VideoTranscoderApp.transcode(VideoTranscoderApp.java:44) at at.jku.tk.mms.xuggler.VideoTranscoderApp.main(VideoTranscoderApp.java:53) IMediaReader mediaReader = ToolFactory.makeReader(source.getAbsolutePath()); // create a media writer IMediaWriter mediaWriter = ToolFactory.makeWriter(target.getAbsolutePath(), mediaReader); // add a writer to the reader, to create the output file mediaReader.addListener(mediaWriter); // create a media viewer with stats enabled IMediaViewer mediaViewer = ToolFactory.makeViewer(true); System.out.println("converting"); // add a viewer to the reader, to see the decoded media mediaReader.addListener(mediaViewer); // read and decode packets from the source file and // and dispatch decoded audio and video to the writer while (mediaReader.readPacket() == null) ; } public static void main(String[] args) { File source = new File(args[0]); if (source.canRead()) { File target = new File(args[1]); VideoTranscoderApp transcoder = new VideoTranscoderApp(source, target); transcoder.transcode(); } }
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36276960
has comment: http://stackoverflow.com/comment/36276461

http://stackoverflow.com/comment/36507915
type: Comment
comment on: http://stackoverflow.com/a/23746991
score: 0
type: AnswerComment
has text: where about would I add this into my code? and are you sure it's correct because my audio files aren't stored in raw

http://stackoverflow.com/a/23665292
type: Answer
answers question: http://stackoverflow.com/q/23664644
has body: You might have a look at Event Sourcing for his kind of stuff in real life. It's a kind of problem which is quite a classical example of this architecture. I'm not going to explain the full model here, and I will even betray it, in order to be short: I would create BookingRequested events, with a unique ID (UUID maybe, or database-provided) and a timestamp, and store those in the database (or in a in-memory queue). Then a query processor would work on them. It could lock on the in-memory object, or you might even decide that only one thread would work on one room, extracting the unprocessed requests for this particular room. If you can't, and have distant systems working on the same data, the solution might be optimistic locking. when a decision is taken on the booking, it's a new event, which you will store in the database too. It will contain the reference of the original request, and the result. Microsoft has a free pdf book, "Exploring CQRS and Event Sourcing", with a very complete example with a similar context (a system for booking places at various conferences).
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/23616720
has answer: http://stackoverflow.com/a/23620872
type: Question
has body: I am trying to resize a TextField, when startBtnClick is clicked and I can't seem to get it to work. Basically I want to shrink the field by 110 units when the button is clicked. On Action Event: @FXML protected void startBtnClick(){ double txtWidth = this.url.getWidth(); this.url.setPrefWidth(txtWidth - 110); } The XML: <?xml version="1.0" encoding="UTF-8"?> <URL value="@../CSS/textField.css" />
has comment: http://stackoverflow.com/comment/36261978
has comment: http://stackoverflow.com/comment/36258802
has comment: http://stackoverflow.com/comment/36258011
accepted answer: http://stackoverflow.com/a/23620872
answer count: 1
has comment: http://stackoverflow.com/comment/36258135
has comment: http://stackoverflow.com/comment/36262789
has comment: http://stackoverflow.com/comment/36259078
has comment: http://stackoverflow.com/comment/36257936
linked to: http://stackoverflow.com/q/20304933
has comment: http://stackoverflow.com/comment/36261186
has title: Resize TextField On Button Click
has comment: http://stackoverflow.com/comment/36261049
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36259108
tagged with: java
tagged with: javafx
score: 0

http://stackoverflow.com/comment/36438201
type: Comment
score: 2
has text: `int r = ((Integer)request.getAttribute("gpa")).intValue();`
type: QuestionComment
comment on: http://stackoverflow.com/q/23710314

http://stackoverflow.com/q/23775620
type: AnsweredQuestion
tagged with: temp
duplicate of: http://stackoverflow.com/q/31255366
has comment: http://stackoverflow.com/comment/36562709
has comment: http://stackoverflow.com/comment/36562708
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/38380074
has comment: http://stackoverflow.com/comment/36562648
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23775718
linked to: http://stackoverflow.com/q/617414
score: 9
has comment: http://stackoverflow.com/comment/36562669
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/23775869
has body: I need to demo a xml based data interchange system. It is demoed offline on a trusted computer at school. The application will get database later but just for this presentation I only need to show the layout, opening and saving of xml-files and how the table gets data from the xml. So, what would be the best location to let the web app create the xml files temporarily so I can showcase this app? I'm using Eclipse and Tomcat. As mentioned, security is not an issue at all, since this version is NOT going to be online. Also, it's ok if the files get erased each time the application is run. They need to exist only for the duration of the presentation where the application is run once. So, I'm clueless what would be the best location and how to get the path to such location not depending on the computer used. Thank you.
has title: Best practice to save temp files on tomcat?
accepted answer: http://stackoverflow.com/a/23775718
has answer: http://stackoverflow.com/a/23775940
possible better answer: http://stackoverflow.com/a/23775869
linked to: http://stackoverflow.com/q/31255366
answer count: 4
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/23708332
answers question: http://stackoverflow.com/q/23708230
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23708230
has comment: http://stackoverflow.com/comment/36591335
score: 3
type: AcceptedAnswer
downvote count: 0
has body: IMO it's not a good practice. If you want to extract one to many relation from the DB you can use ResultSetExtractor. public class MasterDetailResultSetExtractor implements ResultSetExtractor { @Override public Object extractData(ResultSet rs) throws SQLException { Master m = new Master(); m.setFirstName(rs.getString(1)); m.setLastName(rs.getString(2)); //put the master in a map Detail d = new Detail(); d.setSomeProp(rs.getString(3)); //check if the master is in the map //if yes - add the detail to the master //if no - add the master first return m; } } The ResultSet is the result of JOIN of the tables.
has comment: http://stackoverflow.com/comment/36561699

http://stackoverflow.com/comment/36548524
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23767872
has text: I didn't tell you do cast to `AbstractListModel`. I said the set the model to a `DefaultListModel`. `AbstractListeModel` _has no_ data manipulation methods
score: 1

http://stackoverflow.com/comment/36261186
comment on: http://stackoverflow.com/q/23616720
type: Comment
has text: That's probably the issue. Can you show the code?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36380444
comment on: http://stackoverflow.com/a/23643767
has text: if you know this one, please answer http://stackoverflow.com/questions/23647908/retrieving-nth-qualifier-in-hbase-using-java
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23678325
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23676123
score: 2
has body: Spring Batch Job Repository is based on JDBC DAOs and support a close set of RDBM’s. For example in Spring Batch 2.2.5 its DB2, HSQL, SQLSERVER, MYSQL, ORACLE, POSTGRES,SYBASE, H2. See org.springframework.batch.support.DatabaseType class from spring-batch-infrastructure-x.x.x.jar As mentioned in Rafik Beldi answer Memory Based Job Repository is supported as well. Those can be a good solution if you do not care about past executions. In memory database like h2 support file based persistent that my help (although limited and unreliable from my point of view). If you have to support NoSQL you need to develop your own or look for some existing project in github. Basically starting by overriding JobRepositoryFactoryBean and adding your own DAOs (located under org.springframework.batch.core.repository package in spring-batch-core jar). For more information: The Spring Batch Docs Non-standard Database Types in a Repository Some mongodb project with Spring Batch Maybe my question here will add some information It will be nice if someone from Spring Batch team will give us some information if NoSQL support for job repository are planed to the near feature.
downvote count: 0

http://stackoverflow.com/a/23636916
answers question: http://stackoverflow.com/q/23636856
type: Answer
has comment: http://stackoverflow.com/comment/36296635
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23636856
score: 2
has body: You're missing an equals sign, it should be boolean passed = false; for(int p = 0; passed == false; p++){ //my code... } As it is right now, you're not checking the value of passed on every iteration but instead you're doing an assignment. Also, be sure to change the value of passed inside the loop to avoid infinite iterations.
has comment: http://stackoverflow.com/comment/36296761
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36366575
score: 0
type: QuestionComment
type: Comment
has text: Do you need to do UI stuff in the run() method?
comment on: http://stackoverflow.com/q/23672539

http://stackoverflow.com/a/43882127
has comment: http://stackoverflow.com/comment/74803836
answers question: http://stackoverflow.com/q/23625134
has body: You can try: _scheduledThreadPool.getQueue().clear();
score: 0
type: Answer

http://stackoverflow.com/comment/36510963
comment on: http://stackoverflow.com/q/23748384
type: Comment
has text: No, dealing with TZ is a pain in the A
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36462198
has text: @Snowbird if you have that many "files" to deal with, if I were you I'd use a document-oriented storage solutions; many exist, so I cannot really recommend one.
type: Comment
comment on: http://stackoverflow.com/a/23721905
score: 0
type: AnswerComment

http://stackoverflow.com/q/23642276
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/36333314
accepted answer: http://stackoverflow.com/a/23642404
type: Question
has comment: http://stackoverflow.com/comment/36336409
has title: Cannot get a already existing GUI to go into a JPanel in a resizable JFrame?
has comment: http://stackoverflow.com/comment/36308146
answer count: 1
has body: I have the following resizable form that consists of one main JPanel with 4 other JPanels that go inside. They will resize as the JFrame is resized. I decided to see if I could put another class that creates a GUI into the top frame that is depicted in the image below. I think that it might be that I am trying to put a JFrame into a JPanel that is already in JFrame. Question: I want to put another GUI class (that makes a JTable) into a JPanel in another class? Code: package testpak; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.net.MalformedURLException; import javax.swing.JFrame; import javax.swing.JPanel; public class ResizeTestGUI { private JPanel jpPack; private JPanel jpCards; private JPanel jpInfo; private JPanel jpChat; private SimpleTableDemo std = new SimpleTableDemo(); public ResizeTestGUI() throws MalformedURLException { final JFrame frame = new JFrame("Draft"); frame.setPreferredSize(new Dimension(400, 400)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel IsMainJPanel = new JPanel(); IsMainJPanel.setLayout(new GridBagLayout()); jpCards = new JPanel(new BorderLayout()); jpCards.setBackground(Color.BLUE); jpInfo = new JPanel(); jpInfo.setBackground(Color.GREEN); jpPack = new JPanel(new GridBagLayout()); jpPack.setBackground(Color.RED); jpChat = new JPanel(); jpChat.setBackground(Color.BLACK); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.FIRST_LINE_START; c.fill = GridBagConstraints.BOTH; // set it to fill both vertically and // horizontally c.gridx = 0; c.gridy = 0; c.weightx = 0.3; c.weighty = 0.3; jpCards.add(std); IsMainJPanel.add(jpCards, c); c.gridx = 1; c.gridy = 0; c.weightx = 0.3; c.weighty = 0.3; IsMainJPanel.add(jpInfo, c); c.gridx = 0; c.gridy = 1; c.weightx = 0.3; c.weighty = 0.3; IsMainJPanel.add(jpPack, c); c.gridx = 1; c.gridy = 1; c.weightx = 0.3; c.weighty = 0.3; IsMainJPanel.add(j…
has answer: http://stackoverflow.com/a/23642404
tagged with: jframe
score: 0
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/23684083
type: Question
has comment: http://stackoverflow.com/comment/36388520
has answer: http://stackoverflow.com/a/52824824
has body: I need (mostly for testing purposes) to write a consumer whose purpose is to remember how many times it was called. However, I can't do int i = 0; Consumer&lt;Object&gt; handler = o -&gt; i++; because i must be final, and I can't increment final variables. I suppose I need something like MutableInteger class. What is the right way to count then? Writing my own new class or a new method just for that wouldn't count for a right way.
has comment: http://stackoverflow.com/comment/36388798
has comment: http://stackoverflow.com/comment/36388554
has title: How to write a Consumer that counts how many times it was called?
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23684126
upvote count: 8
accepted answer: http://stackoverflow.com/a/23684126
possible better answer: http://stackoverflow.com/a/23688302
downvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/23688302
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36388505
score: 7
tagged with: java
tagged with: concurrency

http://stackoverflow.com/a/23754201
has comment: http://stackoverflow.com/comment/36562821
answers question: http://stackoverflow.com/q/23742906
downvote count: 0
has body: A scheduled report will have a child instance which holds the scheduling information and has the scheduled report as its parent. (You can see this instance in the history list in BI Launch Pad.) You can retrieve recurrently scheduled child instances from the CMS like this: SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Webi' and si_recurring = 1 This will isolate any the reports which are scheduled to be executed (or to be more precise, the child "scheduling" instances described above). You can then call getSchedulingInfo() on the child instance to get further info about this scheduling. Bear in mind the the SI_PARENTID field, not the SI_ID field, returned by the above query gives you the ID of the initial WebI report.
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36550211

http://stackoverflow.com/q/23677571
score: -4
tagged with: insertion-sort
has comment: http://stackoverflow.com/comment/36375908
accepted answer: http://stackoverflow.com/a/23678734
has title: NullPointerException error in Insertion sort
type: Question
has answer: http://stackoverflow.com/a/23677621
linked to: http://stackoverflow.com/q/218384
tagged with: java
has body: I wrote a java to test a insertion sort for strings, but it comes up with error saying "java.lang.NullPointerException: import java.util.Arrays; public class SortTest { private String[] array; final int size = 5; public void sort() { String insert; array = new String[size]; for ( int next = 1; next &lt; array.length; next++ ) { insert = array[next]; int moveItem = next; while (moveItem &gt; 0 &amp;&amp; array[moveItem -1].compareTo(insert) &gt; 0) { array[moveItem] = array[moveItem -1]; moveItem--; } array[moveItem] = insert; } } public static void main (String[] args) { SortTest stringSort = new SortTest(); String array[] = {"aaa", "ccc", "eee", "zzz", "bbb"}; stringSort.sort(); System.out.println( stringSort ); } } I followed most of the codes from textbook and I really can't find where the problems are, please give me some help! Any help is appreciated!
possible better answer: http://stackoverflow.com/a/23677621
downvote count: 4
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/23678195
favorite count: 0
has answer: http://stackoverflow.com/a/23678734
has comment: http://stackoverflow.com/comment/36376669
tagged with: nullpointerexception
answer count: 3
type: AnsweredQuestion

http://stackoverflow.com/comment/36484350
type: Comment
has text: Are you sure that `session.flush()` make underlying db changes? I think, after `flush()`, the changes are still as Uncommitted changes, and real changes will be at commit time. You can inspect db with SQL command after `flush` but not before `commit`.
comment on: http://stackoverflow.com/a/23734523
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36559123
score: 2
comment on: http://stackoverflow.com/a/23773488
type: AnswerComment
type: Comment
has text: And as a general rule, observe invariants, like the result of `new DefaultFormat(DateTimeFormat.getFormat("dd/MM/yyyy")`. It will be the same in every iteration of the loop, so try and only do the work once.

http://stackoverflow.com/comment/36380694
type: Comment
type: QuestionComment
score: 0
has text: can you show your code on those lines
comment on: http://stackoverflow.com/q/23680050

currency
tag name: currency
tags question: http://stackoverflow.com/q/23756488
tags question: http://stackoverflow.com/q/23715407
type: Tag

http://stackoverflow.com/comment/36364763
score: 0
has text: You can use `[^-\w@.]` regex, should be escaped for Java, so `[^-\\w@.]`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671745

http://stackoverflow.com/comment/36328922
score: 0
has text: No my input is a String, but he said me this : "but will it work with bytes? cause control chars are represented that way." But the first input that I receive is a String. So for me, my method has to work.
type: AnswerComment
comment on: http://stackoverflow.com/a/23653469
type: Comment

http://stackoverflow.com/a/23914204
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23633533
has body: Maybe you could create you own version of DefaultApplication but omitting the trait WithDefaultPlugins? Check out the sources of it and it should be pretty self explanatory. https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/Application.scala#L402

http://stackoverflow.com/comment/36310274
comment on: http://stackoverflow.com/a/23639890
type: AnswerComment
score: 0
type: Comment
has text: yes, i added authowird annotation in AnneeMetierImpl and AnneeBean

http://stackoverflow.com/q/23646807
score: 0
has comment: http://stackoverflow.com/comment/36316131
accepted answer: http://stackoverflow.com/a/23647725
answer count: 1
tagged with: android
tagged with: hashtable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36316503
has answer: http://stackoverflow.com/a/23647725
has comment: http://stackoverflow.com/comment/36316339
type: Question
has title: Could not get hashtable in next class(Activity)
tagged with: java
has body: I very new using hashable in java, so i am setting value in one class in Java and getting value same class but could not getting another class, why? I don't know this? My Data Actually, Like this: &lt;rule code="53" value="QN_775_0=QN_775_0&amp;gt;50" /&gt; &lt;rule code="55" value="QN_775_2=QN_775_2&amp;lt;3" /&gt; I want to put key 53 and others and value QN_775_0&gt;50. values is putting after logical operator. Getting Data in same class like this: Logic lg= new Logic(); //like this value String logicCode="53"; String logicCode="QN_775_0&amp;gt;50"; lg.add(logicCode, logicCode); Enumeration&lt;String&gt; enumer = Logic.logicnew.keys(); while (enumer.hasMoreElements()) { String keyFromTable = (String) enumer.nextElement(); System.out.println("1111111CODE="+keyFromTable + "VALUE = " + Logic.logicnew.get(keyFromTable)); } My Model Class: public class Logic { public static Hashtable&lt;String,String&gt; logicnew; public Logic(){ logicnew=new Hashtable&lt;String,String&gt;(); } public void add(String a, String b){ logicnew.put(a,b); } public String get(String key){ return logicnew.get(key); } public int getSize(){ return logicnew.size(); } public Hashtable&lt;String, String&gt; getLogic(){ return logicnew; } @Override public String toString() { StringBuilder sb = new StringBuilder("\n"); Set set = logicnew.entrySet(); Iterator it = set.iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); sb.append("\t"+entry.getKey() + " : " + entry.getValue()+"\n"); } return sb.toString(); } } But in next activity , I am doing this but could not getting value. Enumeration&lt;String&gt; enumer = Logic.logicnew.keys(); while (enumer.hasMoreElements()) { String keyFromTable = (String) enumer.nextElement(); System.out.println("1111111CODE="+keyFromTable + "VALUE = " + Logic.logicnew.get(keyFromTable)); } Here enumer.hasMoreElements() returning false value. why this???

http://stackoverflow.com/comment/36520330
has text: its working, thanks. So I don't need to use getChildAt(1), etc. to retrieve the values from elements generated within the method right?
comment on: http://stackoverflow.com/a/23753367
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36469679
has text: We are not a JVM, sorry to disappoint you :)
type: Comment
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/23726640

http://stackoverflow.com/q/23629233
has title: Caching a tuple to a value without new instance creation
favorite count: 0
has body: I would need to implement a caching of tuple of strings to a value. The problem is that I don't want a new class instance to be created when I retrieve a value from cache. If concatenation of strings is used still new string would be created If new class StringTuple is used still it would need to be created I can use Guava Cache or HashMap but memory consumption and performance should be optimized. What would you recommend?
tagged with: guava
has comment: http://stackoverflow.com/comment/36283864
score: 1
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: caching
has answer: http://stackoverflow.com/a/23633015
type: Question
accepted answer: http://stackoverflow.com/a/23633015
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23724784
has body: If you are using Java 8 you could directly use the filter method as listOfCanMessages.stream().filter(b -&gt; b.MsgID == 1). In other case you can either try Guava or Lamdaj For example. import static ch.lambdaj.Lambda.having; import static ch.lambdaj.Lambda.on; import static ch.lambdaj.Lambda.select; import static org.hamcrest.core.IsEqual.equalTo; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; public class FilterSample { public static void main(String[] args) { List&lt;CanMessage&gt; list = new ArrayList&lt;CanMessage&gt;(); CanMessage c = new CanMessage(); c.MsgID = 1; CanMessage c2 = new CanMessage(); c2.MsgID = 2; CanMessage c3 = new CanMessage(); c3.MsgID = 1; CanMessage c4 = new CanMessage(); c4.MsgID = 4; list.add(c); list.add(c2); list.add(c3); list.add(c4); //Java 8 example List&lt;CanMessage&gt; filteredList1 = list.stream().filter(b -&gt; b.MsgID == 1).collect(Collectors.toList()); System.out.println(filteredList1); //Guava example List&lt;CanMessage&gt; filteredList2 = Lists.newArrayList(Collections2.filter( list, new Predicate&lt;CanMessage&gt;() { @Override public boolean apply(CanMessage input) { if (input.MsgID == 1) { return true; } return false; } })); System.out.println(filteredList2); //Lambdaj example. Please note 6 down vote accepted Lambdaj wraps your (non-final) classes with a Proxy // and intercepts METHOD invocations on them. That means it cannot work on fields but only on methods. So // you cannot access MsgID directly, you'll have to provide a getter method List&lt;CanMessage&gt; filteredList3 = select(list, having(on(CanMessage.class).getMsgID(), equalTo(1))); System.out.println(filteredList3); } }
answers question: http://stackoverflow.com/q/23724484
type: Answer
score: 0

http://stackoverflow.com/a/23730257
upvote count: 1
has comment: http://stackoverflow.com/comment/36478221
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23729780
has body: Make cipherText a character array, then go through it and change a given character when you need to. Strings are immutable, so you cannot change a strings contents after you create it. Adding or subtracting from a string returns an entirely new string, instead of changing the value of the string. When you need to return a string, just: return new String(cipherText); using the String(char[] array) constructor.
score: 1
has comment: http://stackoverflow.com/comment/36499171

http://stackoverflow.com/a/23716133
upvote count: 1
score: 1
has body: The problem exists within the SQL statement you're sending - I assume one of these values: (theuser,thepass,encrypted,thename,themail,4234,23432,thephone) is set to null. Try printing out the string to your console, or running it through the debugger to see which of your variables is null. Hope that helps!
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23716084

http://stackoverflow.com/a/23660191
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36363724
type: Answer
answers question: http://stackoverflow.com/q/23654673
has body: Its using 01.01.1970 as its trying to show zero in unix time. You can use Axis#setLowerBound() to set the lowe limiit to someting closer to you start data and NumberAxis.setNumberFormatOverride() to control the formattng

http://stackoverflow.com/comment/36504364
has text: Thanks for all your replies
type: Comment
comment on: http://stackoverflow.com/a/23744956
score: 0
type: AnswerComment

http://stackoverflow.com/q/23752048
has comment: http://stackoverflow.com/comment/36517687
type: UnansweredQuestion
has body: I have a java project and i'm trying to do TDD. My problem is when I'm about to change API of one class, I edit its tests, then the class itself. But there might be a bunch of other classes using the first class I edited. So I would like compile this one class and its dependecies only. And then run the tests in such minimal environment. Here's an example. My project structure prototype: . |_ build.xml |_ lib/ | |_ *.jar |_ src/ | |_ myPackage/ | |_ ClassA.java | |_ ClassB.java | |_ ClassC.java |_ test/ |_ myPackage/ |_ ClassATest.java |_ ClassBTest.java ClassA uses ClassC. ClassA.java: import myPackage.ClassC; ... Now after the API changes in ClassA I would like to run its tests, but without compiling ClassB. So I want to compile only ClassA and ClassC. I'm using Ant for builds. I found a similar answer in here. But in this case I have to manually specify which classes to compile: &lt;javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath"&gt; &lt;include name="src/myPackage/ClassA.java"/&gt; &lt;include name="src/myPackage/ClassC.java"/&gt; &lt;/javac&gt; My goals are: Be able to run all tests separately. E.g. ant test-ClassA. Make Ant automatically resolve dependencies. Meaning, when I build tests for ClassA it also compiles ClassC. Make Ant to build test targets automatically for every test suite in test dir. In my case it would be test-ClassA and test-ClassB. Is it possible to achieve any of those goals with Ant? Or maybe you have better suggestions about running tests?
upvote count: 1
linked to: http://stackoverflow.com/q/203180
has comment: http://stackoverflow.com/comment/36517975
score: 1
tagged with: java
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/36518250
tagged with: ant
has comment: http://stackoverflow.com/comment/36519779
has comment: http://stackoverflow.com/comment/36518172
tagged with: tdd
has comment: http://stackoverflow.com/comment/36517938
has answer: http://stackoverflow.com/a/23764758
tagged with: junit
downvote count: 0
answer count: 1
has title: Compiling sources only required by specific tests
favorite count: 0
has comment: http://stackoverflow.com/comment/36518343

http://stackoverflow.com/q/23681360
has answer: http://stackoverflow.com/a/23681385
downvote count: 1
tagged with: android-fragments
tagged with: java
score: -1
type: Question
tagged with: findviewbyid
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/23681389
tagged with: android
tagged with: textview
upvote count: 0
has body: I am getting the following error: The method findViewById(int) is undefined for the type ListViewFragment And the ListViewFragment is package com.yogeshojha.nagariksahayata; import java.util.ArrayList; import java.util.List; import com.yogeshojha.nagariksahayata.R; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.app.Activity; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; public class ListViewFragment extends Fragment implements OnItemSelectedListener{ public ListViewFragment(){} Spinner mspinner; TextView viewvdc;//declare spinner globally ArrayAdapter&lt;String&gt; adapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String [] name = {"नेपाली नागरिकता","नेपाली नागरिकता","नेपाली नागरिकता"}; System.out.println(name.length); //This is where I get error, The line after this viewvdc = (TextView) findViewById(R.id.viewvdc); View rootView = inflater.inflate(R.layout.fragment_listview, container, false); mspinner = (Spinner) rootView.findViewById(R.id.spinnervdc); //set adapter for spinner here adapter=new ArrayAdapter&lt;String&gt;(getActivity(),android.R.layout.simple_spinner_item,name); // you can use getActivity() or this mspinner.setAdapter(adapter); return rootView; } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { mspinner.setSelection(position); String selState = (String) mspinner.getSelectedItem(); viewvdc.setText("Selected Android OS:" + selState); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } } I know this is a common mistake but i cant sort out
has title: The method findViewById(int) is undefined for the type ListViewFragment
type: UnansweredQuestion

http://stackoverflow.com/comment/36481997
type: AnswerComment
has text: So i can use `String temp = pane.getDocument().getText(0,pane.getDocument().getLength());` to get the text with style info and instead of replaceSelection i need to use your UPDATE code?? Am sorry i couldn't get it.
type: Comment
comment on: http://stackoverflow.com/a/23731463
score: 0

http://stackoverflow.com/comment/36314756
comment on: http://stackoverflow.com/q/23646069
type: Comment
score: 0
type: QuestionComment
has text: Assuming that your file can fit in memory, the correct way would be to read it into memory first. If not, then you may need to break up the file into chunks and reverse each chunk.

http://stackoverflow.com/a/23716523
upvote count: 3
has comment: http://stackoverflow.com/comment/36449704
score: 3
accepted answer of: http://stackoverflow.com/q/23716503
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23716503
type: Answer
has body: I created a class that extends JPanel and overrided its pain component method. what should i do so that it fully shows the circle when the program is launched. You also need to override the getPreferredSize() method to return the size of the panel so that the layout managers can use this information. overrided its pain component method You should be overriding the paintComponent() method, not the paint() method. Read the section from the Swing tutorial on Custom Painting for more information and working examples.

http://stackoverflow.com/comment/36321698
has text: Is it important to reuse Roles? How is Role defined? Can you give some examples?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23648043
type: Comment

http://stackoverflow.com/comment/36698425
comment on: http://stackoverflow.com/a/23847293
type: AnswerComment
score: 0
type: Comment
has text: Great job, Laura! Thanks for posting the final configuration. Others in trouble will definitely find it useful.

http://stackoverflow.com/comment/93097445
has text: It seems use `Set` will break the sequence of the input list.
type: AnswerComment
comment on: http://stackoverflow.com/a/27872852
score: 0
type: Comment

http://stackoverflow.com/a/42669868
downvote count: 1
has comment: http://stackoverflow.com/comment/130590388
has comment: http://stackoverflow.com/comment/81152926
has comment: http://stackoverflow.com/comment/109768340
has comment: http://stackoverflow.com/comment/129016761
has comment: http://stackoverflow.com/comment/107465180
answers question: http://stackoverflow.com/q/23773024
type: Answer
score: 332
has body: If you are using Java 9+, you can use ifPresentOrElse() method: opt.ifPresentOrElse( value -> System.out.println("Found: " + value), () -> System.out.println("Not found") );
upvote count: 333
has comment: http://stackoverflow.com/comment/107516994

http://stackoverflow.com/a/23665781
has body: The pending fragment transaction that creates the fragment layout and attaches it to the activity view hierarchy is executed in activity onStart(). onCreateOptionsMenu() is invoked after that. Anything before the fragment transaction is executed is too early. Note that the transaction code in onCreate() just posts the transaction but does not execute it yet. Also, from design point of view, consider not having dependencies to fragment internals in an activity. Let the fragment handle its views.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23665105
downvote count: 0

http://stackoverflow.com/a/23724294
has body: if the inputs are null or they are not in database I want to give error use if (rs.next()) instead of while (rs.next()) to check for no records. Sample code: (Modify it as per your requirement) String userid = request.getParameter("username"); String pwd = request.getParameter("password"); // check for empty username or password before making a call to database if (userid == null || userid.trim().length() == 0 || pwd == null || pwd.trim().length() == 0) { out.println("Invalid username or password try again"); } else { ... // request for database query if (rs.next()) { // use if instead of while to check for no record ... } else { out.println("Empty username or password try again"); } }
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23724079
score: 1
answers question: http://stackoverflow.com/q/23724079

http://stackoverflow.com/q/23756988
has body: I'm having a lot of problem trying to upload a file in appengine using jersey 2.8 this is the method I use @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces("application/json") public StringT uploadFile(@FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDisposition){ ... return new StringT("ok"); } the exception I'm having is this Uncaught exception from servlet javax.servlet.UnavailableException: A MultiException has 3 exceptions. They are: 1. java.lang.SecurityException: Unable to create temporary file 2. java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide 3. java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory I do not need to store the file, I just want to handle it Anybody knows a solution?
has title: upload file with jersey2.8 in gae
type: UnansweredQuestion
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/6301973
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/48350475
tagged with: jersey
has comment: http://stackoverflow.com/comment/40337769
downvote count: 0
has comment: http://stackoverflow.com/comment/40443592
favorite count: 0

http://stackoverflow.com/comment/36477281
comment on: http://stackoverflow.com/q/23729786
score: 0
type: Comment
type: QuestionComment
has text: *"no body has to face the problem when running the code"* ..nobody has to help you either. The point of making it easy to see the run-time problem, is that the easier it is to see for ourselves, the more chance you have of getting help. And the code is still 486 lines. From a casual glance, there still seems to be a lot of irrelevant code.

http://stackoverflow.com/q/23648302
type: AnsweredQuestion
upvote count: 0
has body: I have a POJO class with one of String array property having size is 2. But I am creating the object of Person class with passing array of size 5. It's not showing any exception. Why? package classObject; import java.util.Arrays; public class Person implements Cloneable { String name; int age; String[] skills = new String[2]; Person() { } Person(String name, int age, String[] skills) { this.name = name; this.age = age; System.out.println("this.skills.length " + this.skills.length); System.out.println("skills.length " + skills.length); this.skills = skills; System.out.println("Got array is " + Arrays.asList(this.skills)); System.out.println("length of arrays is " + this.skills.length); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override protected Person clone() throws CloneNotSupportedException { return (Person) super.clone(); } public String[] getSkills() { return skills; } public void setSkills(String[] skills) { this.skills = skills; } } // Creating the Object of Person Class public class classObject { /* Way to create an object of any class */ public static void main(String args[]) { try { // Define the array with len 5 String[] skills = new String[5]; skills[0] = "Java"; skills[1] = "PHP"; skills[2] = "JDBC"; skills[3] = "ORACLE"; skills[4] = "SQL"; // Passing the array Person objPerson = new Person("Mohit", 27, skills); System.out.println("Size is " + objPerson.skills.length); } catch (Exception e) { e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/23648398
tagged with: arrays
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36319611
score: -1
possible better answer: http://stackoverflow.com/a/23648559
has answer: http://stackoverflow.com/a/23648559
accepted answer: http://stackoverflow.com/a/23648398
has title: Java Class Object having string array property initialization
tagged with: java
answer count: 2
downvote count: 1

bufferedreader
tags question: http://stackoverflow.com/q/23690961
tags question: http://stackoverflow.com/q/23740757
tags question: http://stackoverflow.com/q/23665119
tags question: http://stackoverflow.com/q/23732360
tags question: http://stackoverflow.com/q/23666286
tags question: http://stackoverflow.com/q/23722067
tags question: http://stackoverflow.com/q/23690242
tag name: bufferedreader
tags question: http://stackoverflow.com/q/23765799
tags question: http://stackoverflow.com/q/23641830
tags question: http://stackoverflow.com/q/23658540
tags question: http://stackoverflow.com/q/23660924
type: Tag

http://stackoverflow.com/comment/36508860
comment on: http://stackoverflow.com/a/23747417
score: 0
type: AnswerComment
has text: @user3580294 Does the annotation serve any purpose besides warning me during compile time?
type: Comment

http://stackoverflow.com/a/23660668
score: -1
has comment: http://stackoverflow.com/comment/36343529
downvote count: 1
has body: You are mixing writers and readers. You need a Reader/InputStream to get input data You need a Writer/OutputStream to write output data So, first you need to read from data.csv. You can either use an InputStream or a Reader, and wrap in a BufferedReader or in a BufferedInputStream. In this example I'll use Readers, because I think they are simpler to handle text files. BufferedReader br = new BufferedReader (new FileReader (new File ("data.csv"))); Then, you read each line String buf; while ((buf=br.readLine())!=null){ String [] row = buf.split (","); //Do whatever you want with your row. You can also save it in a List } If you want to print file's content, you can simply println every row -System.out.println(row) If you want to write rows into another file, then you'll need a writer. A FileWriter wrapped in a BufferedWriter should be fine. Of course, you can use every writer you want. It depens on what you are doing. PrintWriter is also OK. Anyway, remember to flush and close every Writer/OutputStream, and to close every Reader/InputStream. Hopes this helps. Giacomo
type: Answer
has comment: http://stackoverflow.com/comment/36344515
has comment: http://stackoverflow.com/comment/36344622
upvote count: 0
answers question: http://stackoverflow.com/q/23660163
has comment: http://stackoverflow.com/comment/36344098

opencv
type: Tag
tags question: http://stackoverflow.com/q/23707730
tags question: http://stackoverflow.com/q/23651115
tags question: http://stackoverflow.com/q/23696873
tags question: http://stackoverflow.com/q/23773605
tags question: http://stackoverflow.com/q/23767818
tag name: opencv
tags question: http://stackoverflow.com/q/23671306
tags question: http://stackoverflow.com/q/23776610
tags question: http://stackoverflow.com/q/23625757
tags question: http://stackoverflow.com/q/23736960
tags question: http://stackoverflow.com/q/23701354
tags question: http://stackoverflow.com/q/23676955

http://stackoverflow.com/a/23670993
type: Answer
upvote count: 3
score: 3
has body: Well your xsd is invalid. You are constructing it wrong. Here are my suggestions. Download XMLSpy or Liquid XML studio and then view my examples to see how to construct a proper XSD and then validate the XSD against it. These editors are a great way to visually see the XML documents and xsd's. They will help a lot. Essentially you need to declare your types in the XSD then create elements based on those types. While your approach can work I would suggest that you study the approach I have taken it is pretty easy. I could explain it all but I think you will get the idea rather quickly. Address.xsd <?xml version="1.0" encoding="utf-8" ?> <xsd:schema xmlns:address="http://www.example.org/AddressSchema" targetNamespace="http://www.example.org/AddressSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="address"> <xsd:complexType> <xsd:sequence> <xsd:element name="person_name" type="address:person_name_type" /> <xsd:element name="ssd" type="address:ssd_type" /> <xsd:element name="house_id" type="address:house_id_type" /> <xsd:element name="village" type="address:village_type" /> <xsd:element name="city" type="address:city_type" /> <xsd:element name="postal_code" type="address:postalcode_type" /> <xsd:element name="country" type="address:country_type" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:simpleType name="name_type"> <xsd:restriction base="xsd:string" /> </xsd:simpleType> <xsd:simpleType name="postalcode_type"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{5}(-[0-9]{4})?" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="city_type"> <xsd:restriction base="xsd:string"> <xsd:length value="2" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="village_type"> <xsd:restriction base="xsd:string" /> </xsd:simpleType> <xsd:simpleType name="country_type"> <xsd:restriction base="xsd:string" /> </xsd:simpleType> <xsd:simpleType name="title_type"> <xsd:restriction base="xsd:string" /> </xsd:simpleType> <xsd:…
downvote count: 0
answers question: http://stackoverflow.com/q/23669385

http://stackoverflow.com/a/23648472
has body: getTweet() is not a property, it is the accessor (or "getter") of the property. The name of the property is tweets (without the get, first letter to lowercase). So: &lt;c:forEach items="#{tweetManager.tweets}" var="item"&gt; Remember that boolean properties have "getters" like "is" (v.g. isRich()) And keep in mind my comment about using generics.
has comment: http://stackoverflow.com/comment/36319773
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23648241
type: Answer
has comment: http://stackoverflow.com/comment/36319583
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36319896
answers question: http://stackoverflow.com/q/23648241
downvote count: 0

http://stackoverflow.com/comment/37298800
has text: The session owns the channel. Close the channel, then create a new channel with the same session instance. Also, consider using a 'shell' Channel, as it allows more than one command to be sent.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23797887

http://stackoverflow.com/comment/36418780
comment on: http://stackoverflow.com/a/23644033
type: Comment
has text: It's just that the homework said that I should refer to the previous exercises to write the program and the previous exercice had the int a and int b bit already written (I had to complete the code) in the code so I figured I could do the same in this exercice
score: 0
type: AnswerComment

out-of-memory
tags question: http://stackoverflow.com/q/23658678
tags question: http://stackoverflow.com/q/23670029
tags question: http://stackoverflow.com/q/23685719
tags question: http://stackoverflow.com/q/23710086
tags question: http://stackoverflow.com/q/23618364
tags question: http://stackoverflow.com/q/23624177
tags question: http://stackoverflow.com/q/23661998
tags question: http://stackoverflow.com/q/23673980
tags question: http://stackoverflow.com/q/23644939
type: Tag
tag name: out-of-memory
tags question: http://stackoverflow.com/q/23616561
tags question: http://stackoverflow.com/q/23745577
tags question: http://stackoverflow.com/q/23751954

http://stackoverflow.com/comment/36306304
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23641336
score: 0
has text: so this list1strings.removeAll(Arrays.asList(null,"")); line is correct?

http://stackoverflow.com/comment/36419535
type: AnswerComment
type: Comment
has text: I know that, the only thing here is you have to take care of only one of these that is SwingWorker thread and align your code to use property change events
comment on: http://stackoverflow.com/a/23700079
score: 0

http://stackoverflow.com/a/29014639
type: Answer
upvote count: 1
score: 1
has body: From StackOverFlow site reference I don't think you can select a class for debugging but you could go to the Outline view in eclipse, select all the methods in the class, right click and select Toggle Method Breakpoint How to set a breakpoint on a Class NOT a Line in Eclipse?
downvote count: 0
answers question: http://stackoverflow.com/q/23674507

http://stackoverflow.com/q/23719744
has answer: http://stackoverflow.com/a/23719767
accepted answer: http://stackoverflow.com/a/23719827
tagged with: jcombobox
type: AnsweredQuestion
has body: The following code only shows my one answer i.e. 1 element in TextArea and not all, I want it to be a list. double s = Double.parseDouble(amount.getText()); double p = Double.parseDouble(interest.getText()) / 100; double t = Double.parseDouble(period.getText()); double m=t*12; int x=1; double lin = s * Math.pow(1+ p, x); double anu =s+(s*p*t); while(x&lt;=m &amp;&amp; JComboBox.getSelectedItem().equals("Anuitetas")) { JTextArea.setText(String.valueOf(anu)); x++; } while(x&lt;=m &amp;&amp; JComboBox.getSelectedItem().equals("Linijinis")){ JTextArea.setText(String.valueOf(lin)); x++; }
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36456052
has answer: http://stackoverflow.com/a/23719827
tagged with: java
score: 0
answer count: 2
tagged with: jtextarea
has title: While loop and GUI
possible better answer: http://stackoverflow.com/a/23719767

http://stackoverflow.com/comment/36564588
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23776463
type: AnswerComment
has text: Why you can't? To use new language features that solve your problem?

http://stackoverflow.com/q/23710679
score: 0
has body: I'm trying to have a google sign in button to my android application. I googled and found quickstart tutorials and with them I created the following code. In AndroidManifest.xml i add the following: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> my fragment xml (fragment_main_menu.xml): <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.tuxin.myalcoholist.myalcoholist.myalcoholist.MainMenuActivity$PlaceholderFragment"> <com.google.android.gms.common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> my main menu activity contains the following code: package com.tuxin.myalcoholist.myalcoholist.myalcoholist; import android.app.PendingIntent; import android.content.IntentSender; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.plus.Plus; import com.google.android.gms.plus.model.people.Person; public class MainMenuActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.on…
tagged with: google-api-java-client
answer count: 1
has comment: http://stackoverflow.com/comment/36699754
tagged with: android
accepted answer: http://stackoverflow.com/a/23851610
type: AnsweredQuestion
has title: Android sign in button in a fragment
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23851610

homescreen
tags question: http://stackoverflow.com/q/23660714
type: Tag
tag name: homescreen

http://stackoverflow.com/comment/36431422
type: QuestionComment
comment on: http://stackoverflow.com/q/23706648
has text: Math.atan2 takes in `(Double y, Double x)` not `(int y, int x)`.
score: 0
type: Comment

http://stackoverflow.com/a/23773309
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23772308
has body: The problem is in the signature of the sortCollection method. You should change the type of the list parameter from Collection&lt;T&gt; to List&lt;T&gt;. In other words, your method's header should be: public static &lt;T&gt; void sortCollection(List&lt;T&gt; list, final String methodName) That's because Collections.sort() expects its first parameter to be a List (See its javadoc) EDIT: Regarding your implementation, there are some generic/reflection tricks which you can use. Here's a possible alternative impl. @SuppressWarnings({ "unchecked", "rawtypes" }) public static&lt;T&gt; Comparator&lt;T&gt; newMethodComparator(Class&lt;T&gt; cls, String methodName) throws Exception { Method method = cls.getMethod(methodName); if (method.getParameterTypes().length != 0) throw new Exception("Method " + method + " takes parameters"); Class&lt;?&gt; returnType = method.getReturnType(); if (!Comparable.class.isAssignableFrom(returnType)) throw new Exception("The return type " + returnType + " is not Comparable"); return newMethodComparator(method, (Class&lt;? extends Comparable&gt;) returnType); } private static&lt;T,R extends Comparable&lt;R&gt;&gt; Comparator&lt;T&gt; newMethodComparator( final Method method, final Class&lt;R&gt; returnType) throws Exception { return new Comparator&lt;T&gt;() { @Override public int compare(T o1, T o2) { try { R a = invoke(method, o1); R b = invoke(method, o2); return a.compareTo(b); } catch (Exception e) { throw new RuntimeException(e); } } private R invoke(Method method, T o) throws Exception { return returnType.cast(method.invoke(o)); } }; } Here's how you would use it: List&lt;Person&gt; ps = new ArrayList&lt;&gt;(Arrays.asList( new Person("A", "D"), new Person("B", "C"))); ... Comparator&lt;Person&gt; byNameComparator = newMethodComparator(Person.class, "getName"); Collections.sort(ps, byNameComparator); Rationale: (a) This impl. will work for any method that returns a Comparable object. Your implementation is using string-comparison which…
answers question: http://stackoverflow.com/q/23772308
type: Answer
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/23644325
score: 0
has comment: http://stackoverflow.com/comment/36352079
has comment: http://stackoverflow.com/comment/36352832
type: Answer
has comment: http://stackoverflow.com/comment/36349744
has comment: http://stackoverflow.com/comment/36316899
answers question: http://stackoverflow.com/q/23639965
has comment: http://stackoverflow.com/comment/36313789
has body: There is pretty good info in the following article: http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc you can create a model for your error such as: public class ErrorInfo { public final String url; public final String ex; public ErrorInfo(String url, Exception ex) { this.url = url; this.ex = ex.getLocalizedMessage(); } } And an error handler that uses that returns a representation of that model: @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(MyBadDataException.class) @ResponseBody ErrorInfo handleBadRequest(HttpServletRequest req, Exception ex) { return new ErrorInfo(req.getRequestURL(), ex); } If you want more details on how the @ExceptionHandler works in spring, look at the spring docs: http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-exceptionhandlers
has comment: http://stackoverflow.com/comment/36362546
has comment: http://stackoverflow.com/comment/36352914
has comment: http://stackoverflow.com/comment/36352179

http://stackoverflow.com/comment/36419694
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23690114
type: Comment
has text: but then why its faster ?

http://stackoverflow.com/q/23667639
tagged with: awt
accepted answer: http://stackoverflow.com/a/23667668
has comment: http://stackoverflow.com/comment/36357691
tagged with: border
score: 0
answer count: 1
has title: cannot find symbol setBorder() method java
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23667668
tagged with: java
tagged with: jpanel
has body: I have imported javax.swing.border.*; and the piece of code that has the error is one that was provided by the professor. The error that is produced is AccountApplet.java:56: cannot find symbol symbol : method setBorder(javax.swing.border.TitledBorder) location: class java.awt.Panel p1.setBorder(new TitledBorder("Display Account Information")); ^ 1 error The application is just a basic bank withdraw and deposit applet that has a single account with an initial balance of $1000 that is to be processed. import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.border.*; import java.text.DecimalFormat; public class AccountApplet extends JApplet implements ActionListener { private JTextField tf_id = new JTextField(), tf_balance = new JTextField(), tf_deposit = new JTextField(), tf_withdraw = new JTextField(); private JButton b_deposit = new JButton("Deposit"), b_withdraw = new JButton("Withdraw"); private JLabel la_id = new JLabel("Account ID"), la_balance = new JLabel("Account Balance"), la_deposit = new JLabel("Deposit"), la_withdraw = new JLabel("Withdraw"), la_transaction = new JLabel(" "); private Container c = getContentPane(); DecimalFormat f = new DecimalFormat("##.00"); Account a = new Account(1234, 1000.00); double amount; public void init() { c.setLayout(new BorderLayout()); panel1(); panel2(); panel3(); RefreshFields(); } // ---------------------------------------------------------- // Panel 1 is holds the account id and account balance fields // ---------------------------------------------------------- private void panel1() { Panel p1 = new Panel(); p1.setLayout(new BorderLayout()); p1.setBorder(new TitledBorder("Display Account Information")); // Professor's code told to copy and paste were the error is occuring p1.setLayout(new GridLayout(2, 2)); p1.add(la_id); p1.add(tf_id); p1.add(la_balance); p1.add(tf_balance); c.add(p1, BorderLayout.WEST); tf_id.setEditable(false); tf_balance.setEditable(false); }
type: Question
has comment: http://stackoverflow.com/comment/36357191

http://stackoverflow.com/comment/36292701
type: Comment
has text: Sorry, I don't have enough time. Anyway, the errors posted here cannot be replicated by your given code. It would be better if you post the relevant code.
type: QuestionComment
comment on: http://stackoverflow.com/q/23634476
score: 0

http://stackoverflow.com/comment/36528108
has text: Please update closely related question instead of asking a new one with same title. Refer - https://stackoverflow.com/questions/23752993/how-to-bind-textfiled-and-htmleditor-in-javafx
comment on: http://stackoverflow.com/q/23755530
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36315591
comment on: http://stackoverflow.com/q/23646368
has text: Can you share error message?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23733653
has body: You should place the file in the assets folder and use this: InputStream ims = getAssets().open("SHPR_policy");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23733482

object
tags question: http://stackoverflow.com/q/23777508
tags question: http://stackoverflow.com/q/23651751
tag name: object
tags question: http://stackoverflow.com/q/23716735
tags question: http://stackoverflow.com/q/23679246
tags question: http://stackoverflow.com/q/23715712
tags question: http://stackoverflow.com/q/23675649
tags question: http://stackoverflow.com/q/23669223
tags question: http://stackoverflow.com/q/23717406
tags question: http://stackoverflow.com/q/23722627
tags question: http://stackoverflow.com/q/23736433
tags question: http://stackoverflow.com/q/23701931
tags question: http://stackoverflow.com/q/23658512
tags question: http://stackoverflow.com/q/23616098
tags question: http://stackoverflow.com/q/23618238
tags question: http://stackoverflow.com/q/23770590
tags question: http://stackoverflow.com/q/23655076
tags question: http://stackoverflow.com/q/23681373
tags question: http://stackoverflow.com/q/23666606
tags question: http://stackoverflow.com/q/23708465
tags question: http://stackoverflow.com/q/23680137
tags question: http://stackoverflow.com/q/23737638
tags question: http://stackoverflow.com/q/23684731
tags question: http://stackoverflow.com/q/23667084
tags question: http://stackoverflow.com/q/23655959
type: Tag
tags question: http://stackoverflow.com/q/23703603
tags question: http://stackoverflow.com/q/23659502
tags question: http://stackoverflow.com/q/23756862

http://stackoverflow.com/q/23653301
favorite count: 0
has title: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException:
has answer: http://stackoverflow.com/a/23653492
answer count: 2
tagged with: spring
tagged with: spring-mvc
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/23653492
type: AnsweredQuestion
has body: I was trying to get data from a MySQL database using the Spring utility ResultSetExtractor, but I got the following exception: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'edao' defined in class path resource [applicationContext2.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'jdbcTemplate' of bean class [org.resultset.EmployeeDao]: Bean property 'jdbcTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1344) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicat…
downvote count: 0
score: 6
possible better answer: http://stackoverflow.com/a/56903432
type: Question
has answer: http://stackoverflow.com/a/56903432
upvote count: 6

http://stackoverflow.com/a/23733121
type: Answer
answers question: http://stackoverflow.com/q/23733022
score: 0
has comment: http://stackoverflow.com/comment/36483051
has comment: http://stackoverflow.com/comment/36482614
has comment: http://stackoverflow.com/comment/36483134
has comment: http://stackoverflow.com/comment/36482117
has comment: http://stackoverflow.com/comment/36483161
has comment: http://stackoverflow.com/comment/36481831
has body: This looks bad to me. You have an infinite loop in a @PostConstruct. To me, this says your container will never be able to startup since Listener never finishes it's construction phase. Are you sure you don't want to do this work (the infinite loop) on a separate thread? Perhaps you want to use ScheduledExecutorService eg: @Inject ScheduledExecutorService executor; @PostConstruct void init() { Runnable runnable = new Runnable() { public void run() { doSomeStuffInTheDatabase(); } }; long delaySeconds = 1; long periodSeconds = 1; executor.scheduleAtFixedRate(runnable, delaySeconds, periodSeconds, TimeUnit.SECONDS); }

http://stackoverflow.com/comment/36415351
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23698348
type: Comment
has text: I have actually found a way to rewrite it without using mocks (mostly) :p You're probably right that I should avoid mocks whenever I can. I only learned of this a day or two ago and got a bit carried away in excitement! It's still useful to know for future situations. Thanks! :)

http://stackoverflow.com/q/23671346
has comment: http://stackoverflow.com/comment/36364930
has comment: http://stackoverflow.com/comment/36365086
answer count: 4
has comment: http://stackoverflow.com/comment/36364396
has comment: http://stackoverflow.com/comment/36364934
has comment: http://stackoverflow.com/comment/36364439
has answer: http://stackoverflow.com/a/23672518
has title: How to get character by its (unicode) name in Java? I need the reverse of Character.getName(int codePoint)
downvote count: 0
has comment: http://stackoverflow.com/comment/36365527
has comment: http://stackoverflow.com/comment/36366268
has comment: http://stackoverflow.com/comment/36364975
has comment: http://stackoverflow.com/comment/36364985
score: 14
has comment: http://stackoverflow.com/comment/36364591
has comment: http://stackoverflow.com/comment/36365373
has answer: http://stackoverflow.com/a/57541820
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23672484
accepted answer: http://stackoverflow.com/a/57541820
has answer: http://stackoverflow.com/a/23672484
tagged with: java
has comment: http://stackoverflow.com/comment/36364550
linked to: http://stackoverflow.com/q/2443325
has comment: http://stackoverflow.com/comment/36365231
has comment: http://stackoverflow.com/comment/36364630
type: Question
has comment: http://stackoverflow.com/comment/36364907
has comment: http://stackoverflow.com/comment/36365121
has comment: http://stackoverflow.com/comment/36365017
has comment: http://stackoverflow.com/comment/36364496
tagged with: unicode
favorite count: 0
upvote count: 14
has answer: http://stackoverflow.com/a/53253912
has body: How do I look up a character or int codepoint in Java using its Unicode name? For example, if Character.getName('\u00e4') returns "LATIN SMALL LETTER A WITH DIAERESIS", how do I perform the reverse operation (i.e. go from "LATIN SMALL LETTER A WITH DIAERESIS" to '\u00e4') using "plain" Java? Edit: To stop the torrent of comments what I want or I don't want, here is what I would do in Python: "\N{LATIN SMALL LETTER A WITH DIAERESIS}" # this gives me what I want as a literal unicodedata.lookup("LATIN SMALL LETTER A WITH DIAERESIS") # a dynamic version Now, the question is: do the same in Java. And, BTW, I don't want to "print unicode escapes" -- actually getting hex for char is easy, but I want a char bearing given name. To put it in other words I want to do the reverse of what Character.getName(int) does.

http://stackoverflow.com/a/23776463
has comment: http://stackoverflow.com/comment/36564588
has comment: http://stackoverflow.com/comment/36564629
has body: If you have a Java 7, then you can use Multi-Catch exception block. public static String createProject(Map&lt;String, String&gt; params,String projectName, String projectPrefix) throws Exception { String createdProject = null; try { createdProject=//logic for creating createdProject string which may throw two exception mentioned below } catch (MalformedURLException | TestLinkAPIException e) { e.printStackTrace(); throw new Exception("Error creating createdProject", e); } return createdProject; }
has comment: http://stackoverflow.com/comment/36564964
score: 0
has comment: http://stackoverflow.com/comment/36564815
has comment: http://stackoverflow.com/comment/36564718
has comment: http://stackoverflow.com/comment/36564341
type: Answer
answers question: http://stackoverflow.com/q/23776181

http://stackoverflow.com/q/23774560
type: Question
has title: How to get notification on successfull JMS Connection
tagged with: spring-jms
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23783281
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: I am using spring DefaultMessageListenerContainer and SingleConnectionFactory to connect to WMQ queue. I want my application to send me a mail when it successfully connects to WMQ queue. In case of server failover it will retry untill connection is successful, I want a mail after retry is successful. Any help?
upvote count: 1

http://stackoverflow.com/comment/36367745
has text: do btnSearch a findViewById, I mean initialize it, because of it error coming Taba
comment on: http://stackoverflow.com/q/23673237
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36362794
comment on: http://stackoverflow.com/q/23670227
score: 0
type: QuestionComment
has text: @ItachiUchiha So should I create and same packages as i got from decompile tool? I dont know much about JavaFX. in the decomiled folder inside a com\qwe\asdff\ddd\ i have folder main . It has .fxml file and for every file it has a controller .java file. I m confused about this.
type: Comment

http://stackoverflow.com/comment/36309731
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23624437
score: 0
has text: This might not be a bad way to do it. At least until we end up wanting to insert a rule in the middle. ;)

http://stackoverflow.com/q/23758227
accepted answer: http://stackoverflow.com/a/23758332
type: AnsweredQuestion
tagged with: xstream
tagged with: java
has body: I've been parsing XML into ArrayList using Xsrteam. It worked but for some reason I can't reach array's content. Classes which handle ArrayList data: @XStreamAlias("BOARDS") public class Boards { @XStreamImplicit(itemFieldName = "id") public ArrayList ids = new ArrayList(); //region GETTERS-SETTERS public void setIds(ArrayList temp){ this.ids = temp; } public List getIds(){ return ids; } // endregion } @XStreamAlias("id") class Id { @XStreamAlias("board") private String board; @XStreamAlias("description") private String description; @XStreamAlias("price") private String price; @XStreamAlias("shape") private String shape; @XStreamAlias("riding_level") private String ridingLevel; @XStreamAlias("riding_style") private String ridingStyle; @XStreamAlias("camber_profile") private String camber; @XStreamAlias("stance") private String stance; @XStreamAlias("picture") private String picture; &lt;&lt;public getters - setters here&gt;&gt; } How I tried to access those getters: Boards boards = (Boards) xstream.fromXML(reader); // parse xml into array list boards.getIds().get(0).getPrice(); //!!getPrice() cannot be resolved first is Object first = boards.getIds().get(0); Here what it looks like using debugger:
has title: Can't reach ArrayList content
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/23758332
upvote count: 1

http://stackoverflow.com/comment/36365527
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671346
score: 0
has text: @user3580294, thanks. Now that we all agree what I was asking about... let's find some cool answer, because having to write hex in the editor really sucks. And using UTF-8 as source file encoding does not help either, since many different things look the same in Unicode.

http://stackoverflow.com/q/23673596
tagged with: http://stackoverflow.com/tag/html
tagged with: java
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23673628
tagged with: javascript
has body: Here the Select /Combobox static value pass to controller using script is not working properly, the script alert is working. Html code Select Property For SELL RENT script code function onPropertyforChange() { alert("HI"); $.ajax({ type : 'POST', dataType : 'json', url : '/RealEstate/selectedPropertyfor.html', data : ({ id : $('#propertyfor').val() }) }); } the alert shows here but the controller println not working Controller @ResponseBody @RequestMapping(value = ("/selectedPropertyfor.html")) public void getpropertyFor(@RequestParam("propertyfor") int propertyfor) { System.out.println(propertyfor+"QQQQQQQQQQQQQ"); } if you know about this please share answer here.
has answer: http://stackoverflow.com/a/23673628
score: 0
tagged with: thymeleaf
answer count: 1
tagged with: jquery
has comment: http://stackoverflow.com/comment/36368128
has title: How to get select option static value to controller

http://stackoverflow.com/a/23624437
has body: I am not very familiar with the rule ordering in JUnit and especially the RuleChain class. So I had a quick look at this class' documentation. The example code snippet seems to be your solution when being used in a template method sense. I could imagine that following mechanism will work: public abstract class BaseTestCase { @Rule public final RuleChain ruleChain = createRuleChain(); private RuleChain createRuleChain() { return appendInnerRules(RuleChain.outerRule(createOuterRule())); } protected TestRule createOuterRule() { return new Timeout(60 * 1000); } protected RuleChain appendInnerRules(RuleChain ruleChain) { return ruleChain; // default behavior } } public final class TestSomeController extends BaseTestCase { protected RuleChain appendInnerRules(RuleChain ruleChain) { return ruleChain.around(new RunOnEventDispatchThread()); } @Test public void testStuff() { /* ... */ } }
has comment: http://stackoverflow.com/comment/36309731
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/36315842
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23624186
answers question: http://stackoverflow.com/q/23624186
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36358388
score: 0
has text: Your code for actually reading the file is correct. What is going wrong for you?
comment on: http://stackoverflow.com/q/23668095
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36489242
comment on: http://stackoverflow.com/a/23737111
type: Comment
has text: That's true it should be statement instead of line, thanks.
score: 0
type: AnswerComment

linux-mint
type: Tag
tags question: http://stackoverflow.com/q/23677011
tag name: linux-mint

http://stackoverflow.com/q/23772247
type: UnansweredQuestion
tagged with: maven
downvote count: 1
tagged with: java
score: -1
has body: i am making the build of my java project on Travis integration server. i already use the command on .travis.yml to create the zip for my maven build: mvn clean package assembly:assembly But does anyone have an idea of how can i send this zip file to my github repository too during automatic build?
type: Question
has comment: http://stackoverflow.com/comment/36561711
upvote count: 0
tagged with: travis-ci
favorite count: 0
has answer: http://stackoverflow.com/a/23772424
answer count: 1
tagged with: github
has title: Use Assembly to create a zip for maven build and deploy it to github

http://stackoverflow.com/comment/36561761
score: 0
type: AnswerComment
has text: Is there a program I can install that acts as a Command Line without my having to use Command Line? Otherwise I would need to set a default directory for cdr
type: Comment
comment on: http://stackoverflow.com/a/23775042

http://stackoverflow.com/q/23737901
has answer: http://stackoverflow.com/a/23740080
tagged with: windows
has title: how to launch appium node server through cmd prompt in windows 7 machine
tagged with: cmd
has answer: http://stackoverflow.com/a/29672226
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44284237
upvote count: 1
has body: I am doing mobile automation using appium with selenium. I willing to run the appium server using commands through cmd prompt in windows machine. Could any one help how to run through cmd prompt and what is the command to run it without clicking launch button in appium.exe. Please anyone help me.Thanks in advance.
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/30440985
has answer: http://stackoverflow.com/a/24115576
type: Question
tagged with: appium
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/26447581
favorite count: 0

http://stackoverflow.com/a/23706030
downvote count: 0
has comment: http://stackoverflow.com/comment/36430552
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/36441296
upvote count: 11
answers question: http://stackoverflow.com/q/23705654
has comment: http://stackoverflow.com/comment/36430470
has comment: http://stackoverflow.com/comment/36430501
has body: Set the .root -fx-font-size Create a custom stylesheet for your application. In sylesheet .root selector, set -fx-font-size to your desired value: .root { -fx-font-size: 40px; } If needed, a data: URI can be used as described in the Stylesheet API to set the stylesheet data to a string value. This allows you to create the stylesheet data programmatically and apply it a runtime (e.g. for different calculated font sizes), if needed. Why this works This works because: All of the default controls are based on em units (which are based on the default font size). -fx-font-size is an inherited style. Everything inherits from the root. Once you do this, all controls (and the text inside them) will automatically resize nicely to fit whatever font size you specified. Related Sample javafx automatic resizing and button padding Related Information em is a generic unit that is not specific to JavaFX and em units are also used in HTML CSS. If interested, you can read a broader discussion on em units versus other units. Using em units in FXML via expression binding Just setting a default font size gets you about 90% of the way to where you need to be, but is not necessarily a universal fix as some layout units might be specified not using em units. Most of the time this isn't really an issue, but if it is in your case, you could also apply a mechanism described in an Oracle developer mailing list post, which appears to work, though is a little clunky. How about using an expression binding. For 35em x 25em you could write: prefWidth="${35*u.em}" prefHeight="${25*u.em}" It's not 100% concise, but perhaps passable. These kind of sizing expressions work in scene builder 1.1, which is nice. Here is an example using a Rectangle to store the width and height modifiers for the fxml file. <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.shape.*?> <fx:define> <Rectangle fx:id="s" width="13" height="13"/> </fx:def…

http://stackoverflow.com/comment/36321160
comment on: http://stackoverflow.com/q/23634768
score: 0
type: Comment
type: QuestionComment
has text: I found "Network Emulater for Windows Toolkit" and It's working great. You can configure everythink (packet loos, latency etc) http://blog.mrpol.nl/2010/01/14/network-emulator-toolkit/

http://stackoverflow.com/comment/36352054
has text: I've changed my eighthCase method like that: public static void eighthCase() { List<Dog> dogs = new ArrayList<Dog>(); for (Pet animal : mainList) if (animal instanceof Dog) dogs.put((Dog)animal); int min = dogs.get(0); int max = dogs.get(0); int sum = 0; for (Dog dog : dogs) { min = Math.min(min, dog.getWeight()); max = Math.max(max, dog.getWeight()); sum += dog.getWeight(); } System.out.format("min = %i, max = %i, average = %f%n", min, max, sum * 1.0 / dogs.size()); } but im still having exception...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23664675

http://stackoverflow.com/q/23771066
type: AnsweredQuestion
tagged with: java
has title: SQL queries in Java: (JDBC) How to use the SELECT statement?
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23771133
accepted answer: http://stackoverflow.com/a/23771133
answer count: 1
score: 0
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36554827
has body: MysqlDatabase This is my query to connect to my database. SELECT naam, kleur, sector, aantalZilverstukken, Spel_naam FROM speler WHERE Spel_Naam = ? I work in the console of netbeans. When I want to show the records of table Speler with the Spel_Naam. In the console I want to type a primary key of the table Spel and then it shows me the records of the table Speler in the console. How can I do this. Like WHERE Spel_Naam = ? The question mark need to be the name that I typed in Is the select statement correct? I want to type the Spel_Naam in the console and then It must connect to the database and give me the records of table Speler. How can I do this? public class SpelerMapper { private final static String LEES_SPELERS_SQL = "SELECT naam, kleur, sector, aantalZilverstukken, Spel_naam FROM speler WHERE Spel_Naam = ?"; public List&lt;Speler&gt; geefSpelers() { List&lt;Speler&gt; spelerLijst = new ArrayList&lt;Speler&gt;(); Statement statement; Connection connection = PersistentieController.getInstance().getConnection(); try { statement = connection.createStatement(); // query database ResultSet resultSet = statement.executeQuery(LEES_SPELERS_SQL); while (resultSet.next()) { String naam = resultSet.getString("naam"); String kleur = resultSet.getString("kleur"); int sector = resultSet.getInt("sector"); int aantalZilverstukken = resultSet.getInt("aantalZilverstukken"); Speler speler = new Speler(naam ,kleur, sector , aantalZilverstukken); spelerLijst.add(speler); } statement.close(); return spelerLijst; } catch (SQLException e) { e.printStackTrace(); } return null; }

http://stackoverflow.com/comment/36390182
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23683954
has text: @user3633028 you're welcome. If you start configuring your beans using annotations, remove the related bean configurations in faces-config.xml.
score: 0

http://stackoverflow.com/q/23694052
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23697796
upvote count: 2
has body: I have been learning about Java web start and got interested in its features. But can my Java app downloaded and run from browser run on a device without a JRE(Java environment) installed? I have tried download a sample jar from browser with Java web start but my app can't run. Second question: Is there a feature in Java web start to check for an installed JRE and automatically setup the environment?
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23695191
accepted answer: http://stackoverflow.com/a/23695258
tagged with: java
has title: Can java web start run on a device without JRE?
type: Question
has answer: http://stackoverflow.com/a/23695122
tagged with: java-web-start
score: 0
possible better answer: http://stackoverflow.com/a/23695122
has answer: http://stackoverflow.com/a/23695258

http://stackoverflow.com/q/23763637
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/36539592
type: Question
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36539691
has body: My program is getting the file from a directory and it starts some processing on that file. If that processing is not done well, the program pops up a window constructed in another program. My problem is that if one window is open, and the program wants to open one extra window after an extra file has been added to the directory and processed, it is unable to do this. Minimal version of the sort of code I've written: while (true) { file f = getnewfile(); if (f==new) { processing(); if (processing == ntgood) { window.setVisible(true); } else { } }
has comment: http://stackoverflow.com/comment/36545497
has answer: http://stackoverflow.com/a/23763888
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36541831
favorite count: 0
has comment: http://stackoverflow.com/comment/36539846
upvote count: 0
has answer: http://stackoverflow.com/a/23764212
type: UnansweredQuestion
tagged with: swing
has title: How to make program open multiple windows? Java

http://stackoverflow.com/comment/36359887
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23668991
score: 0
has text: I don't want a DB in my application for the moment. Is it possible for me to leave that blank ?

http://stackoverflow.com/comment/36277860
score: 0
has text: look at my update: it happens only on Google+ 4.3 and above
comment on: http://stackoverflow.com/q/23626488
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23642734
has comment: http://stackoverflow.com/comment/36309693
has comment: http://stackoverflow.com/comment/36310759
tagged with: synchronization
has comment: http://stackoverflow.com/comment/36308807
has comment: http://stackoverflow.com/comment/36309001
has comment: http://stackoverflow.com/comment/36308623
type: Question
has comment: http://stackoverflow.com/comment/36309189
has comment: http://stackoverflow.com/comment/36308768
has comment: http://stackoverflow.com/comment/36308902
has comment: http://stackoverflow.com/comment/36332264
has body: I have a java servlet which interacts with hibernate . It is necessary to generate a check id on the system thus: for (long j = 0; j &lt; soldProductQuantity.longValue(); j++) { checkId = Hotel.getNextMcsCheckAndIncrement(); checkIdString = checkId.toString(); McsCheck.generateCheck(checkIdString); } where getNextMcsCheckAndIncrement() is defined as static public synchronized Long getNextMcsCheckAndIncrement() It pulls a value from the database using hibernate, does some operations on it, stores the modified value back, then returns the number. Because getNextMcsCheckAndIncrement is synchronized, I would expect no two checks to have the same number, because no two threads could enter that method at the same time. Yet I can see in my data repeated instances of multiple check ids. So clearly this isn't working. What am I missing? The implementation of getNext as asked: // Increment FIRST, then return the resulting value as the current MCS check value. static public synchronized Long getNextMcsCheckAndIncrement() { Hotel theHotel = null; Long checkCounter; @SuppressWarnings("unchecked") List&lt;Hotel&gt; hotelList = Hotel.returnAllObjects(); for (Hotel currentHotel : hotelList) { // there should be only one. theHotel = currentHotel; } checkCounter = theHotel.getMcsCheckCounter()+1; theHotel.setMcsCheckCounter(checkCounter); theHotel.update(); return checkCounter; } static public List returnAllObjects() { return Hotel.query ("from Hotel"); } static public List query(String queryString) { Session session = HibernateUtil.getSessionFactory().openSession(); List result = session.createQuery(queryString).list(); session.close(); return result; } public void update() { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction transaction = session.beginTransaction(); session.update(this); transaction.commit(); session.close(); } Yes, I know it's not the best way to do it, and I'll solve that in time. But the immediate issue is why concurrency fails.
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/36309075
has comment: http://stackoverflow.com/comment/36308981
has comment: http://stackoverflow.com/comment/36308847
linked to: http://stackoverflow.com/q/11670687
type: UnansweredQuestion
tagged with: servlets
has comment: http://stackoverflow.com/comment/36309461
has answer: http://stackoverflow.com/a/23697917
has comment: http://stackoverflow.com/comment/36308953
has title: java synchronized method fails in servlet

http://stackoverflow.com/a/23664876
has comment: http://stackoverflow.com/comment/36352256
has comment: http://stackoverflow.com/comment/36352797
has comment: http://stackoverflow.com/comment/36352695
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36352376
answers question: http://stackoverflow.com/q/23664571
has comment: http://stackoverflow.com/comment/36352506
type: Answer
accepted answer of: http://stackoverflow.com/q/23664571
has body: I would do it like this (bottom one is shorter): public static void calculateDogValues(){ List&lt;Double&gt; dogWeightList = new ArrayList&lt;&gt;(); double max = 0, min = 0, average = 0; for(Pet pet: mainList){ if (pet instanceof Dog){ //add all dog weights to list dogWeightList.add(pet.getWeight()); } } Collections.sort(dogWeightList); //sort the list min = dogWeightList.get(0); //get smallest value max = dogWeightList.get(dogWeightList.size()-1); //get highest value for (double weight : dogWeightList) { //make sum of all weights average += weight; } average = average/dogWeightList.size(); //sum/number of weights System.out.println("Minimum weight is " + min); System.out.println("Maximum weight is " + max); System.out.println("Average weight is " + average); } Or like this without sort: double max = 0, min = 0, average = 0, amountOfDogs = 0; for(Pet dog: mainList){ if (dog instanceof Dog){ min = Math.min(min, dog.getWeight()); max = Math.max(max, dog.getWeight()); average += dog.getWeight(); amountOfDogs++; } } average = average/amountOfDogs; System.out.println("Minimum weight is " + min); System.out.println("Maximum weight is " + max); System.out.println("Average weight is " + average); } Also make your pet class this: public class Pet{ private String name; private double weight; public String getName() { return name; } protected void setName(String newName) { name = newName; } public Pet(String petName) { name = petName; } public void setWeight(double newWeight){ weight = newWeight; } public double getWeight(){ return weight; } } There was no weight in superclass.
has comment: http://stackoverflow.com/comment/36371674
has comment: http://stackoverflow.com/comment/36372013
has comment: http://stackoverflow.com/comment/36352607
has comment: http://stackoverflow.com/comment/36352856
has comment: http://stackoverflow.com/comment/36352951

http://stackoverflow.com/comment/36429122
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23705381
type: Comment
has text: Is this your exact, real, cut and pasted code? Or is this just a summary that you've typed in here? Perhaps the real code has a problem not shown here.

http://stackoverflow.com/a/23620947
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36266198
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23620746
has body: Szymon has the correct answer to your original question. Basically, the javadoc of Pattern states Back references \n Whatever the nth capturing group matched You have to use that instead of $ to reference matched capturing groups. To answer your edit, the javadoc of replaceFirst states Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see java.util.regex.Matcher#replaceFirst. Use java.util.regex.Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.
answers question: http://stackoverflow.com/q/23620746
has comment: http://stackoverflow.com/comment/36266253

http://stackoverflow.com/q/23688109
score: 1
has body: i have this filter in my application: package br.atualy.gestao.filters; import java.io.IOException; import java.io.Serializable; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import br.atualy.gestao.beans.RegraAcesso; import br.atualy.gestao.beans.Usuario; @WebFilter(urlPatterns={"*"}, filterName="RegraAcessoFilter") public class RegraAcessoFilter implements Serializable, Filter{ private static final long serialVersionUID = 1L; @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; HttpSession httpSession=req.getSession(true); Usuario usuarioLogado=(Usuario) httpSession.getAttribute("usuarioLogado"); if(usuarioLogado!=null){ //Vai pegar as regras do usuário logado e verificar a pagina q o cara ta tentando entrar. //Se achar a página nas permisões, e estiver pra bloquear gera, vai mandar o cara pro inferno... digo, pra uma pagina de erro. String paginaDestino = req.getServletPath(); for(RegraAcesso regra : usuarioLogado.getRegrasAcesso()){ if(paginaDestino.toLowerCase().startsWith(regra.getPagina().toLowerCase())){ if(regra.getBloqueioGeral()){ res.sendRedirect(req.getContextPath()+"/paginaErroPermissao.jsf"); } } } } chain.doFilter(request, response); } @Override public void destroy() { } @Override public void init(FilterConfig arg0) throws ServletException { } } Whose goal is to be applied for every URL. It works as expected when deployed in Tomcat 7, but when deploying in Glassfish 4 it gives me this error, saying that the webPattern i …
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36396759
has title: Deploying error on glassfish caused by WebFilter URL Pattern
tagged with: jsf
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23692009
type: UnansweredQuestion
tagged with: glassfish
downvote count: 0

http://stackoverflow.com/q/23690173
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23696423
score: 0
tagged with: playframework
has title: Play-2.2 Example @ManyToMany Relationship Java
answer count: 1
has body: I was unable to find a complete example for designing a ManyToMany relationship with Play-2.2 in Java. My Problem is, i can't get the Form-to-Model binding to work on my ManyToMany Relationship... There are many users. A user can have many jobs. There are many jobs. A job can "have" many members/participants(users). Job.java @Entity public class Job extends TimmeeyModel { @Constraints.Required @Column(unique = true) public String jobName; @ManyToMany(mappedBy="jobs") public List&lt;User&gt; members = new ArrayList&lt;User&gt;(); public static Finder&lt;Long,Job&gt; find = new Finder&lt;Long, Job&gt;(Long.class,Job.class); @Override public Job create(){ this.save(); return this; } @Override public Job update(Long id){ Job oldJob = find.byId(id); oldJob.setJobName(this.getJobName()); oldJob.setMembers(this.getMembers()); oldJob.save(); oldJob.refresh(); return oldJob; } @Override public void delete(){ this.delete(); } public String toString(){ String userString =""; for (User user : members) { userString+=user.getUsername() +", "; } return jobName + ", " + id +" " + userString; } } User.java @Entity public class User extends TimmeeyModel { @Constraints.Required @Column(unique = true) public String username; @ManyToMany(cascade=CascadeType.PERSIST) public List&lt;Job&gt; jobs = new ArrayList&lt;Job&gt;(); public static Finder&lt;Long, User&gt; find = new Finder&lt;Long, User&gt;(Long.class, User.class); public String getEmail(){ return this.username + "@pool.math.tu-berlin.de"; } @Override public User create(){ //jobs.add(Job.find.all().get(0)); this.save(); return this; } @Override public User update(Long id){ User user = find.ref(id); user.setUsername(this.getUsername()); user.setUsername(this.getUsername()); user.save(); user.refresh(); return user; } public void delete(){ this.delete(); } public String toString(){ String jobString = ""; for (Job job : jobs) { jobString += job.toString() + ", "; } return "User Id: " + id + " "+username + "Jobs: " + jobString; } User…
tagged with: playframework-2.0

http://stackoverflow.com/q/23745242
upvote count: 1
has title: Need to blank screen but not sleep and still register touch events
score: 1
tagged with: java
has body: I'm having some issues with an app where I want to completely blank the screen, but still register touch events and perform actions based on them (including unblanking the screen on a long press). I've tried to do this by simply dimming the screen using the screenBrightness parameter in WindowManager.LayoutParams however setting it to 0 blanks it and causes it to ignore touches, and anything else dims it but not nearly enough (I want it to basically appear off). Any hints on how to approach this would be greatly appreciated!
type: Question
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23672307
has comment: http://stackoverflow.com/comment/36366149
has comment: http://stackoverflow.com/comment/36366267
has comment: http://stackoverflow.com/comment/36365874
accepted answer of: http://stackoverflow.com/q/23672252
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/23672252
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/36365929
has body: if you want decimal part do this . double value = 1.25; int i = (int)value; if you want to round value , do this Math.round(value);
type: Answer
has comment: http://stackoverflow.com/comment/36366208
has comment: http://stackoverflow.com/comment/36366007
has comment: http://stackoverflow.com/comment/36366234

http://stackoverflow.com/a/23702177
score: 7
has body: The parse method's Javadocs state: All of the calendar's date-time fields are cleared before parsing, and the calendar's default values of the date-time fields are used for any missing date-time information. For example, the year value of the parsed Date is 1970 with GregorianCalendar if no year value is given from the parsing operation. You don't supply a year, so it defaults to 1970, and the day of the week follows.
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23702054
answers question: http://stackoverflow.com/q/23702054
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36437353
comment on: http://stackoverflow.com/q/23709980
score: 0
type: Comment
has text: please indicate line 158 @ `Game`?
type: QuestionComment

http://stackoverflow.com/comment/36275582
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23625947
has text: It's not duplicate. I'm not asking for the documentation, I'm asking for a solution to my specific question !!
score: 0

http://stackoverflow.com/q/23724749
tagged with: jodatime
duplicate of: http://stackoverflow.com/q/8746084
answer count: 1
score: 0
type: UnansweredQuestion
has title: How to convert a String of format yyyymmdd to LocalDate in JodaTime
has body: I have a String in the form "20140518". How to convert it into LocalDate object I tried this this.todayDate = new LocalDate(val); System.out.println(todayDate.toString("yyyy-mm-dd")) When I try dumping this to standard output it dumps like 20140518-junk-junk. That it dumps a garbage string . I thought it would dump like 2014-05-18.
tagged with: java
linked to: http://stackoverflow.com/q/8746084
has comment: http://stackoverflow.com/comment/36465843
has answer: http://stackoverflow.com/a/23724838
type: Question

http://stackoverflow.com/q/23759223
tagged with: cmyk
upvote count: 1
has comment: http://stackoverflow.com/comment/36531239
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: itext
type: Question
has body: I am using Itext pdf to generate pdfs having images. For CMYK type JPEG images, i am getting pdfs of nearly double the size of the image used. But for the same image's RGB version, the pdf is nearly of the same size of the image. I would like to know the exact reason behind the increase in size of the pdf. Please note that the pdf contains only the image and a few text comments.
tagged with: image
has title: On generating pdfs using itext pdf, CMYK image is producing pdfs of very large size
has answer: http://stackoverflow.com/a/23759792
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23759792

sql-server
tags question: http://stackoverflow.com/q/23737579
tags question: http://stackoverflow.com/q/23696775
tags question: http://stackoverflow.com/q/23618232
tags question: http://stackoverflow.com/q/23621705
type: Tag
tags question: http://stackoverflow.com/q/23672689
tags question: http://stackoverflow.com/q/23627476
tags question: http://stackoverflow.com/q/23665537
tag name: sql-server
tags question: http://stackoverflow.com/q/23634161
tags question: http://stackoverflow.com/q/23659038
tags question: http://stackoverflow.com/q/23658239
tags question: http://stackoverflow.com/q/23636594
tags question: http://stackoverflow.com/q/23659940

log4j2
tags question: http://stackoverflow.com/q/23679598
tags question: http://stackoverflow.com/q/23747875
tags question: http://stackoverflow.com/q/23682226
tags question: http://stackoverflow.com/q/23746888
tag name: log4j2
type: Tag
tags question: http://stackoverflow.com/q/23633034

http://stackoverflow.com/q/23626293
tagged with: ejb
type: UnansweredQuestion
has body: I'm building a Java EE application for an assignment. I'm required to use JPA for persistence, EJB's to encapsulate my business logic, and a web interface for presentation. Spring is not allowed. My application consists of a root Maven project and 4 Maven sub-projects: one for my model layer (JPA entities), one for my business layer (EJBs), one for my presentation layer (the web application) and one to build an EAR. I'm deploying the EAR to Glassfish. However, I'm having some issues putting everything together. I have an entity class in my model layer (JAR module) like this: @Entity public class Product implements Serializable { @Id @GeneratedValue private int productId; ... } I've then created a service bean in my business layer (EJB module) to encapsulate transaction logic: @Stateless public class ProductService { @PersistenceContext( unitName = "DummyContext" ) EntityManager em; public Product findById( int id ) { return em.find( Product.class, id ); } public List&lt;Product&gt; getAll() { TypedQuery&lt;Product&gt; query = em.createQuery( "SELECT p FROM Product p", Product.class ); return query.getResultList(); } } And finally, I've created a JAX-RS controller in my presentation layer (WAR module) that I'm trying to access my product service from using REST. JAX-RS setup: @ApplicationPath( "/api" ) public class ApplicationConfig extends javax.ws.rs.core.Application { } Controller: @Path( "/products" ) public class ProductController { @Inject private ProductService productService; @Path( "/all" ) @GET @Produces( "text/plain" ) public String getAll() { return "Nothing interesting yet"; } } As you can see the REST controller doesn't do anything yet. Still, this example now fails. The first time I attempt to access \api\products\all after deploying, it throws the following exception: javax.servlet.ServletException: Servlet.init() for servlet wedvich.ApplicationConfig threw exception org.jboss.weld.exceptions.IllegalArgumentException: WELD-001409 Ambiguous dependencie…
type: Question
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/36277786
tagged with: maven
answer count: 1
has comment: http://stackoverflow.com/comment/36276876
has comment: http://stackoverflow.com/comment/36277655
has comment: http://stackoverflow.com/comment/36276324
score: 0
tagged with: java
has title: Injecting EJB into JAX-RS REST controller
has comment: http://stackoverflow.com/comment/36430443
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/38648146

http://stackoverflow.com/a/23747500
has body: You can create a regex based on date &amp; time pattern or you can simply start it from time pattern as well. yyyy-MM-dd hh:mm:ss 1|2 Date &amp; Time pattern followed by 1 or 2 \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s[1|2]\s Time pattern followed by 1 or 2 \d{2}:\d{2}:\d{2}\s[1|2]\s Sample code: String[] str=new String[] { "763570 2006-03-06 14:09:48 2 http://something.com", "763570 2006-03-06 14:09:48 3 http://something.com" }; Pattern p = Pattern .compile("\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}\\s[1|2]\\s"); for (String s : str) { Matcher m = p.matcher(s); if (m.find()) { System.out.println(s.substring(m.end())); } }
type: Answer
answers question: http://stackoverflow.com/q/23747369
score: 0

http://stackoverflow.com/comment/36423462
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23700826
has text: Maybe schema was created during early application deploys and is inconsistent with current entities? Maybe you better drop tables, use javax.persistence.schema-generation.create-script-source and inspect sql-script?
score: 0

http://stackoverflow.com/a/23662271
answers question: http://stackoverflow.com/q/23662201
has comment: http://stackoverflow.com/comment/36346897
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36348033
has comment: http://stackoverflow.com/comment/36347102
type: Answer
has comment: http://stackoverflow.com/comment/36346788
accepted answer of: http://stackoverflow.com/q/23662201
has body: If it occurs in this if statement if(con.GetNameExcists(friendSearch )) and you know that friendSearch is not null, then con must be null, in order to get a NullPointerException in the if statement.
has comment: http://stackoverflow.com/comment/36348420

http://stackoverflow.com/comment/36370139
type: QuestionComment
has text: Try this link:http://stackoverflow.com/questions/14830313/retrieving-a-list-from-a-java-util-stream-stream-in-java8
comment on: http://stackoverflow.com/q/23674624
score: 0
type: Comment

regex-greedy
tags question: http://stackoverflow.com/q/23643920
type: Tag
tag name: regex-greedy

http://stackoverflow.com/a/23648852
has body: Yes in HSQL it is possible. But it is also possible with Criteria. Criteria c = session.createCriteria(Cat.class); c.createAlias("mother.kind", "motherKind"); c.addOrder(Order.asc("motherKind.value")); return c.list(); hsql order by example String hql = "from Survey p order by p.price asc"; Query query = session.createQuery(hql); List results = query.list();
answers question: http://stackoverflow.com/q/23648614
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36323272

http://stackoverflow.com/q/23620919
downvote count: 2
has comment: http://stackoverflow.com/comment/36268697
has answer: http://stackoverflow.com/a/23622036
upvote count: 6
linked to: http://stackoverflow.com/q/1795808
has comment: http://stackoverflow.com/comment/36268141
score: 4
has answer: http://stackoverflow.com/a/23620942
has comment: http://stackoverflow.com/comment/36266210
has answer: http://stackoverflow.com/a/23620933
answer count: 3
has comment: http://stackoverflow.com/comment/36319230
tagged with: operator-precedence
favorite count: 0
has comment: http://stackoverflow.com/comment/36268317
has body: int it=9, at=9; if(it&gt;4 || ++at&gt;10 &amp;&amp; it&gt;0) { System.out.print("stuff"); } System.out.print(at); prints out stuff9 and I want to know why as I thought ++at&gt;10 &amp;&amp; it&gt;0 would be evaluated first and thus make at = 10.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23620933
tagged with: java
has comment: http://stackoverflow.com/comment/36267904
has title: Why does the "or" go before the "and"?
type: Question
accepted answer: http://stackoverflow.com/a/23620942

http://stackoverflow.com/a/23632112
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23632010
type: Answer
accepted answer of: http://stackoverflow.com/q/23632010
score: 2
has comment: http://stackoverflow.com/comment/36287833
downvote count: 0
has comment: http://stackoverflow.com/comment/36286907
has body: You need to define in the other project which is a war packaging things like this: org.apache.maven.plugins maven-war-plugin 2.4 true ... This will create an artifact with the classifier classes which can be referenced in other projects like this ( myGroup myArtifact myVersion</myVersion> classes

http://stackoverflow.com/a/23651778
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23651527
has body: You're question isn't clear, but I'll try to explain to you what Lists are essentially. Lists are a type of data structure, not only in Java but in a lot of programming language. Arrays are also a type of data structure. Data structures hold and manage data in an organized manner. In Java, the main difference between a List and an Array is that a List has dynamic size, while an Array is of fixed size set when the Array was declared. All Lists in Java are implementation of the List interface. If you don't know what interfaces are, I suggest you learn about it, but basically it means that all Lists can do the same basic set of things for you, but do them differently internally. For example, ArrayList uses Arrays internally in order to expand or diminish the List as necessary (implement the dynamic size). LinkedList implements things differently internally, using nodes that are connected to each other. But they both offer the same basic sets of operations to the programmer, defined in the List interface (although one may offer additional methods the other doesn't). Because the differ in their inner implementation, they might differ in performance for different operations. They have different algorithms to do things (for example, access a value in an index), with different 'speeds' (complexities) of doing so. Most of the time ArrayList will be the right, simpler choice. This answer talks about when to prefer one over the other. Hope this helps.

http://stackoverflow.com/comment/36439321
comment on: http://stackoverflow.com/a/23708935
has text: @AlirezaFattahi It's not a method, it's a function.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/100172271
has text: This is a nice workaround, using @NonNull. But be aware that this does not work with fields having default-values.
type: AnswerComment
comment on: http://stackoverflow.com/a/41219801
type: Comment
score: 2

http://stackoverflow.com/a/23754559
has comment: http://stackoverflow.com/comment/36522536
has comment: http://stackoverflow.com/comment/36522659
has body: I can see one problem here. You are using Oracle driver to perform operation on the MySQL database. try { Class.forName("com.mysql.jdbc.Driver"); } Try this. You need not specify the port number if you are using the default port.jdbc:mysql://localhost/dbName should do
has comment: http://stackoverflow.com/comment/36522514
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23754456
has comment: http://stackoverflow.com/comment/36522381
score: 1
has comment: http://stackoverflow.com/comment/36522560
has comment: http://stackoverflow.com/comment/36522621

http://stackoverflow.com/comment/36289949
has text: @bouncingHippo: No, it doesn't need to.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23633572
type: QuestionComment

http://stackoverflow.com/a/54945136
upvote count: 3
type: Answer
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/121623132
answers question: http://stackoverflow.com/q/23774985
has body: We are seeking for pair of cars (P, Q), where 0 ≤ P &lt; Q &lt; N. Your case (2,1) , does not pass the requirement. My approach is simple. for each 1 value, we have to count previous zeroes. My code got 100% in JAVA with time complexity O(n): class Solution { public int solution(int[] A) { int count = 0; int zeroCount = 0; for (int i = 0; i &lt; A.length; i++) { if (A[i] == 0) { zeroCount++; } else if (A[i] == 1) { count += zeroCount; } } return count &gt;= 0 &amp;&amp; count &lt;= 1000_000_000 ? count : -1; } }

http://stackoverflow.com/comment/36277864
score: 0
comment on: http://stackoverflow.com/q/23624255
type: Comment
type: QuestionComment
has text: `POST` is for submitting data to the server. If you want to view a page use `GET` or leave out the method entirely.

http://stackoverflow.com/comment/36402327
type: QuestionComment
comment on: http://stackoverflow.com/q/23690937
score: 1
has text: @Rusher The OP hasn't specified where `addNotify()` comes from. As such, we can assume that it is not part of some standard API. The question is therefore equivalent to: "What does `fooBar()` do?" Without more details it is not helpful to anyone. These questions I ask in the comment are meant to push the OP to look for hints in the right place.
type: Comment

snappy
type: Tag
tags question: http://stackoverflow.com/q/23745827
tag name: snappy

http://stackoverflow.com/comment/36576121
type: AnswerComment
score: 0
type: Comment
has text: Why WSO2 ESB? I don't see that the Blackberry Dev asked for this. Looks like marketing.
comment on: http://stackoverflow.com/a/23753087

http://stackoverflow.com/q/23722583
tagged with: tomcat7
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36461718
accepted answer: http://stackoverflow.com/a/23722786
has comment: http://stackoverflow.com/comment/36461688
has title: Persistence Injection fails, NPE
has body: I'm trying to inject an EntityManager into my Tomcat 7 application. I have a class that manages my queries (service.PresentatieDao), in which I have this code: private EntityManager em; @PersistenceContext public void setEntityManager(EntityManager em) { this.em = em; } In my applicationContext.xml I have this line: And finally in my dispatcher-servlet.xml I have this code (copy paste with edits to point correctly): domein <constructor-arg ref="entityManagerFactory" /> <tx:annotation-driven transaction-manager="transactionManager"/> And in my controller: @Autowired private PresentatieDao presentatieDao; I have gotten all types of errors about my mapping, which I have solved. Now I get a NullPointerException at this line in my PresentatieDao: return em.createQuery("select p from Presentatie p").getResultList(); the em is null in this case. Any ideas what might be wrong here?
upvote count: 1
tagged with: jpa
answer count: 1
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/23722786
has comment: http://stackoverflow.com/comment/36462248
downvote count: 0

http://stackoverflow.com/a/30280783
score: 1
has body: We have the same problem and don't know the reason yet. Our temporary solution: we attach the user ID to every user request and we check the permissions of that particular user every time, because we unfortunately can not trust to the session id. If the session does not belong to the user ID, we reject the request and ask the user to initiate a new session. The problem affects less than 1 percent of sessions. We suspected the load ballancer system in front of the Glassfish servers, but if someone has the same experience without load ballancer layer, the problem hides somewhere else.
upvote count: 1
has comment: http://stackoverflow.com/comment/48968126
has comment: http://stackoverflow.com/comment/48661423
answers question: http://stackoverflow.com/q/23631227
type: Answer
downvote count: 0

http://stackoverflow.com/a/23643486
type: Answer
has comment: http://stackoverflow.com/comment/36310269
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36331545
has body: As mentioned, you can create an ArrayList of type Question. This means that you will only be able to use methods that are defined in the Question class. For example public class Question { public void askAQuestion(){ System.out.println("Im asking a question"); } } _ public class QuestionOne extends Question { @Override public void askAQuestion(){ // You can override a method. As long as it has the same name and // return type, it can have it's own functionality System.out.println("Im asking question one"); } public void doSomethingElse(){ // Because this method is not in the Question class, you cannot use // it in your ArrayList } } _ public class QuestionTwo { @Override public void askAQuestion(){ System.out.println("Im asking question two"); } } _ public class MainClass { public static void main (String[] args){ List&lt;Question&gt; questions = new ArrayList&lt;Question&gt;(); questions.add(new QuestionOne()); questions.add(new QuestionTwo()); questions.get(0).askAQuestion(); // Outputs "Im asking question one" questions.get(1).askAQuestion(); // Outputs "Im asking question two" } }
answers question: http://stackoverflow.com/q/23643384
has comment: http://stackoverflow.com/comment/36310347
accepted answer of: http://stackoverflow.com/q/23643384
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23734347
type: Answer
has comment: http://stackoverflow.com/comment/36484115
score: 2
has comment: http://stackoverflow.com/comment/36484021
has comment: http://stackoverflow.com/comment/36483960
has body: The Session#flush() method makes the data that is currently in the session synchronized with what is in the database. According to the javadoc: Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
downvote count: 0
answers question: http://stackoverflow.com/q/23734266
has comment: http://stackoverflow.com/comment/36484201
upvote count: 2

http://stackoverflow.com/comment/36513443
has text: -1 for futile tile. Try to summarize the actual problem in the title so you get readers who are interested in problems of that type,
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23748285

http://stackoverflow.com/comment/36532890
type: AnswerComment
type: Comment
has text: @EJP Ah, thanks, I'll remove that part of the answer, it is a rant anyway.
comment on: http://stackoverflow.com/a/23744165
score: 0

http://stackoverflow.com/a/23626089
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23625705
downvote count: 1
score: -1
has body: For reading a large xml file, you can use SAX parser. In addition to that reading the values inside the "characters" in the SAX parser should be read using "String Buffer" instead of String. You can check out the SAX parser here.

http://stackoverflow.com/comment/36385741
type: QuestionComment
has text: Have you tried lazy loading the set? For example, modify the join annotation to be `@OneToMany(fetch = FetchType.LAZY, mappedBy = "categorieParent", cascade = ALL)`. Also, why do you need to load all the nodes?
comment on: http://stackoverflow.com/q/23682188
score: 0
type: Comment

graphics2d
tags question: http://stackoverflow.com/q/23617127
tags question: http://stackoverflow.com/q/23767449
tags question: http://stackoverflow.com/q/23636984
tag name: graphics2d
tags question: http://stackoverflow.com/q/23743449
tags question: http://stackoverflow.com/q/23726692
tags question: http://stackoverflow.com/q/23714810
tags question: http://stackoverflow.com/q/23749317
type: Tag
tags question: http://stackoverflow.com/q/23640579

http://stackoverflow.com/q/23664078
possible better answer: http://stackoverflow.com/a/40847030
accepted answer: http://stackoverflow.com/a/23664301
has body: I have a large binary string "101101110...", and I am trying to store it into a byte array. what is the best way of doing it? Lets say I have largeString = "0100111010111011011000000001000110101" Result that I'm looking for: [78, 187, 96, 17, 21] 01001110 10111011 01100000 00010001 10101 What i've tried: byte[] b= new BigInteger(largeString,2).toByteArray(); however it did not give me the result I'm looking for...
type: Question
has answer: http://stackoverflow.com/a/40847030
tagged with: arrays
has comment: http://stackoverflow.com/comment/36350614
has answer: http://stackoverflow.com/a/23664582
answer count: 3
has comment: http://stackoverflow.com/comment/36350616
downvote count: 0
tagged with: string
favorite count: 0
has title: How do I convert a large binary String to byte array java?
tagged with: binary
has answer: http://stackoverflow.com/a/23664301
has comment: http://stackoverflow.com/comment/36350623
has comment: http://stackoverflow.com/comment/36350510
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/36478433
has text: @VedPrakash I know - can you tell me how can I do a PUT or a PATCH to the server?
comment on: http://stackoverflow.com/q/23731225
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23736109
has answer: http://stackoverflow.com/a/23736204
tagged with: jpa
accepted answer: http://stackoverflow.com/a/23736204
type: AnsweredQuestion
tagged with: sql
has answer: http://stackoverflow.com/a/23738371
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23738371
has title: Can I add amounts from multiple tables in hql
has body: I would like to perform a query in HQL similar to this in SQL: SELECT ( SELECT COUNT(*) FROM EMPLOYER + SELECT COUNT(*) FROM COMPANIES ) FROM DUAL When I add "FROM DUAL" to the query I get an error: org.hibernate.hql.ast.QuerySyntaxException: DUAL is not mapped And if I leave off the "FROM DUAL" I get: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree Any recommendations?
score: 0
tagged with: java
tagged with: hibernate
tagged with: hql

http://stackoverflow.com/a/23721533
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23718135
has body: You can do the following: package-info.java Your @XmlSchema annotation should look something like the following on your package-info class. Since elementFormDefault is specified as UNQUALIFIED the namespace will only be applied to global elements (in JAXB those corresponding to the @XmlRootElement). Note a JAXB impl is not required to use the prefix included in the @XmlSchema when marshalling XML. @XmlSchema( elementFormDefault=XmlNsForm.UNQUALIFIED, namespace="sample.url.something", xmlns={ @XmlNs(prefix="Person", namespaceURI="sample.url.something") } ) package com.example; import javax.xml.bind.annotation.*; Person The @XmlRootElement annotation should not include the prefix. package com.example; import javax.xml.bind.annotation.*; @XmlRootElement(name="sampleData") public class Person { For More Information You can read more about controlling namespace prefixes in JAXB on my blog: http://blog.bdoughan.com/2011/11/jaxb-and-namespace-prefixes.html
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23718135

http://stackoverflow.com/a/23683715
has comment: http://stackoverflow.com/comment/61324242
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23683350
score: 1
has comment: http://stackoverflow.com/comment/78817403
has body: The following thing is working for me Project Structure Application | src | package | WebViewLoadLocalFile.java test.html test.css WebViewLoadLocalFile import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.web.WebView; import javafx.stage.Stage; public class WebViewLoadLocalFile extends Application { @Override public void start(Stage stage) throws Exception { BorderPane borderPane = new BorderPane(); WebView webView = new WebView(); String url = getClass().getResource("test.html").toExternalForm(); webView.getEngine().load(url); borderPane.setCenter(webView); final Scene scene = new Scene(borderPane); stage.setScene(scene); stage.setHeight(300); stage.setWidth(250); stage.show(); } public static void main(String[] args) { launch(args); } } test.html Insert title here Test HTML test.css body { background-color:#d0e4fe; }
upvote count: 1
has comment: http://stackoverflow.com/comment/61329574
has comment: http://stackoverflow.com/comment/36388096

http://stackoverflow.com/q/23642951
has title: JavaMail with Apache James mail server
type: Question
tagged with: apache
downvote count: 0
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/36352556
answer count: 1
tagged with: email
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36355870
has body: I have an apache james mail server hosted on a local machine. It uses a self signed certificate which I added to the trusted list. I am trying to send and receive mails using java mail I get this error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure The SSL debug output however says that a trusted certificate is found. Otherwise it doesn't tell me much. I should also mention that this mail server works with openssl as well as with thunderbird. Code for the receiving of mails: String host = "192.168.1.21"; Boolean debug = true; POP3Folder folder = null; Store store = null; try { Properties props = new Properties(); props.put("mail.host", host); props.put("mail.store.protocol", "pop3s"); props.put("mail.pop3s.port", "995"); Session session = Session.getInstance(props,null); session.setDebug(debug); store = session.getStore("pop3s"); store.connect(username, password); The exception is thrown when I attempt to connect. I have been banging my head against the wall for the last couple of hours/days so any help would be greatly appreciated. EDIT: The SSL debug output: Info: *** Info: Found trusted certificate: Info: [ [ Version: V3 Subject: CN=192.168.1.21, OU=private, O=private, L=pretoria, ST=gauteng, C=za Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11 Key: Sun RSA public key, 2048 bits modulus: 22201738425808301357843951429131863923295077691776461029270738957881925042102429206972015246280434827640419315658812269457485815395646018000726167885520466978079051879949885421741485411500412697981582621030362804785391242469536810788864680524659094190388912471585546967116467038492937424356023436763640787748242238829212068970215212531761712168559272937198654805596431568611192706600640030995533703350490664304506975658770991265086884832523665903150599863152070395170101007238711948275224105410201713594276436919539183706721126654808927498591115057177598201458589477257783098334024997797269658976390073190289972335957 public exponent: 65537 …
has answer: http://stackoverflow.com/a/23645076
has comment: http://stackoverflow.com/comment/36398216
score: 1
tagged with: java
tagged with: ssl

http://stackoverflow.com/a/23646404
answers question: http://stackoverflow.com/q/23637224
score: 0
has body: It could happen if you have e.g. a HTMLDocument and the document has &lt;head&gt; section. The section has representation in model so there is an Element and approriate offset in the document but the &lt;head&gt; Element has no View (visible reprsenation) so it can't find visible line start for the Element's offset
type: Answer

http://stackoverflow.com/q/23705140
has comment: http://stackoverflow.com/comment/36428430
has comment: http://stackoverflow.com/comment/36428351
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/36428775
has comment: http://stackoverflow.com/comment/36428565
linked to: http://stackoverflow.com/q/218384
has title: Keep getting null pointer exception error? My Logic is nearly accurate
tagged with: java
has comment: http://stackoverflow.com/comment/36428315
downvote count: 3
duplicate of: http://stackoverflow.com/q/218384
type: Question
tagged with: try-catch
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36428316
tagged with: class
has comment: http://stackoverflow.com/comment/36428317
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23705191
tagged with: exception
has comment: http://stackoverflow.com/comment/36428310
favorite count: 0
has body: Why is it when i input 1 or 2 to activate the switch case 1 or 2 i have a null pointer exception error?? i really need people who can shed some light to my problem. I believe there is nothing wrong with my switch cases. what did i miss?? package dakilangtaoako; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; public class DakilangTaoAko { public static void main(String[] args){ BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) ); String mydata[][] = new String[5][3] ; String inttoword [] = new String [5]; int wordtoint[] = new int [5]; int mychoice = 0; String toreturn = ""; for (int outside = 0; outside &lt; 5; outside++){ System.out.println("Entry no." + (outside + 1)); for (int inside = 0; inside &lt; 3; inside++){ if(inside == 0){ try { System.out.print("Name: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } else if(inside == 1){ try { System.out.print("ID: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } else if(inside ==2){ try { System.out.print("Subject: "); mydata[outside][inside]= dataIn.readLine(); } catch (IOException ex) { Logger.getLogger(DakilangTaoAko.class.getName()).log(Level.parse("OK"), null, ex); } } } } for(int outside= 0; outside &lt;5; outside++){ for(int inside = 1; inside &lt;= 3; inside++){ if(inside ==0) inttoword[outside]=(mydata[outside][inside])+";"+(mydata[outside][inside]); } } for(int outside = 0; outside &lt; 5; outside++){ for(int inside = 1; inside &lt;= 3; inside++){ if(inside ==0) wordtoint[outside]=Integer.parseInt(mydata[outside][inside]); } } for(int i=0;i&lt;5;i++){ wordtoint[i]=Integer.parseInt(mydata[i][1]); } while(mychoice != 5){ System.out.println("-------- DISPLA…

http://stackoverflow.com/comment/36360066
score: 0
type: Comment
has text: The code in the second grey box is easier to read than using multiple `if` or `if/else` statements. Please do it this way - it's what ternary operators are for. +1.
comment on: http://stackoverflow.com/a/23644798
type: AnswerComment

http://stackoverflow.com/comment/36448087
comment on: http://stackoverflow.com/q/23715714
has text: This is a statement, not a question.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23617297
answers question: http://stackoverflow.com/q/23617127
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36260238
score: 2
has body: I want to draw a simple board made of Graphics2D rectangles When you do custom painting you also need to override the getPreferredSize(...) method of your component to return the size of the comoponent. Then the layout manager can use this information and you will not need to use the rigid area. When you add the components to the frame you can just use the default BorderLayout: frame.add(board, BorderLayout.CENTER); frame.add(button, BorderLayout.SOUTH); I suggest you read the Swing tutorial. There are section on custom painting and using layout managers that will provide more detail and examples.
accepted answer of: http://stackoverflow.com/q/23617127
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23730719
has comment: http://stackoverflow.com/comment/36483047
favorite count: 0
has comment: http://stackoverflow.com/comment/36477534
has comment: http://stackoverflow.com/comment/36481594
upvote count: 2
type: UnansweredQuestion
has body: Hello I am creating a desktop application using Javafx ,embedded h2 database and hibernate for making connection between them. My application running well in my desktop but while i am running the executable jar file on other system it unable to fetch data from data base that means my db file is not embedded in application jar file. my database file resides in root directory .kindly tell me how can i put embedded h2 database file into that executable jar file or what change should i make in hibernate.cfg to put my test.h2.db file in app.jar. My hibernate.cfg file is <hibernate-configuration> org.h2.Driver jdbc:h2:~/test sa org.hibernate.dialect.H2Dialect thread org.hibernate.cache.NoCacheProvider update true <mapping class="model.Employee"/> </hibernate-configuration>
has answer: http://stackoverflow.com/a/77852400
linked to: http://stackoverflow.com/q/10620131
score: 2
has title: h2 embedded database,javafx,hibernate
tagged with: java
tagged with: hibernate
tagged with: h2
tagged with: javafx
has comment: http://stackoverflow.com/comment/36517565
has comment: http://stackoverflow.com/comment/36478069
has comment: http://stackoverflow.com/comment/36478362
type: Question
has comment: http://stackoverflow.com/comment/36478171
downvote count: 0
has comment: http://stackoverflow.com/comment/36486495
answer count: 1

http://stackoverflow.com/q/23652405
has title: Trying to access xml file in tomcat via URL, getting 404 error
upvote count: 1
has comment: http://stackoverflow.com/comment/36330369
type: Question
has comment: http://stackoverflow.com/comment/36330471
has comment: http://stackoverflow.com/comment/36333851
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36331277
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/37897070
has comment: http://stackoverflow.com/comment/36330128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36331399
has body: I have a webapp deployed in Tomee+ 1.6.0 (tomcat 7.0). The app runs fine and I can access all pages. Within one of my app's folders (myapp/intructions/) I have placed a xml file that I will access via a client application. The application will access the file for its configuration, and will be called via a batch file with the following command: "C:\Java\jre7\bin\java" -cp MyApp.jar com.me.MyApplicationStart "argument1" "argument2" Within MyApplicationStart the constructor tries to access the configuration from the URL http://webserver:8080/myapp/instruction/myconfig.xml As I have no control over the above methodology, this cannot be changed. I would expect the xml to be downloaded (or fetched) and my application to work fine, but instead I get a 404 error. If I change the extension of my config file to .properties, everything works fine, but someone else other than me in the team insists that we use xml for the config file, since it will allow more automation features. What gets me is why can't I access this xml (or any other) file from tomcat. It seems that in previous versions of tomcat this was not a problem, or at least not with files outside the WEB-INF folder. Now it is and it seems to be exclusive to xml files, which suggests that there's a configuration in place that prevents access to this extension from anywhere in the webapp. Would anybody know what this configuration is, or what is the mechanics behind this error? Thanks in advance.
tagged with: http://stackoverflow.com/tag/xml
tagged with: java

http://stackoverflow.com/comment/36484951
type: Comment
comment on: http://stackoverflow.com/a/23702148
has text: Iframes shouldnt be a problem. Just check the syntax of the html of that url. Basically you would either have an inside a body tag, or tags inside a frameset and no body tag at all. Jsoup will parse it even if its wrong but might reject the frame tags. Can you share the actual url if possible. Or try connecting without the user-agent.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36340871
type: Comment
comment on: http://stackoverflow.com/a/23658886
has text: ^^ I added it for you. About using the controller is a good idea.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23741189
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23740777
has comment: http://stackoverflow.com/comment/36499802
has body: To ease your pain, here's what I suggest. Since you have got your XML ready. 1. Try generating the schema (xsd file) out of it through random online tools: "XML to Schema generator" 2. Generate java mappings from schema. On the side. I aint sure if @XmlRootElement can be put just like that. I guess it should be specified on the wrapper class "Boards" like that: @XmlRootElement class Boards{ @XmlElement(name="ID") private List&lt;Id&gt; id; } class Id{ @XmlElement(name="BOARD") private Board board; } and then Board class with all it's setters/getters would be filled. If you can manipulate the schema, change it to &lt;BRAND brand="Arbor" id="1"&gt; etc. hope it helps.
downvote count: 0
type: Answer

http://stackoverflow.com/a/23884536
downvote count: 0
has body: nilesh's answer is close, but to be more modular, you can keep your step definitions separated from each other and have context-aware objects injected into each of them. Cucumber can guarantee the state cleanliness before each scenario.
type: Answer
answers question: http://stackoverflow.com/q/23674574
accepted answer of: http://stackoverflow.com/q/23674574
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36541869
type: Comment
score: 0
type: AnswerComment
has text: No i wont do that @Raghunandan..I respect you..I know you are a very good programmer in android(from your reps)..I am just a beginner in android and is trying to help others with my very little knowledge in android..
comment on: http://stackoverflow.com/a/23764456

http://stackoverflow.com/q/23755976
tagged with: serialization
has body: I am using my own class in a Kafka message which has a bunch of String data types. I therefore cannot use the default serializer class or the StringSerializer that comes with Kafka library. I guess I need to write my own serializer and feed it to the producer properties?
type: UnansweredQuestion
has title: Writing Custom Kafka Serializer
linked to: http://stackoverflow.com/q/7637752
tagged with: scala
tagged with: java
score: 23
has comment: http://stackoverflow.com/comment/47717587
downvote count: 1
upvote count: 24
has answer: http://stackoverflow.com/a/61234927
type: Question
has comment: http://stackoverflow.com/comment/36525265
tagged with: apache-kafka
has answer: http://stackoverflow.com/a/28232161
has answer: http://stackoverflow.com/a/24024119
answer count: 3
favorite count: 0

http://stackoverflow.com/comment/36414630
comment on: http://stackoverflow.com/q/23697832
type: Comment
has text: yes i use GL11.something but when i call glGetString(GL11.GL_VERSION) the version it returns is OpenGL 4.4
type: QuestionComment
score: 0

http://stackoverflow.com/q/23638610
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23638678
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/23638956
has title: Resource not available in Struts 2
has body: I am new to Struts and I want to execute HelloWorld program, but I am getting "Requested resource not available" error as soon as I write a tag in web.xml. web.xml: <?xml version="1.0" encoding="UTF-8"?> Struts 2 index.jsp struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* struts.xml : <?xml version="1.0" encoding="UTF-8"?> /HelloWorld.jsp I added all required struts jars as a user library. I am accessing index page as : http://localhost:8080/practice/index.jsp If I remove tag from web.xml file I am able access index.jsp page, but if I add tag it is giving "Requested resource not available" error.
tagged with: http-status-code-404
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36315196
has answer: http://stackoverflow.com/a/23638956
downvote count: 0
has answer: http://stackoverflow.com/a/23647557
score: 1
tagged with: java
type: Question
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23638678
linked to: http://stackoverflow.com/q/13308920
tagged with: struts2

http://stackoverflow.com/comment/36580342
comment on: http://stackoverflow.com/a/23723762
score: 0
type: AnswerComment
type: Comment
has text: Probably it is not... But there is no other way, at least for now :).

http://stackoverflow.com/a/23773159
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23750664
has body: I got it to work. It was missing a call to measure. This is what I'm using in the end: GameTile gameTile = square.getGameTile(); gameTile.measure((int)tilePixels, (int)tilePixels); gameTile.layout(0, 0, 0, 0); canvas.save(); canvas.translate(coor.getX() * tilePixels, coor.getY() * tilePixels); gameTile.draw(canvas); canvas.restore(); GameTile is a subclass of FrameLayout. The save, translate, and restore methods are used to position the FrameLayout on the canvas.

http://stackoverflow.com/a/23626356
answers question: http://stackoverflow.com/q/23625921
has body: Remove Resources path entry in {module}.gwt.xml. it does not require. &lt;source path='resources'/&gt;
score: 0
type: Answer

http://stackoverflow.com/comment/36506795
type: Comment
comment on: http://stackoverflow.com/a/23745804
type: AnswerComment
has text: Yeah I've tried this code but couldn'u understand how can i pass info from the Db to listItems- Yout see it uses hashmap and list of strings, but it isn't clear how do i pass tow values from the db into the groupview, or how to make one layout for the expendble view and not 3 or 5 lines. I even asked it here- http://stackoverflow.com/questions/23739692/android-how-to-get-expandable-list-view-work-with-cursor - but no one answered me
score: 0

http://stackoverflow.com/q/23766700
has body: I have an application trying pull some data from database and then saved it in a docx file. Some part of this data is html code, so using docx4j I was able to convert the html code into docx format. A related post was here. Now I want to convert this part text (in a table cell within a docx file ) back into html format using docx4j and save the html code into database. I wrapped some code from docx4j samples and have the code below: public class AltChunkAddOfTypeHtml { private static ObjectFactory factory; private final static String inputfilepath = System.getProperty("user.dir") + "/test.docx"; public static void main(String[] args) throws Exception { WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .createPackage(); MainDocumentPart mdp = wordMLPackage.getMainDocumentPart(); factory = Context.getWmlObjectFactory(); Tbl table = factory.createTbl(); Tr tableRow = factory.createTr(); Tc tableCell = factory.createTc(); wordMLPackage.getMainDocumentPart().addObject(table); String xhtml = " Import me Hello World!This is the html code converted into docx!!! tested by david "; ; mdp.addAltChunk(AltChunkType.Xhtml, xhtml.getBytes(), tableCell); tableRow.getContent().add(tableCell); table.getContent().add(tableRow); // Round trip wordMLPackage = mdp.convertAltChunks(); wordMLPackage.save(new java.io.File(inputfilepath)); List<Object> tableCells = getAllElementFromObject( wordMLPackage.getMainDocumentPart(), Tc.class); System.out.println(tableCells.size()); /* only one tc in wordMLPackage */ List<Object> paragraphsInTc = getAllElementFromObject( tableCells.get(0), P.class); System.out.println(paragraphsInTc.size()); System.out.println("Ready to create html."); WordprocessingMLPackage wordMLPackage2 = WordprocessingMLPackage .createPackage(); for (Object o : paragraphsInTc) { wordMLPackage2.getMainDocumentPart().addObject(o); } HTMLSettings htmlSettings = Docx4J.createHTMLSettings(); htmlSettings.setWmlPackage(wordMLPackage2); OutputStream os; os = new FileOutp…
tagged with: docx4j
tagged with: http://stackoverflow.com/tag/xhtml
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23786062
tagged with: http://stackoverflow.com/tag/html
has title: Convert docx part to html using docx4j
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23786062
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/36505345
comment on: http://stackoverflow.com/a/23745472
type: AnswerComment
has text: Thanks! In essence, I can basically use it like another server, correct?
score: 0
type: Comment

http://stackoverflow.com/a/23687159
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36394480
has body: Declare into ApplicationContext: &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; In order to use tx declare the following xml namespace: xmlns:tx="http://www.springframework.org/schema/tx" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd This will enable @Transactional annotation. Then annotate with @Transactional your CustomUserDetailsService hope this helps.
score: 1
accepted answer of: http://stackoverflow.com/q/23685490
answers question: http://stackoverflow.com/q/23685490
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36539592
type: Comment
score: 1
has text: Can you reword your question to include a question? Currently it's a statement.
comment on: http://stackoverflow.com/q/23763637
type: QuestionComment

http://stackoverflow.com/comment/36407798
type: Comment
has text: If I might offer my opinion, I believe that you take for granted the difficulty of this topic. As I said, I've found a lot of Google searches on iText questions over the years where you've responded in a way that suggests that you think the question-asker hasn't done research, and I just think to myself, "I have the book right in front of me and I have the same question." It feels like iText is so difficult that could use its own college course or something. I'm just saying, things aren't as obvious as you probably think they are, and the book is fallible. Anyway, still, thank you again.
type: AnswerComment
comment on: http://stackoverflow.com/a/23660849
score: 0

http://stackoverflow.com/comment/36346463
type: AnswerComment
comment on: http://stackoverflow.com/a/23661252
type: Comment
has text: @Giovanni Far: I have updated my answer to tell you how I would do it as it differs from the other suggestions. But it’s up to you to decide which way you want to try.
score: 0

http://stackoverflow.com/comment/36486621
type: AnswerComment
comment on: http://stackoverflow.com/a/23735292
type: Comment
has text: I understand your solution, but the code written here returns false for any image. Can you please provide the correct code?
score: 0

http://stackoverflow.com/comment/36454410
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23718885
has text: In your `Exception` handlers, please print your stack-trace - e.g. `e.printStackTrace();`
score: 0

http://stackoverflow.com/q/23771592
has comment: http://stackoverflow.com/comment/36575930
has body: Adobe has this blending effect in some of their products called "Layer" and it basically achieves what is on the left of this image: When overlapping two transparent images drawn in the same batch, what I get is shown on the right, I'm trying to go for the result on the left. I've never been good with the source/destination blending functions and I'm not even sure if they're the solution to this problem, but if they are, what combination would I need to achieve this effect? For example: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
linked to: http://stackoverflow.com/q/20508259
tagged with: opengl-es
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/36556056
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: libgdx
tagged with: opengl
has title: "Layer blending" with OpenGL
tagged with: java
has comment: http://stackoverflow.com/comment/36556631
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23728525
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23729089
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36473645
tagged with: arrays
has comment: http://stackoverflow.com/comment/36473830
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36473689
has comment: http://stackoverflow.com/comment/36474337
favorite count: 0
has title: Read 2d Array and Transpose
has comment: http://stackoverflow.com/comment/36473744
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36473739
tagged with: transpose
has answer: http://stackoverflow.com/a/23729717
has body: So the purpose of this code is to read a 2d array from a file and transpose it. I know the transpose portion works but I am having trouble reading the array from the file. I continue to get an array out of bounds error. Any help would be great! Thanks! Here is the code and the data file is at the bottom. import java.util.*; import java.io.*; public class prog464d{ public static void main(String args[]) throws IOException{ final int ROWS = 5; final int COLS = 5; int[][] nums = new int[ROWS][COLS]; // this is used only in java 7 (not java 6) try (Scanner input = new Scanner(new File("prog464adat.txt"))) { int row = -1; // since we're incrementing row at the start of the loop while(input.hasNext()) { row++; String[] line = input.nextLine().split("\t"); for(int col = 0; col &lt; COLS; col++) { try { nums[row][col] = Integer.parseInt(line[col]); } catch (NumberFormatException e) { e.printStackTrace(); } } } } catch (FileNotFoundException e) { // do something here System.out.print("File not found!"); e.printStackTrace(); } for (int i = 0; i &lt; nums.length; i++) { for (int j = 0; j &lt; nums[i].length; j++) { System.out.print(nums[i][j] + " "); } System.out.print("\n"); } System.out.print("\n\n matrix transpose:\n"); // transpose if (nums.length &gt; 0) { for (int i = 0; i &lt; nums[0].length; i++) { for (int j = 0; j &lt; nums.length; j++) { System.out.print(nums[j][i] + " "); } System.out.print("\n"); } } } } Data file: 45 67 89 12 -3 -3 -6 -7 -4 -9 96 81 -8 52 12 14 -7 72 29 -1 19 43 28 63 87
tagged with: 2d
has comment: http://stackoverflow.com/comment/36473578

http://stackoverflow.com/comment/36278172
type: Comment
type: QuestionComment
has text: your method MUST ALWAYS return an int. The compiler thinks that there is a probablity that the method might not return an int.
score: 0
comment on: http://stackoverflow.com/q/23627343

http://stackoverflow.com/a/23669156
type: Answer
answers question: http://stackoverflow.com/q/23668476
score: 0
has body: Try to change to os.writeByte(1); os.flush();

http://stackoverflow.com/q/23621654
has comment: http://stackoverflow.com/comment/36267615
has comment: http://stackoverflow.com/comment/36267578
has comment: http://stackoverflow.com/comment/36267618
has comment: http://stackoverflow.com/comment/36267632
has comment: http://stackoverflow.com/comment/36267507
has answer: http://stackoverflow.com/a/23621766
has title: Gradle: Failed to create directory while building jar
tagged with: build
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36267569
has comment: http://stackoverflow.com/comment/36267634
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/36267603
has comment: http://stackoverflow.com/comment/36267604
answer count: 1
accepted answer: http://stackoverflow.com/a/23621766
has comment: http://stackoverflow.com/comment/36267790
has body: I have a multi project gradle build, (Gradle version 1.9). I am running gradle clean build distZip from /vagrant directory. /vagrant is the root project directory. This directory contains another directory my-app. While executing jar task, I see the following error: Failed to create parent directory '/my-app' when creating directory '/my-app/build/tmp/jar' Why is the jar task trying to create my-app under the root directory? It is not getting permission for that. Shouldn't it create under ./my-app/build/tmp/jar? Edit: Add settings.gradle rootProject.name = 'my-app' includeFlat 'my-app-core', 'my-app'
score: 0

http://stackoverflow.com/comment/36323499
score: 0
has text: what happens if you rotate along z only of any other single axis ? Are u using ortho2D ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23648197

http://stackoverflow.com/q/23720240
type: Question
accepted answer: http://stackoverflow.com/a/26033607
tagged with: http://stackoverflow.com/tag/json
has title: fasterxml jackson objectmapper convert string
tagged with: jackson
has comment: http://stackoverflow.com/comment/36457342
has answer: http://stackoverflow.com/a/26033607
has comment: http://stackoverflow.com/comment/36457715
upvote count: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36457576
favorite count: 0
has comment: http://stackoverflow.com/comment/36457287
has body: my string is: json = {"foo":"bar"}{"foo":"bar"} ======================== ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = null; try { final JsonParser jParser = mapper.getFactory().createParser(json); jsonNode = mapper.readTree(jParser); } catch (Exception e) { log.warn("Fail to parse the input json-string: ", e); } ========================= the jackson convert it to : jsonNode = {"foo":"bar"} i want to catch this exception, but it do not throw any exception when it convert
has comment: http://stackoverflow.com/comment/36457638
has comment: http://stackoverflow.com/comment/36505455
score: 2
has comment: http://stackoverflow.com/comment/36457377
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36457357
tagged with: java
linked to: http://stackoverflow.com/q/26003171

http://stackoverflow.com/comment/36487072
type: Comment
comment on: http://stackoverflow.com/a/23735560
score: 0
type: AnswerComment
has text: Thanks, but if I do that, won't I have to save the child object explicitly? Otherwise I get a TransientObjectException on flush(). The parent actually contains several children like this one, most of which are optional, so that means adding a bunch of extra code which I wanted to avoid. Incidentally, the behaviour of collections, using @ElementCollection, seems quite different, they get persisted on a flush without the need for any specific handling at all. Maybe I can just (ab)use a singleton collection?

http://stackoverflow.com/q/23746424
has answer: http://stackoverflow.com/a/23746490
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: multithreading
type: Question
has body: so Im doing a project of a tic tac toe using artificial intelligence, and I wanted to make an option so you could replay the game to see what happend in the last round, My intentions were to make the replay as its actually playing right now, which means after each move will be shown there wil lbe a delay and then the next one will occur.And instead of working as expected the delay jsut goes all at a time without anything happening until suddenyl the whole game just shows up without beinge displayed as a game but as a finishing screen' anyway here is the code: replayMode=true; setStatus("Replay Playing..."); ifButtonsEnabled(true); initBoard(); int turn=0; Move current; for(int i=0;i&lt;replayer.getSizeOfVect();i++) { current=replayer.getMoveAt(i); if(i%2==0) { buttons[current.getI()][current.getJ()].setText("X"); } else { buttons[current.getI()][current.getJ()].setText("O"); } try { Thread.sleep(650); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } setStatus("Replay ended."); replayMode=false;
has title: Delay not working properly, but instead does all the action after a big delay
answer count: 1
tagged with: user-interface
tagged with: delay

http://stackoverflow.com/q/23767449
tagged with: java
has title: Drawing a lot of same objects from a class in JFrame
has comment: http://stackoverflow.com/comment/36547654
has comment: http://stackoverflow.com/comment/36549175
has comment: http://stackoverflow.com/comment/36547333
type: Question
has comment: http://stackoverflow.com/comment/36547700
tagged with: jpanel
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36548171
has comment: http://stackoverflow.com/comment/36547299
tagged with: graphics2d
answer count: 1
has answer: http://stackoverflow.com/a/23767535
has body: Answer is written by me in the bottom of the question I want to get a lot of 'Ates' objects in a frame. I tried a lot of examples but always failed. In this context, I want to see a lot of rectangles which are going to left. However, there is just one and it is going faster and faster... It does not show more than one object at the same time. Can you tell me what is the problem? I used this code: public class GamePanel extends JPanel { public void paint(Graphics g) { super.paint(g); g.setColor(Color.BLACK); for(Ates a1 : StartGame.alist) // alist is an arraylist for Ates class objects { g.fillRect(a1.getX(), a1.getY(), 20, 20); } ... Example creating: public void sentAtes() { r = rand.nextInt(471)+60; Ates a = new Ates(r); alist.add(a); } Ates class: public Ates(int a) { x = 700; y = a; } public int getX() { return x; } public int getY() { return y; } public void setX( int a ) { x = a; } public void setY( int a ) { y = a; } StartGame class: public class StartGame extends JFrame implements KeyListener, ActionListener { protected static ArrayList&lt;Ates&gt; alist = new ArrayList&lt;Ates&gt;(); public static int cen = 0; ... public StartGame() { jp = new GamePanel(); add(jp); ... int delay = 10; ActionListener taskPerformed = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cen++; if(cen &gt; 50) { cen = 0; sentAtes(); } for(Ates a1 : alist) { a1.setX(a1.getX()-1); } repaint(); } }; new Timer(delay,taskPerformed).start(); ... Info: If there is only one object, it is going left as expected. Answer to my question. In Ates class, you should not use static word for variables and use this. prefix to set them. This should be work. public class Ates extends JFrame { protected int x; protected int y; public Ates(int a) { this.x = 700; this.y = a; }
has comment: http://stackoverflow.com/comment/36547914
has comment: http://stackoverflow.com/comment/36547854
has comment: http://stackoverflow.com/comment/36547327
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36548383

http://stackoverflow.com/comment/36540652
type: AnswerComment
has text: Look throw my update. I want to start `SSBirthActivity` from `MainActivity`
type: Comment
comment on: http://stackoverflow.com/a/23763985
score: 0

http://stackoverflow.com/comment/36477587
comment on: http://stackoverflow.com/q/23730325
score: 0
type: Comment
has text: Is dom is good to create dynamice xml or anything else is better than this ?
type: QuestionComment

replication
tags question: http://stackoverflow.com/q/23633715
tag name: replication
type: Tag

http://stackoverflow.com/comment/36279952
comment on: http://stackoverflow.com/q/23628338
type: QuestionComment
type: Comment
score: 2
has text: When you were asking your question, there was a big orange **How to Format** box to the right, a preview area underneath, and an entire toolbar of formatting buttons. Taking the time to see things are well formatting is only polite when asking for help. (Looks like 'hewo' fixed it for you on this occasion.)

http://stackoverflow.com/q/23654830
has answer: http://stackoverflow.com/a/23679712
has body: Using Java 1.6.0_45 with G1 I have one of my application that run almost indefinitely G1 collector. Beside that seems to waste some CPU it also fill my gc log pretty fast at the lowest setting I could find. I'm wondering what's going on here. Is it normal? These are my JVM flags: -XX:ParallelGCThreads=4 -XX:+DisableExplicitGC -XX:+PrintAdaptiveSizePolicy -XX:MaxGCPauseMillis=500 -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:+UseCompressedOops -XX:InitiatingHeapOccupancyPercent=60 -XX:+UseG1GC -XX:+PrintGCDateStamps -XX:HeapDumpPath=JavaLogs\uat -XX:+HeapDumpOnOutOfMemoryError -Xloggc:jvm.log -XX:+PrintGC 2014-05-14T08:22:11.173-0400: 495.992: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0178429 secs] 2014-05-14T08:22:11.188-0400: 496.011: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0085317 secs] 2014-05-14T08:22:11.188-0400: 496.021: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0022702 secs] 2014-05-14T08:22:11.204-0400: 496.025: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0028976 secs] 2014-05-14T08:22:11.204-0400: 496.029: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0021763 secs] 2014-05-14T08:22:11.204-0400: 496.032: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0020172 secs] 2014-05-14T08:22:11.204-0400: 496.035: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0020475 secs] 2014-05-14T08:22:11.219-0400: 496.039: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0022187 secs] 2014-05-14T08:22:11.219-0400: 496.042: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0020149 secs] 2014-05-14T08:22:11.219-0400: 496.045: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0021635 secs] 2014-05-14T08:22:11.219-0400: 496.049: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0019517 secs] 2014-05-14T08:22:11.219-0400: 496.052: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0022797 secs] 2014-05-14T08:22:11.235-0400: 496.055: [GC pause (partial) 1177M-&gt;1176M(2000M), 0.0020060 secs] 2014-05-14T08:22:11.235-0400: 496.058: [GC pause (partial) 1177M-&gt…
tagged with: java
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23678648
tagged with: g1gc
has answer: http://stackoverflow.com/a/23655111
has title: G1 Collector execute 50 times per seconds
tagged with: jvm
type: UnansweredQuestion
tagged with: garbage-collection

http://stackoverflow.com/q/23658597
has answer: http://stackoverflow.com/a/23658918
has body: I was going through data structures in java under the topic Skip list and I came across the following: In a skip list of n nodes, for each k and i such that 1 ≤ k ≤lg n and 1 ≤ i ≤ n/2k–1⎦ – 1, the node in position 2k–1 · i points to the node in position 2k–1 · (i + 1). This means that every second node points to the node two positions ahead, every fourth node points to the node four positions ahead, and so on, as shown in Figure 3.17a. This is accomplished by having different numbers of reference fields in nodes on the list: Half of the nodes have just one reference field, one-fourth of the nodes have two reference fields, one-eighth of the nodes have three reference fields, and so on. The number of reference fields indicates the level of each node, and the number of levels is maxLevel = ⎣lg n⎦ + 1. And the figure is : A skip list with (a) evenly and (b) unevenly spaced nodes of different levels; (c) the skip list with reference nodes clearly shown. I don't understand the mathematical part and what exactly the sktip list is and even nodes?
score: 5
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36339410
favorite count: 0
accepted answer: http://stackoverflow.com/a/23658918
has comment: http://stackoverflow.com/comment/36340014
tagged with: skip-lists
has comment: http://stackoverflow.com/comment/36363902
has comment: http://stackoverflow.com/comment/36340466
has comment: http://stackoverflow.com/comment/36339836
type: Question
has title: Skip list in java
type: AnsweredQuestion
upvote count: 5
tagged with: java

http://stackoverflow.com/a/24632008
score: 1
answers question: http://stackoverflow.com/q/23731680
accepted answer of: http://stackoverflow.com/q/23731680
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: I think i found what i was looking for: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7077696 The suggested workaround there works for me. 2011-11-09 WORK AROUND Run with -Djava.net.preferIPv4Stack=true Thanks for your help!

http://stackoverflow.com/a/23714841
answers question: http://stackoverflow.com/q/23713701
upvote count: 2
type: Answer
has body: This imprecision is likely caused because box2d does all calculations in discrete steps, so in each step, a body will move a certain distance all at once, as opposed to continuously. Since your character is exactly the width of the gap, it's highly unlikely it will ever be at a point where it fits exactly between that gap. A good resource to look into how exactly box2d handles collisions can be found here at iforce2d.net. As is shown in that tutorial, collisions are never exact for normal bodies, during a collision, two bodies will instead slightly overlap, which may be what's causing your buggy movement since the gap is exactly the width of the character trying to enter it. Now, to solve this, you could try making your character a bullet. Collisions are much more accurate for bullet bodies, and this may be able to help with your issue. Alternatively, you could increase the number of iterations during each world step for the solver, which will make everything more precise. //Increase velocityIterations and positionIterations for increased precision //Decreasing the timeStep could also help, but that would slow down everything as well b2World.step(timeStep, velocityIterations, positionIterations); However, it's likely you'll have to resort to either very slightly widening the gap, or very slightly decreasing the width of your character, as getting something that exact with a physics engine that works in discrete steps doesn't seem like it will ever work out 100% of the time.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23713701
type: AcceptedAnswer

http://stackoverflow.com/a/23733245
downvote count: 0
has body: Following 2 environment works for me. You can also try it: export LANG=en_US.UTF-8 export LOCALE=UTF-8
type: Answer
has comment: http://stackoverflow.com/comment/36483635
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23733166
score: 1
has comment: http://stackoverflow.com/comment/36567218
answers question: http://stackoverflow.com/q/23733166
type: AcceptedAnswer

http://stackoverflow.com/comment/36268277
has text: This is not an answer. This is not even an intelligible comment.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23622045
type: Comment

http://stackoverflow.com/comment/36411006
type: Comment
type: QuestionComment
has text: Ahhh, the power of the minimal example :-) Good luck bug hunting.
score: 0
comment on: http://stackoverflow.com/q/23696157

http://stackoverflow.com/q/23735181
has comment: http://stackoverflow.com/comment/36489188
score: 0
has answer: http://stackoverflow.com/a/23735379
has title: Strange behavior of Struts2 Type conversion for java.util.Date class
has comment: http://stackoverflow.com/comment/36485597
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36490676
has comment: http://stackoverflow.com/comment/36527407
has comment: http://stackoverflow.com/comment/36488227
tagged with: java
tagged with: hibernate
tagged with: mysql
tagged with: date
type: Question
has body: I am using struts2 Framework and Hibernate ORM I am initializing one model class object by getting values from database. There is one property named abc1 of data type java.util.Date in model class that is corresponding to one field named abc2 with data type DATETIME in database There is no problem of getting value form database but it is coming different(appending extra characters). For example - In database if column abc2's value is 2007-11-13 11:24:00 then its value is coming as 2007-11-13 11:24:00.0 (dot zero) in abc1 variable of model class I have debugged by code, it is showing following values for abc1 variable fasttime is datetime in millisecons, but what is cdate and nanos? Is it some encoding issue?
answer count: 2
has comment: http://stackoverflow.com/comment/36485481
has comment: http://stackoverflow.com/comment/36527188
has answer: http://stackoverflow.com/a/23754363
has comment: http://stackoverflow.com/comment/36525018
tagged with: struts2

http://stackoverflow.com/comment/36300180
score: 0
has text: Can you insert the code where you create your input stream? Also have you done any checking to see what those 16 bytes are and see if they line up with the first 16 bytes of the image file?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23638552

http://stackoverflow.com/comment/36497629
comment on: http://stackoverflow.com/a/23739067
type: AnswerComment
type: Comment
has text: The point I was trying to make was that the method is rather long, combining both the outline of the algorithm as well as the implementation of various steps. However, I agree that the example is not the best since it introduces these methods with side-effects. It seems though that the call to `saveToken(request)` needs to be done before this method returns a value, so ideally we would wrap this whole method in a different method that enforces this behavior.
score: 1

http://stackoverflow.com/comment/36377655
type: Comment
comment on: http://stackoverflow.com/a/23678353
has text: see edit. The ID acts as a unique identifier that is incremented with each insert.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36458763
comment on: http://stackoverflow.com/a/23721150
type: Comment
has text: I don't think so, in each step, it chooses uniformly random number from those not chosen yet. But the description sucks, i know :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/23869181
score: 0
answers question: http://stackoverflow.com/q/23672205
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23672205
type: Answer
has body: As no volunteers out there, let me document what I ended up with. I decided to go for the solution suggested in the question and live with the warning in my junit tests.

http://stackoverflow.com/q/23673122
tagged with: java
tagged with: date
type: Question
score: 5
answer count: 1
accepted answer: http://stackoverflow.com/a/23673525
tagged with: datetime
favorite count: 0
upvote count: 5
downvote count: 0
has body: I only have a date string, and I want to see the time in other TimeZone by it. So I did it like that: String dateStr = "2014-05-15 16:14:58 PM"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a"); sdf.setTimeZone(TimeZone.getTimeZone("America/Denver")); Date date = sdf.parse(dateStr); System.out.println(date); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a"); System.out.println(sdf1.format(date)); This is the current TimeZone in my computer: The result that the code ran was that: Fri May 16 06:14:58 CST 2014 2014-05-16 06:14:58 AM The result is wrong, I had the right result by changing the TimeZone to "America/Denver" in my computer, and I saw that: America/Denver —— 2014-05-15 02:14:58 AM I don't know why it likes that? But if I had a Date not a date String, I do that : public static String getFormatedDateString(String _timeZone) { TimeZone timeZone = null; if (StringUtils.isEmpty(_timeZone)) { timeZone = TimeZone.getDefault(); } else { timeZone = TimeZone.getTimeZone(_timeZone); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a"); sdf.setTimeZone(timeZone); // TimeZone.setDefault(timeZone); return sdf.format(new Date()); } System.out.println("America/Denver —— " + getFormatedDateString("America/Denver")); The result likes that: ------Asia/Shanghai------ 2014-05-15 16:32:04 PM (current date) America/Denver —— 2014-05-15 02:32:04 AM This result is right. So I was confused, I could't find the problem when I just have a date string and I want to know the time of other TimeZone. Could any body help me?
has answer: http://stackoverflow.com/a/23673525
tagged with: timezone
has title: Get the time of other TimeZone by date string, the result is wrong
type: AnsweredQuestion

http://stackoverflow.com/q/23756962
has answer: http://stackoverflow.com/a/23757123
has body: I want to read some values from properties file like that SPAN_NUMBER=2 when I get the span_number, I have to convert it into integer. try { int i=Integer.parseInt(rsBundle.getString("SPAN_NUMBER")); }catch(Exception e) { i=0; } It working successfully. But in case if SPAN_NUMBER=0(Zero), it will throw number format exception. I have to pass this number as integer somewhere. When I pass hardcode value as '0'. It will run successfully. But I want to pass this value from properties file. Help me !
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36527144
has comment: http://stackoverflow.com/comment/36527936
has comment: http://stackoverflow.com/comment/36526956
has title: Number format exception Converting Zero string to integer
answer count: 1
accepted answer: http://stackoverflow.com/a/23757123
has comment: http://stackoverflow.com/comment/36526994
score: 0

vorbis
tag name: vorbis
tags question: http://stackoverflow.com/q/23701339
type: Tag

http://stackoverflow.com/comment/36468240
type: QuestionComment
has text: Just store the value in a variable.
comment on: http://stackoverflow.com/q/23725952
score: 0
type: Comment

http://stackoverflow.com/comment/36425711
type: QuestionComment
has text: Possibly related questions at http://stackoverflow.com/questions/20832793/java-get-heap-dump-without-jmap-or-without-hanging-the-application?rq=1 and http://stackoverflow.com/questions/5287010/is-jvm-stopped-while-executing-jmap?rq=1
score: 1
comment on: http://stackoverflow.com/q/23703784
type: Comment

http://stackoverflow.com/comment/36355574
type: AnswerComment
score: 0
type: Comment
has text: @LuiggiMendoza: I don't think byoigres is at all suggesting that OP parse HTML using regular expressions. They are suggesting that replacing a string in a well-defined position is a valid use case for RegExp, which it is.
comment on: http://stackoverflow.com/a/23665838

http://stackoverflow.com/comment/36563857
comment on: http://stackoverflow.com/q/23757526
has text: There is a Hindi rbnf data but the names are in Hindy, meaning that `new RuleBasedNumberFormat( new Locale( "hi" ), RuleBasedNumberFormat.SPELLOUT )` displays a string that looks like `nine lakhs` but in Hindi. As far as i can tell the Icu4j has no ready to use rbnf data that contains lakh cardinal spelled in english.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36499656
comment on: http://stackoverflow.com/a/23742606
has text: I don't really know what to add to my method in the PresentatieDao. Do you have any idea? I just use the find method from EntityManager..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36323517
type: AnswerComment
score: 0
has text: Oh.. then you need to fall back to concatenation of JPQL by yourself like BheshGurung suggested, although this is not going to be easy. You need to pay attention to SQL injection vulnerability issues. Also, actually, the most proper way after all would be to rethink your model and have a ElementCollection association (separate table for keywords like @Arkadiry suggested). This would be WAY more efficient and much easier to implement.
type: Comment
comment on: http://stackoverflow.com/a/23640806

http://stackoverflow.com/a/23745175
score: 5
accepted answer of: http://stackoverflow.com/q/23745089
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36504501
type: Answer
has comment: http://stackoverflow.com/comment/36505021
answers question: http://stackoverflow.com/q/23745089
has body: You can try this: String sr[] = s.split("\\s+--\\s+"); Putting "\\s+" will take in an arbitrary number of spaces, instead of just " " which is just one space (if you want just the space character to be taken into account, replace \\s with a litteral space character). If you want to avoid all emply elements in the array, try: String sr[] = s.split("\\s+(--\\s+)+"); Having (--\\s+)+ means that even if the pattern is repeated, it removes them all.
upvote count: 5
has comment: http://stackoverflow.com/comment/36504834

http://stackoverflow.com/q/23640227
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36303556
type: Question
has title: How does GMT IDs work in Java TimeZone?
accepted answer: http://stackoverflow.com/a/23643847
has body: I'm currently working with different time zones, using java.util.TimeZone. First thing I did was to get a list of TimeZone IDs, using TimeZone.getAvailableIDs(); It returned a bunch of Etc/GMT IDs, such as Etc/GMT Etc/GMT+0 Etc/GMT+1 The Javadoc for TimeZone says to use "For example, GMT+10 and GMT+0010" To make sure I was using the correct one, I made a small test with both IDs, and the results didn't match what I was expecting: String id = "GMT-1"; Calendar c = Calendar.getInstance(TimeZone.getTimeZone(id)); System.out.println(id + '\n' + c.getTimeZone().getDisplayName() + " HOUR_OF_DAY " + c.get(Calendar.HOUR_OF_DAY) + '\n'); id = "GMT+1"; c = Calendar.getInstance(TimeZone.getTimeZone(id)); System.out.println(id + '\n' + c.getTimeZone().getDisplayName() + " HOUR_OF_DAY " + c.get(Calendar.HOUR_OF_DAY) + '\n'); id = "Etc/GMT-1"; c = Calendar.getInstance(TimeZone.getTimeZone(id)); System.out.println(id + '\n' + c.getTimeZone().getDisplayName() + " HOUR_OF_DAY " + c.get(Calendar.HOUR_OF_DAY) + '\n'); id = "Etc/GMT+1"; c = Calendar.getInstance(TimeZone.getTimeZone(id)); System.out.println(id + '\n' + c.getTimeZone().getDisplayName() + " HOUR_OF_DAY " + c.get(Calendar.HOUR_OF_DAY) + '\n'); Shows me the output GMT-1 GMT-01:00 HOUR_OF_DAY 18 GMT+1 GMT+01:00 HOUR_OF_DAY 20 Etc/GMT-1 GMT+01:00 HOUR_OF_DAY 20 Etc/GMT+1 GMT-01:00 HOUR_OF_DAY 18 So my question is: What are these Etc/GMT IDs for? Why would they give me -X when I used +X and vice versa?
linked to: http://stackoverflow.com/q/7303580
answer count: 1
downvote count: 0
favorite count: 0
tagged with: timezone
has answer: http://stackoverflow.com/a/23643847
type: AnsweredQuestion

http://stackoverflow.com/q/23725713
has comment: http://stackoverflow.com/comment/36467619
has comment: http://stackoverflow.com/comment/36467611
has comment: http://stackoverflow.com/comment/36467622
has comment: http://stackoverflow.com/comment/36467683
answer count: 3
downvote count: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/36545973
accepted answer: http://stackoverflow.com/a/23725726
has title: Why does order in method declaration matter?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23725726
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23725730
favorite count: 0
has answer: http://stackoverflow.com/a/23725730
has comment: http://stackoverflow.com/comment/36467638
type: Question
has answer: http://stackoverflow.com/a/23725756
has body: I didn't notice before until unconsciously misplaced void with main. public static main void (String[] args){ } Why does it give me an error?

http://stackoverflow.com/comment/36358394
type: Comment
score: 0
type: AnswerComment
has text: But I can't have an instance of CustomerTransaction because it is an abstract class.
comment on: http://stackoverflow.com/a/23644078

http://stackoverflow.com/comment/36479338
has text: The only thing I can think of is that you are using `127.0.0.1` in your security file and `localhost` in your code. If the JVM checks the permissions *before* resolving the name, it might be the issue.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23731680

http://stackoverflow.com/q/23623557
type: UnansweredQuestion
tagged with: jmeter
tagged with: java
tagged with: ssl
type: Question
has answer: http://stackoverflow.com/a/23629674
has title: JMeter and https
score: 0
answer count: 1
has body: I am trying to setup JMeter to test Web services running on Weblogic. The web service is served with https. When I run my tests on Weblogic console I get: &lt;13 May.2014 07.36 CEST&gt; &lt;Warning&gt; &lt;Security&gt; &lt;BEA-090476&gt; &lt;Invalid/unknown SSL header was received from peer myname.company.com - 192.168.0.1 during SSL handshake.&gt; I guess I need to set up something on Jmeter side. I dont exactly know what and how. Any tips? On Jmeter website: To test a web server using SSL encryption (HTTPS), JMeter requires that an implementation of SSL be provided, as is the case with Sun Java 1.4 and above. If your version of Java does not include SSL support, then it is possible to add an external implementation. Include the necessary encryption packages in JMeter's classpath . Also, update system.properties to register the SSL Provider. Running on Windows 7, how do I find out which ssl provider I need? How do I check if my java includes SSL? I have got JDK 6,7 and 8 and testing with the latest one, i.e. 8. UPDATE The previous error was because JMeter used SSLv2 and Weblogic does not support it. After changing it to SSLv3 in JMeter, I am getting this error: &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;71030870 SSL3/TLS MAC&gt; &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;71030870 received HANDSHAKE&gt; &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;HANDSHAKEMESSAGE: ClientKeyExchange RSA&gt; &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;Using JCE Cipher: SunJCE version 1.6 for algorithm RSA&gt; &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version 1.6 for algorithm HmacMD5&gt; &lt;13.mai.2014 kl 10.19 CEST&gt; &lt;Debug&gt; &lt;SecuritySSL&gt; &lt;BEA-000000&gt; &lt;Will use default Mac for algorithm …

http://stackoverflow.com/comment/36485457
type: QuestionComment
score: 1
has text: If you want to compare the decimal representation and look for repeats for example, just leave it as a String of digits and compare sections e.g. by using a NavigableSet to sort similar sections together.
comment on: http://stackoverflow.com/q/23734998
type: Comment

http://stackoverflow.com/a/23713424
has comment: http://stackoverflow.com/comment/36454061
has comment: http://stackoverflow.com/comment/36455786
has comment: http://stackoverflow.com/comment/36453889
has body: I haven't downloaded your project. What people mostly struggle with when writing OBJ import code for rendering with OpenGL is the indices. And as @ratched_freak also suspects in his comment, that's very consistent with the visual appearance of your cube. The OBJ format uses separate indices for positions, normals, and texture coordinates. For OpenGL rendering, you need a single set of indices. This means that you need to generate a vertex for each unique combination of position/normal/texture indices used by triangles in the OBJ file, assign a new index to the combination, and then use that index in your OpenGL index buffer. I wrote an answer with pseudo-code that outlines how to do this for a similar question recently: OpenGL - Index buffers difficulties. Edit, to illustrate the problem some more. Here is a "cube" file I found online: v 0.0 0.0 0.0 v 0.0 0.0 1.0 v 0.0 1.0 0.0 v 0.0 1.0 1.0 v 1.0 0.0 0.0 v 1.0 0.0 1.0 v 1.0 1.0 0.0 v 1.0 1.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 -1.0 vn 0.0 1.0 0.0 vn 0.0 -1.0 0.0 vn 1.0 0.0 0.0 vn -1.0 0.0 0.0 f 1//2 7//2 5//2 f 1//2 3//2 7//2 f 1//6 4//6 3//6 f 1//6 2//6 4//6 f 3//3 8//3 7//3 f 3//3 4//3 8//3 f 5//5 7//5 8//5 f 5//5 8//5 6//5 f 1//4 5//4 6//4 f 1//4 6//4 2//4 f 2//1 6//1 8//1 f 2//1 8//1 4//1 The file has 8 positions (v records) and 6 normal (vn records). The f records are faces, triangles in this case. Looking at the first triangle vertex, 1//2 tells you that the vertex uses position 1 and normal 2. When using OpenGL index arrays, you can't have separate indices for positions and normals. So we create a vertex for this position/normal pair, and assign it the first available index. Same for 7//2 and 5//2, so we now have 3 OpenGL vertices (indices 0, 1, and 2). Now on the second triangle, we find 1//2 again. We already created a vertex for this combination, so we can use our vertex 0 again. 3//2 is new, so we create a new vertex (index 3) for it. 7//2 we saw previously, it's the same as our vertex 1. So we ended up with 4 …
score: 6
has comment: http://stackoverflow.com/comment/36453997
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/36455373
answers question: http://stackoverflow.com/q/23710829
has comment: http://stackoverflow.com/comment/36453782
accepted answer of: http://stackoverflow.com/q/23710829
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36559273
has text: D= A + AC*cos(angle). I think that angle is 30 degree => D = A + AC/2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23772990
score: 0

http://stackoverflow.com/a/23746813
type: AcceptedAnswer
has body: First, you are trying to call a static method while your Java methods are non static. Replace ajo.CallStatic("someMethod") with ajo.Call("someMethod") Second, by using new AndroidJavaObject("com.mycompany.mygame.MainActivity") you are creating a new instance of MainActivity. We'll handle this in a bit AndroidJavaClass vs. AndroidJavaObject AndroidJavaObject will create a new instance of the given class. AndroidJavaClass will not create a new instance and you can access static methods and fields Call methods in your current activity AndroidJavaClass playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject curActivity = playerClass.GetStatic&lt;AndroidJavaObject&gt;("currentActivity"); curActivity.Call("showAd");
has comment: http://stackoverflow.com/comment/36508378
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36508668
answers question: http://stackoverflow.com/q/23745918
score: 4
has comment: http://stackoverflow.com/comment/36507705
accepted answer of: http://stackoverflow.com/q/23745918

http://stackoverflow.com/q/23681501
has answer: http://stackoverflow.com/a/23690047
tagged with: bamboo
upvote count: 2
has comment: http://stackoverflow.com/comment/36386493
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23690047
type: Question
tagged with: mockito
answer count: 1
has title: Junit test fails when run on package, but success when run on file
favorite count: 0
has comment: http://stackoverflow.com/comment/36474174
tagged with: junit
has body: Big update: Has anyone run into this before? I'm using JUnit 4.5 and Mockito 1.7 in a Maven project. I have testCaseA.java in package testCaseFolder. if I open testCaseA.java, right click in the code, select "Run as" -"Junit test" it is okay. But if I right click package, select "Run as" -"Junit test", it will fail: org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Misplaced argument matcher detected! Somewhere before this line you probably misused Mockito argument matchers. For example you might have used anyObject() argument matcher outside of verification or stubbing. Here are examples of correct usage of argument matchers: when(mock.get(anyInt())).thenReturn(null); doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject()); verify(mock).someMethod(contains("foo")); at testCaseA.setUP(testCaseA.java:33) Line 33 is: //MockitoAnnotations.initMocks(this);***//it said this is error*** Here is the code: SomeService service; @Mock private CommonService commonService; @Mock public Errors errors; @Before public void setUp() { MockitoAnnotations.initMocks(this);***//it said this is error*** } @Test public void testvalidate() { //fail even here is empty }

http://stackoverflow.com/q/23750594
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36537617
has title: OpenFilesHandler no longer works in Mac OS X
has comment: http://stackoverflow.com/comment/36536510
answer count: 0
has comment: http://stackoverflow.com/comment/36558898
has comment: http://stackoverflow.com/comment/36558700
tagged with: java
has body: I have a Java Webstart application that has a file association in it. It used to be able to open files by double-clicking on it in Mac OS X via the deprecated API. That no longer works, so I upgraded my code to the new non-deprecated API but that doesn't work either! Here is my code: Application application = Application.getApplication(); application.setOpenFileHandler(new OpenFilesHandler() { public void openFiles(OpenFilesEvent e) { System.out.println("OpenFileHandler()"); } }); application.setAboutHandler(new AboutHandler() { public void handleAbout(AboutEvent e) { System.out.println("AboutHandler()"); } }); When I run my application with the above code, I can receive "AboutHandler()" prints fine, but I can never receive "OpenFileHandler()" prints. When I double-click on a file, Mac OS X brings my application to front, but it does not send any OpenFilesEvent events to it. I'm using Java 7 update 55 on Mac OS X 10.9.2 Could anyone get OpenFileHandler to work in Java 7? Am I doing something wrong? Is this a Java bug?
type: Question
has comment: http://stackoverflow.com/comment/36557956
has comment: http://stackoverflow.com/comment/36558000
has comment: http://stackoverflow.com/comment/36555183
tagged with: java-web-start
has comment: http://stackoverflow.com/comment/36558065
has comment: http://stackoverflow.com/comment/36558677
has comment: http://stackoverflow.com/comment/36558194
has comment: http://stackoverflow.com/comment/36560154
has comment: http://stackoverflow.com/comment/36558654
has comment: http://stackoverflow.com/comment/36560391
has comment: http://stackoverflow.com/comment/36558705
score: 2
has comment: http://stackoverflow.com/comment/36559076
downvote count: 0
has comment: http://stackoverflow.com/comment/36558444
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/36560204
has comment: http://stackoverflow.com/comment/36520096
upvote count: 2
has comment: http://stackoverflow.com/comment/36558903

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23656982
type: Tag
tags question: http://stackoverflow.com/q/23732236

http://stackoverflow.com/q/23732759
has comment: http://stackoverflow.com/comment/36482288
has comment: http://stackoverflow.com/comment/36481816
tagged with: rollback
type: UnansweredQuestion
has body: I have a problem. I have this function: public boolean insertOrgToAlign(OrganizationData orgData) { try { if (eManager.find(ScOrgNotAligned.class, orgData.getOrganizationCode()) == null) { ScAdminGroup rootByOrg = null; AdminGroupBean admGrp = null; try { rootByOrg = adminGroupServices.getRootAdminGroupByOrg(orgData.getOrganizationCode()); } catch (NoResultException e) { logger.debugT("insertOrgToAlign(..) - org to align has no root"); return false; } catch (NonUniqueResultException e) { logger.debugT("insertOrgToAlign(..) - org to align has more than one root"); admGrp = new AdminGroupBean(); admGrp.setAdmGroupId(-1); admGrp.setAdmGroupName("ERROR"); ScOrgNotAligned scOrgNotAlig = new ScOrgNotAligned(orgData, admGrp); eManager.persist(scOrgNotAlig); logger.debugT("insertOrgToAlign(..) - persist org to adjust manually : " + orgData.getOrganizationName()); return true; } admGrp = new AdminGroupBean(rootByOrg); ScOrgNotAligned scOrgNotAlig = new ScOrgNotAligned(orgData, admGrp); //************************** //THIS IS THE WRONG LINE???? eManager.persist(scOrgNotAlig); //************************** logger.debugT("insertOrgToAlign(..) - persist org to align : " + orgData.getOrganizationName()); } else { logger.debugT("insertOrgToAlign(..) - org to align already exists in db : " + orgData.getOrganizationName()); } } catch (Exception e) { logger.traceThrowableT(Severity.ERROR, e.getMessage(), e); return false; } return true; } If I comment the eManager.persist(scOrgNotAlig); line, the function write right in the DB; if I uncomment the line, the function causes a rollback at the time it go to write in the DB. The stacktrace of the exception is: (Failed in component: sap.com/tc~ejbexplorer~ear, BC-JAS-EJB) nested exception is: com.sap.engine.services.ts.exceptions.BaseRollbackException: Exception in beforeCompletion of ( JTA Transaction : 45491 ). Why? Any ideas?
has comment: http://stackoverflow.com/comment/36482331
answer count: 0
tagged with: java
tagged with: mysql
has title: Java persist operation causes everytime a rollback in the MySQL DB
type: Question
tagged with: jpa
tagged with: persist
score: 0
has comment: http://stackoverflow.com/comment/36481663

http://stackoverflow.com/comment/36459159
comment on: http://stackoverflow.com/a/23720789
score: 0
type: AnswerComment
has text: I mean that the difference between 143ps and 25fps would be unnoticeable give your current requirements, most monitors refresh at about 25mzh anyway. You're `Timer` is updating to much which could actually cause a issues in it's ability to process changes to the state of the game between refreshes. I've had 10, 000 animated objects paint on a screen @ 25fps without issues ;)
type: Comment

http://stackoverflow.com/comment/36405633
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23692732
score: 0
has text: Hello You may need to study some 'while' 'for' loops a little bit more.

http://stackoverflow.com/a/23764642
upvote count: 1
answers question: http://stackoverflow.com/q/23757231
downvote count: 0
has comment: http://stackoverflow.com/comment/36568825
type: Answer
has body: My idea is to manipulate LatLngBounds since its representing all included markers to be viewed in aligned rectangle on the map. So we just need to recognise all points that make current location will be viewed at the center of map. Put all markers into the bound. Move camera to your current location as center point. Get 4 locations of all corners of the current map and put it together in list of point in the bound. this is my sample: LatLngBounds.Builder builder = new LatLngBounds.Builder(); Marker myLocation = mMap.addMarker(new MarkerOptions() .position(new LatLng(2.6,101.5)) .title("My-Current-Location")); Marker addMarker1 = mMap.addMarker(new MarkerOptions() .position(new LatLng(2.6,101)) .title("Hello world-1")); Marker addMarker2 = mMap.addMarker(new MarkerOptions() .position(new LatLng(2.7,101)) .title("Hello world-2")); Marker addMarker3 = mMap.addMarker(new MarkerOptions() .position(new LatLng(3.7,105)) .title("Hello world-3")); builder.include(myLocation.getPosition()); builder.include(addMarker1.getPosition()); builder.include(addMarker2.getPosition()); builder.include(addMarker3.getPosition()); //haha enough to use for loop for all your markers int padding = 100; // offset from edges of the map in pixels CameraUpdate cameraUpdate =CameraUpdateFactory.newLatLngBounds(builder.build(), padding); mMap.moveCamera(cameraUpdate); mMap.moveCamera(CameraUpdateFactory.newLatLng(myLocation.getPosition())); LatLng nrLatLng = mMap.getProjection().getVisibleRegion().nearRight; LatLng frLatLng = mMap.getProjection().getVisibleRegion().farRight; LatLng nlLatLng = mMap.getProjection().getVisibleRegion().nearLeft; LatLng flLatLng = mMap.getProjection().getVisibleRegion().farLeft; builder.include(nrLatLng); builder.include(frLatLng); builder.include(nlLatLng); builder.include(flLatLng); cameraUpdate =CameraUpdateFactory.newLatLngBounds(builder.build(), padding); mMap.animateCamera(cameraUpdate);
score: 1

http://stackoverflow.com/comment/36405767
score: 0
type: Comment
has text: @user3310291 you're welcome. Also, check the update on my answer.
comment on: http://stackoverflow.com/a/23692708
type: AnswerComment

http://stackoverflow.com/q/23676123
favorite count: 0
tagged with: spring-batch
has answer: http://stackoverflow.com/a/23678325
has title: Configuring SpringBatch with Nosql
linked to: http://stackoverflow.com/q/20789731
tagged with: marklogic
has body: We need to use spring batch in an application which already uses a NoSQL product (MarkLogic). I know that as a pre-requisite spring-batch uses some relational tables for infrastructure management and monitoring like batch status etc. Does spring-batch provide a way via which we can configure it to work with NoSQL products like this?
has answer: http://stackoverflow.com/a/23676505
upvote count: 3
type: UnansweredQuestion
score: 3
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/36294210
comment on: http://stackoverflow.com/a/23632565
score: 0
type: AnswerComment
type: Comment
has text: Ah! It looks like these links don't contain information about the branch that the file is in. In this case examples/tptp/tptp5.cpp is in the unstable branch, but not available in the master branch (yet).

http://stackoverflow.com/comment/36279671
comment on: http://stackoverflow.com/a/23625652
score: 0
type: AnswerComment
has text: i get the resized image : resizedImage =resizeImage(extractedImage, type ,w*2 , h*2) and i set its dpi to 150dpi for example
type: Comment

http://stackoverflow.com/comment/36467906
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23725754
has text: @Emmanuel The service does contain code to talk to a server, but this code isn't used until you press the login button.

http://stackoverflow.com/q/23731979
has answer: http://stackoverflow.com/a/23928640
downvote count: 0
has body: Given JGroups’ seeming default to using multicast, I'm wondering if it's purpose is to coordinate a cluster of hosts/nodes locally in a LAN. Or is JGroups practical for coordinating across the internet such as between servers housed in coloslocated in different geographical regions?
accepted answer: http://stackoverflow.com/a/23928640
tagged with: cluster-computing
type: Question
tagged with: jgroups
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0
has title: Is JGroups intended for local use only (LANs), or can it coordinate hosts across the internet?
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/23646051
downvote count: 0
has comment: http://stackoverflow.com/comment/36314841
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23645988
has body: in if else notation, this is what it means: if(values.get("photospath") == null ) { servicesDto.setPhotospath(null); }else { servicesDto.setPhotospath(values.get("photospath").toString()); }

http://stackoverflow.com/q/23765543
has answer: http://stackoverflow.com/a/23767309
accepted answer: http://stackoverflow.com/a/23767309
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23784657
has comment: http://stackoverflow.com/comment/36543515
tagged with: jtable
score: 0
answer count: 2
has body: Any suggestions on how to add another row to a JTable once the last column has lost focus, accounting for movable columns? Note: The table is populated by user input but I would only like to show a new empty row once the current row is filled out.
has comment: http://stackoverflow.com/comment/36544033
has answer: http://stackoverflow.com/a/23784657
has comment: http://stackoverflow.com/comment/36543651
has title: Add a row to JTable once the last cell has lost focus
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/36285470
has text: Please read the tutorial.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23631228

http://stackoverflow.com/comment/36286239
type: Comment
has text: I'm not fully understand what you mean, but tracking if a frame is visible using a windowfocuslistener is not correct, cause a frame can be visible (in front of another window) when i hasn't the focus, cause another frame can have the focus.
type: AnswerComment
comment on: http://stackoverflow.com/a/23630460
score: 0

http://stackoverflow.com/q/23617590
upvote count: 5
answer count: 5
has answer: http://stackoverflow.com/a/23619670
has comment: http://stackoverflow.com/comment/36260271
has title: Threading and Concurrency Within A Servlet
tagged with: multithreading
has answer: http://stackoverflow.com/a/23617832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23617759
has comment: http://stackoverflow.com/comment/36281317
has answer: http://stackoverflow.com/a/23618403
downvote count: 0
accepted answer: http://stackoverflow.com/a/23618403
tagged with: java
has comment: http://stackoverflow.com/comment/36263803
tagged with: concurrency
has body: I have a web application that retrieves a (large) list of results from the database, then needs to pare down the list by looking at each result, and throwing out "invalid" ones. The parameters that make a result "invalid" are dynamic, and we cannot pass the work on to the database. So, one idea is to create a thread pool and ExecutorService and check these results concurrently. But I keep seeing people saying "Oh, the spec prohibits spawning threads in a servlet" or "that's just a bad idea". So, my question: what am I supposed to do? I'm in a servlet 2.5 container, so all the asynchrous goodies as part of the 3.0 spec are unavailable to me. Writing a separate service that I communicate with via JMS seems like overkill. Looking for expert advice here. Jason
tagged with: servlets
type: Question
score: 5
has comment: http://stackoverflow.com/comment/36260732
possible better answer: http://stackoverflow.com/a/23617759
has answer: http://stackoverflow.com/a/23618780
has comment: http://stackoverflow.com/comment/36259839
has comment: http://stackoverflow.com/comment/36281352
linked to: http://stackoverflow.com/q/23240497
favorite count: 0
linked to: http://stackoverflow.com/q/3745905
has comment: http://stackoverflow.com/comment/36260076
has comment: http://stackoverflow.com/comment/36259746

http://stackoverflow.com/comment/36785602
comment on: http://stackoverflow.com/a/23740853
score: 0
type: AnswerComment
type: Comment
has text: @23k Have you come any further by now?

http://stackoverflow.com/q/23754051
has body: I want xAxis values are from 1 to 10. When I set xAxis lowerBound to '1' instead of '0' bar in chart is disappearing. NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRanging(false); xAxis.setLowerBound(1); xAxis.setUpperBound(10); xAxis.setTickUnit(1); final CategoryAxis yAxis = new CategoryAxis(); final BarChart&lt;Number,String&gt; bc =new BarChart&lt;Number,String&gt;(xAxis,yAxis); XYChart.Series series1 = new XYChart.Series(); series1.getData().add(new XYChart.Data(5, "XYZ")); How to fix this issue?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23761051
type: UnansweredQuestion
tagged with: javafx-2
tagged with: java
tagged with: javafx
has title: xAxis.setLowerBound(1) is causing to disappear bar in bar chart in javaFX
type: Question

http://stackoverflow.com/a/23681895
accepted answer of: http://stackoverflow.com/q/23677408
score: 0
answers question: http://stackoverflow.com/q/23677408
type: Answer
has body: If I were you I would try to repeat process one more time. And make sure you import Root cert first, Intermediate second and trial last. And last one should have the same alias as you used when created private key. I probably can't suggest anything else, sorry.
has comment: http://stackoverflow.com/comment/36386449
type: AcceptedAnswer

http://stackoverflow.com/comment/36566221
comment on: http://stackoverflow.com/a/23777534
has text: -1: In this case, the compiler will use `StringBuilder` for you. Check the generated bytecode. Use `StringBuilder` only when concatenating through a loop, when the compiler cannot do any code optimization.
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/36380464
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23679887
has text: When I'm calling: DocumentsHistory dh = (DocumentsHistory)em.find( DocumentsHistory.class, doc.getLastDhId() ); em.contains(dh); // returns true
type: AnswerComment

http://stackoverflow.com/comment/36464806
type: QuestionComment
comment on: http://stackoverflow.com/q/23724249
score: 0
has text: If your code must be single threaded I'm not sure how it can scale...
type: Comment

http://stackoverflow.com/q/23677741
has title: Reading data from an MySQL table whenever the table changes
score: 0
has answer: http://stackoverflow.com/a/23678389
has answer: http://stackoverflow.com/a/23677911
answer count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36376383
has body: I have a MySQL database which contains a table in which new data are getting dumped.Now i have made a java program to read the table data.The nature of the data inserted into the table is such that sometimes it is continuously getting added and sometimes getting added after intervals.While my requirement is to read the data from the java application as soon as it gets added into the table .. As soon as new data gets added into table, I need to read that through my java program and process it. Also I need to read only new rows.. Here is my java class code.. private void Readdata(ResultSet resultSet) throws SQLException { while (resultSet.next()) { Date date = resultSet.getDate("datum"); String comment = resultSet.getString("comments"); } } In this code if the while condition fails it comes out and stops reading.
has answer: http://stackoverflow.com/a/23678218
tagged with: java
tagged with: mysql
tagged with: updates
linked to: http://stackoverflow.com/q/11458091
type: Question

http://stackoverflow.com/comment/36258833
has text: @user3150902 As I mentioned in passing at the end of the first paragraph, you still need to account for possible -1 values in the recursive calls and handle them appropriately. I've edited in some sample code to show what I mean: if the recursive call returns -1, you shouldn't be returning it: just let it fall through to the "not-found" value.
type: Comment
comment on: http://stackoverflow.com/a/23617176
score: 0
type: AnswerComment

http://stackoverflow.com/a/23730104
has comment: http://stackoverflow.com/comment/36477830
type: Answer
has comment: http://stackoverflow.com/comment/116024078
score: 30
has comment: http://stackoverflow.com/comment/36480080
has comment: http://stackoverflow.com/comment/36477740
has comment: http://stackoverflow.com/comment/36478083
answers question: http://stackoverflow.com/q/23729944
has comment: http://stackoverflow.com/comment/93115116
has comment: http://stackoverflow.com/comment/36477371
has comment: http://stackoverflow.com/comment/36478723
has body: While I muck about with TextLayout, you could just use the Graphics context's FontMetrics, for example... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class LayoutText { public static void main(String[] args) { new LayoutText(); } public LayoutText() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private String text; public TestPane() { text = "Along time ago, in a galaxy, far, far away"; } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.RED); g2d.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight()); g2d.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2); Font font = new Font("Arial", Font.BOLD, 48); g2d.setFont(font); FontMetrics fm = g2d.getFontMetrics(); int x = ((getWidth() - fm.stringWidth(text)) / 2); int y = ((getHeight() - fm.getHeight()) / 2) + fm.getAscent(); g2d.setColor(Color.BLACK); g2d.drawString(text, x, y); g2d.dispose(); } } } Okay, after some fussing about... Basical…
has comment: http://stackoverflow.com/comment/93115137
has comment: http://stackoverflow.com/comment/36478026
accepted answer of: http://stackoverflow.com/q/23729944
has comment: http://stackoverflow.com/comment/36477402
has comment: http://stackoverflow.com/comment/93115070
has comment: http://stackoverflow.com/comment/36478261
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/116023541
has comment: http://stackoverflow.com/comment/36478058
upvote count: 30
has comment: http://stackoverflow.com/comment/36478387

http://stackoverflow.com/a/23684966
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23684535
score: 2
has body: Well I feel like an idiot. There was a typo in the password. postgres> I didn't realize it until I stepped through the jdbc classes and discovered the psql error.
answers question: http://stackoverflow.com/q/23684535
downvote count: 0

http://stackoverflow.com/comment/36440525
type: AnswerComment
type: Comment
has text: As I already pointed out, you can get the exact value of a float as a BigDecimal by using the BigDecimal(double) constructor. Conversion to String may cause rounding.
comment on: http://stackoverflow.com/a/23704134
score: 0

http://stackoverflow.com/q/23651527
has answer: http://stackoverflow.com/a/23651701
type: Question
downvote count: 5
possible better answer: http://stackoverflow.com/a/23651723
answer count: 6
accepted answer: http://stackoverflow.com/a/23651706
has answer: http://stackoverflow.com/a/23651723
has answer: http://stackoverflow.com/a/23651963
has answer: http://stackoverflow.com/a/23651740
has body: I just started with lists in Java and I'm confused with all this. So basically we have ArrayList and LinkedList which can be defined like LinkedList&lt;String&gt; s = new LinkedList&lt;String&gt;(); ArrayList&lt;String&gt; s = new ArrayList&lt;String&gt;(); But then we also have LinkedIntList which can be defined like for example: class LinkedIntList { private ListNode first; private int size; LinkedIntList () { first=null; size=0; } LinkedIntList(LinkedIntList l) { first = l.getFirst(); size=l.size(); } ListNode getFirst() {return first;} int size() {return size;} } But this is my problem, why define LinkedIntList using a class? What is the difference comparing to LinkedLists where we just define like I stated. I can't understand why a class is being used. If this is a 'new type' of array why using a class instead of declaring it normally? Sorry if this sounds weird, but I'm a beginner and really need help at this. Thank you!
has title: What are Lists in Java
has answer: http://stackoverflow.com/a/23651778
favorite count: 0
score: -4
linked to: http://stackoverflow.com/q/8546500
upvote count: 1
has answer: http://stackoverflow.com/a/23651706
linked to: http://stackoverflow.com/q/322715
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36325353
tagged with: java

http://stackoverflow.com/a/23619617
upvote count: 1
has comment: http://stackoverflow.com/comment/36263757
downvote count: 0
has comment: http://stackoverflow.com/comment/36263890
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36263913
has comment: http://stackoverflow.com/comment/36263784
answers question: http://stackoverflow.com/q/23619447
has comment: http://stackoverflow.com/comment/36263863
has body: Override paintComponent for instance member panel rather then Board JPanel class itself. panel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); ...// your code here } }; Why Board class is extending JPanel? Try to use design pattern such as Favor Composition over Inheritance
has comment: http://stackoverflow.com/comment/36263505

http://stackoverflow.com/a/23720931
has body: You need to create a new camera, which won't move like the other. It is very common to have more cameras in a game, mostly one for rendering game and the second one for GUI. OrthographicCamera gameCam = new OrthographicCamera(); OrthographicCamera guiCam = new OrthographicCamera(); guiCam.setToOrtho(false, SCREEN_WIDTH, SCREEN_HEIGHT); gameCam.setToOrtho(false, GAME_WIDTH, GAME_HEIGHT); and then in code: batch.setProjectionMatrix(gameCam.combined); batch.begin(); //render game stuff batch.end(); batch.setProjectionMatrix(guiCam.combined); batch.begin(); //draw gui, text, etc.. batch.end(); And remember only to move the gameCam, not the guiCam.
answers question: http://stackoverflow.com/q/23717378
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/36312734
type: Comment
score: 1
has text: 8 up votes on an answer even the author agrees you should never do? Seriously?
comment on: http://stackoverflow.com/a/23644798
type: AnswerComment

http://stackoverflow.com/comment/36590660
has text: I did try deleting the .class file and recompiling. I added the .exe as well, but I still get the same error. If you think of something else, please let me know. I'll keep fiddling with it in the mean time. Thanks for the help!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23773113
score: 0

http://stackoverflow.com/comment/36347129
type: QuestionComment
comment on: http://stackoverflow.com/q/23661758
has text: @ZouZou My question is I am putting subMap(4 values) in to mainMap with key one. And subMap(6 values) into mainMap with key two. But I got both as same? why?
score: 0
type: Comment

http://stackoverflow.com/q/23664717
tagged with: glassfish
score: 0
answer count: 1
has title: Glassfish 3: 3rd party jar not logging to server.log via java.util.logger
has body: I'm using a 3rd party jar within my web app that uses standard java.util.logging for writing log messages. Thus it should work with the GF standard log and the logging in my app, as both are too using java.util.logging. I've added the logger of the third party jar (com.xyz...) in the Glassfish admin console and set the desired log level. But nevertheless no messages from the 3rd party jar are showing up in the server.log. Any hints how to overcome this? Or should I switch to slf4j with logback?
type: UnansweredQuestion
tagged with: logging
has answer: http://stackoverflow.com/a/23687733
type: Question
tagged with: java

http://stackoverflow.com/a/29472809
accepted answer of: http://stackoverflow.com/q/23652334
type: AcceptedAnswer
has body: It was hasted on Heroku and was going to sleep some times. I think it was reproduced after resume app. Question can be closed.
answers question: http://stackoverflow.com/q/23652334
type: Answer
score: 0

http://stackoverflow.com/comment/86241065
type: AnswerComment
has text: @OWADVL is it though? As of Spring 5 there is no default constructor for `org.springframework.data.web.config.SpringDataWebConfiguration`
type: Comment
score: 1
comment on: http://stackoverflow.com/a/44705987

http://stackoverflow.com/comment/36547168
comment on: http://stackoverflow.com/a/23767171
type: AnswerComment
type: Comment
score: 1
has text: Alright, but on the client if i try to get the Response Entity it returns neither the exception(when it occurs) nor the actual method return. It just returns me a HttpUrlConnector instance...

http://stackoverflow.com/q/23692077
has title: Rotate object to face point
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23699458
has comment: http://stackoverflow.com/comment/36409755
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36407364
tagged with: math
tagged with: java
upvote count: 10
type: Question
tagged with: rotation
tagged with: 3d
downvote count: 0
has body: I would like to rotate an object to face a point which I'm have a bit of of trouble with. So I'm starting with an object that has a base at zero and is aligned on the y axis. I would like to rotate it so that the top of the object is facing the destination My process so far is to: Given axis A find the distance between my position and my look position: D create a direction vector: V = D.normalize() find the right vector: R = A cross D find the up vector: U = D cross R find the angle between up and direction: ANGLE = acos((U dot D) / (U.length * D.length)) rotate by angle scaled by direction on each axis here is the code representation of that. I'm not sure what exactly is wrong with this I've worked it out on paper and to my knowledge this approach should work but the results are completely incorrect when drawn. If anyone sees any flaws and could point me in the right direction it would be great. Vector3 distance = new Vector3(from.x, from.y, from.z).sub(to.x, to.y, to.z); final Vector3 axis = new Vector3(0, 1, 0); final Vector3 direction = distance.clone().normalize(); final Vector3 right = (axis.clone().cross(direction)); final Vector3 up = (distance.clone().cross(right)); float angle = (float) Math.acos((up.dot(direction)/ (up.length() * direction.length()))); bondObject.rotateLocal(angle, direction.x , direction.y, direction.z);
score: 10
has answer: http://stackoverflow.com/a/23699458

http://stackoverflow.com/q/23738605
has body: In java, when I move a int, no matter what value it is, to the left: 4 &lt;&lt; (-1); when the offset is -1, I will always get 0. Why?
favorite count: 0
duplicate of: http://stackoverflow.com/q/10516786
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23738737
downvote count: 1
tagged with: java
has title: Java: int << (-1) == 0 ？
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36492000
answer count: 1

http://stackoverflow.com/comment/36302659
type: Comment
comment on: http://stackoverflow.com/a/23639422
has text: Doh! I don't need a listener... thanks for your help. It works without any listener.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36390029
has text: Ummm ... comparing two `String`s with `==` is something you should almost never do. (Actually, I say _never_, period.) But I don't think you can say the same about objects in general. Some objects represent _values_, and in those cases there should be an `equals` method and you should use that instead of `==`. But not all objects are value objects, and I don't think this holds for those other objects.
type: Comment
comment on: http://stackoverflow.com/a/23684791
score: 0
type: AnswerComment

encryption
tags question: http://stackoverflow.com/q/23743932
tags question: http://stackoverflow.com/q/23636360
tags question: http://stackoverflow.com/q/23748173
tag name: encryption
tags question: http://stackoverflow.com/q/23668299
tags question: http://stackoverflow.com/q/23763343
tags question: http://stackoverflow.com/q/23643545
tags question: http://stackoverflow.com/q/23683940
tags question: http://stackoverflow.com/q/23770814
tags question: http://stackoverflow.com/q/23769240
tags question: http://stackoverflow.com/q/23705530
tags question: http://stackoverflow.com/q/23664639
tags question: http://stackoverflow.com/q/23684596
tags question: http://stackoverflow.com/q/23677746
tags question: http://stackoverflow.com/q/23765514
tags question: http://stackoverflow.com/q/23726117
tags question: http://stackoverflow.com/q/23655064
tags question: http://stackoverflow.com/q/23691995
tags question: http://stackoverflow.com/q/23670990
tags question: http://stackoverflow.com/q/23628518
tags question: http://stackoverflow.com/q/23644230
type: Tag
tags question: http://stackoverflow.com/q/23743842
tags question: http://stackoverflow.com/q/23748547

http://stackoverflow.com/q/23658493
type: Question
score: 0
has title: Error while Running Netbeans
has body: I got this error some minutes after I started it. THe error says "Error Load Library 87 - Incorrect Parameter". When I click OK Netbeans crash. Image here: https://i.sstatic.net/QguN7.png
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36341132
has comment: http://stackoverflow.com/comment/36347009
tagged with: netbeans
answer count: 0
tagged with: java

http://stackoverflow.com/comment/36353305
type: QuestionComment
has text: What is the `Pair`? In Java Standard Library there's no such a class. Do you mean JavaFX `Pair`? Or maybe TestNG?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23665592

http://stackoverflow.com/comment/36298013
has text: when i try with : System.out.println(session.get("loginId")); i have this error Unable to instantiate Action, GestionMissions, defined for 'executemission' in namespace '/'null
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23637625

http://stackoverflow.com/comment/36546866
score: 0
comment on: http://stackoverflow.com/q/23766607
type: Comment
type: QuestionComment
has text: i am trying to reproduce the error, but there are missing some classes... could you refactor the Code or paste the classes please?

http://stackoverflow.com/comment/36269812
has text: @Lal I have a class which create a progress bar in android which is the first code snippet, so where I gonna place the second code snippet to display on the downloading process in progress bar
type: Comment
comment on: http://stackoverflow.com/q/23616152
type: QuestionComment
score: 0

http://stackoverflow.com/q/23674666
linked to: http://stackoverflow.com/q/9806421
has answer: http://stackoverflow.com/a/23674701
duplicate of: http://stackoverflow.com/q/9806421
favorite count: 0
has answer: http://stackoverflow.com/a/23674721
linked to: http://stackoverflow.com/q/18995038
answer count: 5
tagged with: concurrentmodification
duplicate of: http://stackoverflow.com/q/18995038
upvote count: 3
accepted answer: http://stackoverflow.com/a/23674701
has body: I Have a scenario such like this List&lt;String&gt; xxx = new ArrayList for(String yyy : xxx){ for(String zzz:xyxy){ if(!zzz.equals(yyy)){ xxx.add(zzz); } } } But i get java.util.ConcurrentModificationException: null exception.Can anyone help me solve this issue.? Can anyone give me alternate method to perform this ?
downvote count: 1
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36370345
has answer: http://stackoverflow.com/a/23674739
has comment: http://stackoverflow.com/comment/36370184
has answer: http://stackoverflow.com/a/23674953
tagged with: java
has title: How to add values to a list while iterating it
possible better answer: http://stackoverflow.com/a/23674713
has answer: http://stackoverflow.com/a/23674713
type: Question

http://stackoverflow.com/a/23765812
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23765783
answers question: http://stackoverflow.com/q/23765783
type: Answer
has body: You will have to pass a context in. The way you get to the @String values is by using the method Context.getResources(). My suggestion would be to keep a private field that holds the context, and initialise it in your adapter's constructor.
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/36317149
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23632421
has text: Yeah my series partially has same name. For example (xy1, xy12, xy234) as you can see "xy" is common word in each series. but xy may not be on each category, there are other series such as (xz1,xz3 or yz2,yz4) as well.
type: AnswerComment

http://stackoverflow.com/comment/36384409
score: 0
type: AnswerComment
type: Comment
has text: can you please explain? how come my code doesn't work? what should your code fix?
comment on: http://stackoverflow.com/a/23679553

http://stackoverflow.com/comment/36532729
has text: You actually don't need the second for, nodeService in your code is a list, so you could just do nodeService.contains(serviceName); so if(nodeService.contains(serviceName)) result.add(new ServiceProvider(pair.getValue(),serviceName))
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23757109

automation
tags question: http://stackoverflow.com/q/23681949
tag name: automation
tags question: http://stackoverflow.com/q/23743591
type: Tag
tags question: http://stackoverflow.com/q/23736407
tags question: http://stackoverflow.com/q/23775534

http://stackoverflow.com/a/23739906
has body: You should really put this logic in the java code (servlet, struts action, etc) that populates the "consultations" list. But to answer your question specifically, try: &lt;c:if test = "${consultation.user.lastName == user.lastName}"&gt;
has comment: http://stackoverflow.com/comment/36494744
type: AcceptedAnswer
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23739683
answers question: http://stackoverflow.com/q/23739683
downvote count: 0

http://stackoverflow.com/comment/36345168
type: QuestionComment
has text: I think basically my question is how can I call a method in a running instance of a class from another class instead of creating a new instance.
comment on: http://stackoverflow.com/q/23661442
score: 0
type: Comment

http://stackoverflow.com/comment/36326804
type: Comment
has text: @AndreaLigios Even version 2.3.15.3 has security issues. 2.3.16.3 is the advisable version. Besides that, the form does not exist in the DOM of the page. It is created 'dynamically' when needed. That is why you do not find it.
score: 0
comment on: http://stackoverflow.com/q/23646853
type: QuestionComment

http://stackoverflow.com/a/23695775
has comment: http://stackoverflow.com/comment/36477911
has comment: http://stackoverflow.com/comment/36410542
answers question: http://stackoverflow.com/q/23695439
has comment: http://stackoverflow.com/comment/36410295
has comment: http://stackoverflow.com/comment/36412849
has comment: http://stackoverflow.com/comment/36411412
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36409994
has body: Your code is right and working in my own eclipse. May be your eclipse is not working perfectly. in my opinion change your eclipse version and try again. By the way your make sure to jdk version is same in eclipse and your console.

http://stackoverflow.com/comment/36547721
comment on: http://stackoverflow.com/a/23767223
score: 1
type: AnswerComment
has text: class be extends bee, no?
type: Comment

http://stackoverflow.com/q/23659729
tagged with: android-activity
tagged with: service
type: UnansweredQuestion
upvote count: 1
has body: I have a problem with startActivityForResult function. I have an actity MqttClientActivity public class MqttClientActivity extends Activity { static final int ACTIVATION_REQUEST = 47; // identifies our request id private static Context context; static DevicePolicyManager devicePolicyManager; static ComponentName demoDeviceAdmin; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MqttClientActivity.context = getApplicationContext(); // Initialize Device Policy Manager service and our receiver class devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); demoDeviceAdmin = new ComponentName(this, DemoDeviceAdminReceiver.class); } public static void test() { boolean active = devicePolicyManager.isAdminActive(demoDeviceAdmin); if (active) { //do something... } else { // Activate device administration Intent intent = new Intent( DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, demoDeviceAdmin); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Your boss told you to do this"); startActivityForResult(intent, ACTIVATION_REQUEST); } } } And I have this class : https://github.com/dobermai/android-mqtt-push/blob/master/src/de/eclipsemagazin/mqtt/push/MQTTService.java then : https://github.com/dobermai/android-mqtt-push/blob/master/src/de/eclipsemagazin/mqtt/push/PushCallback.java In this latter class, in the messageArrived function I want to call my test function (MqttClientActivity), how I can do this? I have already set the function to static and variables "devicePolicyManager" and "demoDeviceAdmin" to static, but I can't launch the activty... Anyone can help me? Thanks
type: Question
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has title: Launch activity with startActivityForResult in a service
tagged with: static
tagged with: android
has answer: http://stackoverflow.com/a/23659828

http://stackoverflow.com/a/23716271
answers question: http://stackoverflow.com/q/23715710
score: 1
has body: The output is going to be a mixed set of integers and strings, so the method signature you're writing is going to look like: Set&lt;Object&gt; foo(Set&lt;Integer&gt; input); First let's write the algorithm the easy way, in Scala, then we'll convert it to Java. You want to change each item in the collection, so that's a map operation. def foo(s: Set[Int]): Set[Any] = s map { i =&gt; if (i % 10 == 0) "10" else i } In Java 8, it's similar, but you have to convert the Set to a Stream to do the mapping, and then back to a Set again. static Set&lt;Object&gt; foo(Set&lt;Integer&gt; s) { return s.stream() .map(i -&gt; i % 10 == 0 ? "10" : i) .collect(Collectors.toSet()); } If you want to go back to Java 7, you don't even have streams, or lambdas to make defining the map operation feasible, so you just have to understand how map is defined and then implement it procedurally in your code. static Set&lt;Object&gt; foo(Set&lt;Integer&gt; s) { Set&lt;Object&gt; result = new HashSet&lt;&gt;(); for (Integer i : s) { result.add(i % 10 == 0 ? "10" : i); } return result; } The Java 5-6 solution is almost the same, just without the diamond syntax: static Set&lt;Object&gt; foo(Set&lt;Integer&gt; s) { Set&lt;Object&gt; result = new HashSet&lt;Object&gt;(); for (Integer i : s) { result.add(i % 10 == 0 ? "10" : i); } return result; } And in Java 3-4 you lose the for loop, autounboxing, and generics... static Set foo(Set s) { Set result = new HashSet(); Iterator it = s.iterator(); while (it.hasNext()) { Integer i = (Integer) it.next(); Object o = i; if (i.intValue() % 10 == 0) o = "10"; result.add(o); } return result; }
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36364909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671817
has text: the code seems ok. post the manifest fine
score: 0

custom-exceptions
type: Tag
tags question: http://stackoverflow.com/q/23620055
tag name: custom-exceptions

http://stackoverflow.com/a/23723003
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37595925
accepted answer of: http://stackoverflow.com/q/23685035
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23685035
downvote count: 0
has body: When a class fails to implement an interface method, the Java compiler does not reject the code but instead emits bytecode for the method that will raise the runtime error seen. This explains why JUnit is able to run the tests and why the test passes if you don't call methodB - the runtime error does not get raised. Per this page, this does not occur by default but requires that you have the Java -> Debug 'Suspend execution on compilation errors' setting enabled.

http://stackoverflow.com/comment/36407445
comment on: http://stackoverflow.com/a/23693741
type: AnswerComment
has text: You're missing the return type and the `Class` on the `className` parameter. The type of `object` may also need changing.
type: Comment
score: 2

http://stackoverflow.com/comment/36459076
type: Comment
has text: I tried it and it doesn't work for me. Actually I tried again with HashMap and it works now. None changes in JSP files done. Don't know what happened :) Thanks for answer anyway
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23715991

http://stackoverflow.com/q/23726692
type: UnansweredQuestion
tagged with: swing
has title: Using JLabel for text on custom drawn component causes painting bug
tagged with: java
has body: My little project involves a diagram editing tool, in which different sized boxes can be linked together. The drawing requirement for this is complex to say the least. You see the idea is that one can zoom in/out as far as they like and create ever smaller/larger boxes. This is sort of like a Mandelbrot, but as a diagram tool. This is shown in the image below. These boxes have text in them and my overall aim was for this text to be centered in the absolute center of the box. The only simple way I know for text to both center and wrap is by using JLabels. But when I tried this I came across a strange bug. The labels with multiple lines were prone to "disalign" vertically every other time they were repainted. (Sometimes this happened, other times it didn't. It has some consistency in that it keeps its behaviour when I replicate the same movement and positioning). This bug is shown in the image below. Depending on the position, it would effectively alternate between the two images above. I have isolated the drawing of each box and ensured there was no escaping graphics transformations, and it seems this problem is down to the label painting. I am aware that the practices I've used may not be preferable (e.g. painting JLabel directly), however I struggle to find any decent alternatives. If you guys can come up with a good alternative to using JLabels for centering and word wrap I'm happy to try it. Any ideas are welcome really. Below is the drawing code for a Box. The colors are temporary. public void draw(Graphics2D g, Map map, int fillAlpha, int lineAlpha, double zoom) { if(this == map.selectedBox) { if(this == map.highlightedBox) g.setColor(new Color(200,235,235,fillAlpha)); else g.setColor(new Color(200,225,225,fillAlpha)); } else { if(this == map.highlightedBox) g.setColor(new Color(235,235,200,fillAlpha)); else g.setColor(new Color(225,225,200,fillAlpha)); } g.fill(rect); if(this == map.selectedBox) g.setColor(new Color(0,0,255,lineAlpha)); else g.setColor(new Col…
type: Question
has comment: http://stackoverflow.com/comment/36473714
has comment: http://stackoverflow.com/comment/36490406
score: 0
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/36491402
has comment: http://stackoverflow.com/comment/36474321
tagged with: repaint
tagged with: jlabel
answer count: 0

http://stackoverflow.com/a/23723224
has body: try this : void getSumAtPrime(int[] n, int n_limit) { System.out.println("limit:"+n_limit); for(int j=0; j &lt; n_limit; j++) { if(getPrime(j)) System.out.println(j + " : " + n[j]); } } boolean getPrime(int numi) { if ( n &lt; 2) return false; for(int i=2; i &lt; numi; i++) if(numi%i==0) return false; return true; }
score: 0
answers question: http://stackoverflow.com/q/23723045
type: Answer

http://stackoverflow.com/q/23767403
has comment: http://stackoverflow.com/comment/36549131
has comment: http://stackoverflow.com/comment/36547641
has title: Can't instantiate Class and no empty constructor error
has body: I am making an application and I have made a class setup email.java in which I am saving the values entered by the user in sqlite database.But the class is not able to load and it is saying that: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.astrada/com.example.astrada.Setupemail}: java.lang.InstantiationException: can't instantiate class com.example.astrada.Setupemail; no empty constructor Here is my code: package com.example.astrada; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.example.astrada.R; import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.DatabaseErrorHandler; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Color; import android.os.Bundle; import android.support.v4.widget.SimpleCursorAdapter; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class Setupemail extends Activity implements OnClickListener { EditText editEmail, editPhon1, editPhon2, editphone3, editphone4, uname, useraddress; TextView TitleInfo; Button save; SqlOpenHelper mHelper; Cursor mCursor; SimpleCursorAdapter mAdapter; private final Context context; private SqlOpenHelper DBHelper; private SQLiteDatabase mDb; private static final String DATABASE_NAME = "databaseofuser.db"; private static final String DATABASE_TABLE = "usertable"; private static final int DATABASE_VERSION = 1; public static final String EMAIL_COLUMN = "email"; public static final String PHONE1_COLUMN = "phon1"; public static final String PHONE2_COLUMN = "phon2"; public static final String PHONE3_COLUMN = "phon3"; pu…
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23767513
has comment: http://stackoverflow.com/comment/36547263
has comment: http://stackoverflow.com/comment/36547551
has answer: http://stackoverflow.com/a/23767507
type: Question
downvote count: 2
tagged with: sqlite
has comment: http://stackoverflow.com/comment/36547326
has answer: http://stackoverflow.com/a/23767509
has comment: http://stackoverflow.com/comment/36547686
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36547519
tagged with: android
has comment: http://stackoverflow.com/comment/36548958
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23680430
answer count: 1
favorite count: 0
tagged with: access-token
has body: How to rename the Struts2 Token Parameters? if we use &lt;s:token/&gt; tag while form submit by default Struts2 will generate URL something like this ?name=name&amp;struts.token.name=struts.token&amp;struts.token=8E1USQZ5LHG120FU4YUZJAMPOUT4OVP3 by using this &lt;s:token name="suid"/&gt; tag we can rename the "struts.token" parameter. Struts2 will generate URL something like this ?name=name&amp;struts.token.name=suid&amp;suid=8E1USQZ5LHG120FU4YUZJAMPOUT4OVP3 How can we rename the "struts.token.name" parameter?
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/36384229
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23682216
accepted answer: http://stackoverflow.com/a/23682216
tagged with: struts2
tagged with: security
upvote count: 3
has title: How to rename the Struts 2 token parameter
tagged with: struts2-interceptors

http://stackoverflow.com/q/23705063
favorite count: 0
has comment: http://stackoverflow.com/comment/36429864
has comment: http://stackoverflow.com/comment/36428212
type: Question
has comment: http://stackoverflow.com/comment/36429941
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/36432660
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36429892
has comment: http://stackoverflow.com/comment/36428181
has comment: http://stackoverflow.com/comment/36428289
has answer: http://stackoverflow.com/a/23731773
has comment: http://stackoverflow.com/comment/36429806
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36429981
has title: OpenGL not rendering as expected
has comment: http://stackoverflow.com/comment/36429728
has comment: http://stackoverflow.com/comment/36429782
has comment: http://stackoverflow.com/comment/36429915
downvote count: 0
score: 1
has body: If I have the screen setup with the following gl.glViewport(0,0,width,height); //Reset the current viewport gl.glMatrixMode(GL10.GL_PROJECTION); //select the projection matrix gl.glLoadIdentity(); //Reset the Projection Matrix gl.glOrthof(0f,1f,0f,1f,-1f,1f); and the vertices set up as follows this._vertices=new float[]{ 0.0f,0.5f,0.0f, //V1 bottom left 0.0f,1.0f,0.0f, //V2 top left 0.5f,0.5f,0.0f, //V3 Bottom right 0.5f,1.0f,0.0f //V4 top right }; then when drawing I do gl.glTranslatef(0.0f,0.0f,0.0f); it places the square in the top left (i thought 0,0 was bottom left?) and then gl.glTranslatef(0.5f,-0.5f,0.0f); places the square in the middle of the screen (suggesting the bottom is actually -1.0f rather than 0.0f) How do I make the bottom left of my screen start from 0,0? Update------ I have found that if I change the line gl.glOrthof(0f,1f,0f,1f,-1f,1f); to gl.glOrthof(0f,1f,1f,0f,-1f,1f); then nothing changes (ie the top left is still 0,0 and bottom left is 0,-1) however if I leave the line out completely then the origin is in the centre of the screen (ie top left is -1,-1)
tagged with: opengl-es

http://stackoverflow.com/comment/59673329
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23634622
has text: Sorry, had to make an edit to undo the accidental downvote I made an hour ago (or so)
score: 1

http://stackoverflow.com/a/23730093
has body: Abridged: For an array: use .length. For a Collection (or Map): use .size(). For a CharSequence (which includes CharBuffer, Segment, String, StringBuffer, and StringBuilder): use .length(). Arrays One would use the .length property on an array to access it. Despite an array being a dynamically created Object, the mandate for the length property is defined by the Java Language Specification, §10.3: An array is created by an array creation expression (§15.10) or an array initializer (§10.6). An array creation expression specifies the element type, the number of levels of nested arrays, and the length of the array for at least one of the levels of nesting. The array's length is available as a final instance variable length. An array initializer creates an array and provides initial values for all its components. Since the length of an array cannot change without the creation of a new array instance, repeated accesses of .length will not change the value, regardless of what is done to the array instance (unless its reference is replaced with a differently sized array). As an example, to get the length of a declared one-dimensional array, one would write this: double[] testScores = new double[] {100.0, 97.3, 88.3, 79.9}; System.out.println(testScores.length); // prints 4 To get lengths in an n-dimensional array, one needs to bear in mind that they are accessing one dimension of the array at a time. Here's an example for a two-dimensional array. int[][] matrix = new int[][] { {1, 2, 3, 4}, {-1, 2, -3, 4}, {1, -2, 3, -4} }; System.out.println(matrix.length); // prints 3 (row length or the length of the array that holds the other arrays) System.out.println(matrix[0].length); // prints 4 (column length or the length of the array at the index 0) This is important to make use of, especially in the case of jagged arrays; the columns or rows may not always line up all the time. Collections (Set, List, etc.) For every object that implements the Collection interface, they will hav…
type: AcceptedAnswer
score: 43
accepted answer of: http://stackoverflow.com/q/23730092
type: Answer
answers question: http://stackoverflow.com/q/23730092
downvote count: 1
upvote count: 44

http://stackoverflow.com/comment/36469721
type: Comment
has text: If you read what I wrote above, I'm working through my tablet as i'm currently travelling, and I was hoping someone would know what would happen off the top of their head, and they could tell me whether my assumption that it reads the whole content of the file in one iteration is correct
comment on: http://stackoverflow.com/q/23726640
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36341276
comment on: http://stackoverflow.com/a/23659526
type: AnswerComment
has text: `set.toArray(new int[]{})` doesn't compile ... If the method signature used Integer[] it would.
type: Comment
score: 3

http://stackoverflow.com/comment/110115024
comment on: http://stackoverflow.com/a/57046306
has text: When this JAVA syntax got changed?
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/36561117
comment on: http://stackoverflow.com/q/23773938
score: 0
has text: @MarkPeters I've had the "Prefer composition over inheritance" principle beat into me but at the moment I really can't see why your extend the closed class idea would be bad.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23706979
tagged with: http://stackoverflow.com/tag/xml
has title: R cannot be resolved (XML issue but cannot find it)
type: Question
tagged with: android-layout
tagged with: java
score: 0
answer count: 3
has body: See the bottom for things that I have tried. It gives me an error anywhere where R is mentioned which as I understand it, means there is an error in the xml. I cannot find it anywhere though. AndroidListViewCursorAdaptorActivity package com.example.location_deals; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.AdapterView; import android.widget.EditText; import android.widget.FilterQueryProvider; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class AndroidListViewCursorAdaptorActivity extends Activity { private CountriesDbAdapter dbHelper; private SimpleCursorAdapter dataAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); dbHelper = new CountriesDbAdapter(this); dbHelper.open(); //Clean all data dbHelper.deleteAllCountries(); //Add some data dbHelper.insertSomeCountries(); //Generate ListView from SQLite Database displayListView();} private void displayListView() { Cursor cursor = dbHelper.fetchAllCountries(); //The desired columns to be bound String[] columns = new String[] { CountriesDbAdapter.KEY_CODE, CountriesDbAdapter.KEY_NAME, CountriesDbAdapter.KEY_CONTINENT, CountriesDbAdapter.KEY_REGION}; // the XML defined views which the data will be bound to int[] to = new int[] { R.id.code, R.id.name, R.id.continent, R.id.region,}; // 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, columns, to, 0); ListView listView = (ListView) findViewById(R.id.listView1); // Assign adapter to ListView listView.setAdapter(dataAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override publi…
has answer: http://stackoverflow.com/a/23706996
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36435507
has answer: http://stackoverflow.com/a/23710630
tagged with: android
has answer: http://stackoverflow.com/a/23714256

http://stackoverflow.com/a/32390799
has body: For anyone else looking for an answer I think the easiest way is to just set the default visibility/audience when requesting the permission with: LoginManager.getInstance.setDefaultAudience(DefaultAudience.EVERYONE); or fb_login_button.setDefaultAudience(DefaultAudience.EVERYONE); For the second one this is how the XML in your layout looks: &lt;com.facebook.widget.LoginButton android:id="@+id/fb_login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; See https://developers.facebook.com/docs/reference/android/current/class/DefaultAudience/
type: Answer
answers question: http://stackoverflow.com/q/23726597
score: 0

guava
tags question: http://stackoverflow.com/q/23772522
tags question: http://stackoverflow.com/q/23746395
tags question: http://stackoverflow.com/q/23629233
tags question: http://stackoverflow.com/q/23663466
tags question: http://stackoverflow.com/q/23680303
tags question: http://stackoverflow.com/q/23686704
tags question: http://stackoverflow.com/q/23669423
tags question: http://stackoverflow.com/q/23735683
tags question: http://stackoverflow.com/q/23648626
tags question: http://stackoverflow.com/q/23740550
tags question: http://stackoverflow.com/q/23736316
tags question: http://stackoverflow.com/q/23635559
tag name: guava
type: Tag
tags question: http://stackoverflow.com/q/23689810
tags question: http://stackoverflow.com/q/23690734
tags question: http://stackoverflow.com/q/23646186
tags question: http://stackoverflow.com/q/23670452

http://stackoverflow.com/comment/36559141
score: 0
type: Comment
type: QuestionComment
has text: the button is covered entire width. I want leave a space on adjuest sides of buttons, so I could insert image and text later.
comment on: http://stackoverflow.com/q/23773490

http://stackoverflow.com/a/23683558
has body: The first problem here is, that you add pine to p after you added p to the contentPane. Then, why do you add a new JLable evey time the slider changes it's value? Just add a JLabel to BorderLayout.NORTH and change it's text by useing the label.setText(String)Method. Hope I could help
answers question: http://stackoverflow.com/q/23683292
type: Answer
score: 0

http://stackoverflow.com/comment/36305438
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23640909
has text: yeah that link is better, it closes the writer.
score: 0

http://stackoverflow.com/a/23632459
type: Answer
has body: I can see why someone asked you to do this although just like the other answers suggest, this is too broad of a question to answer correctly. Depends on the scenario. Now the justification here could be that when you have a container for a Dog objects you get to control how these objects are created, accessed and changed. If you just have a List lying around you can't really control proper access or Add/Delete operations to it. However if you have a Dogs class. You can return readonly lists, don't allow addition of dogs that are of certain breed, etc. It can basically be a controller class for all that has to do with dogs. Class Dogs { List listofDogs = new ArrayList&lt;Dog&gt;(); public void AddDog(Dog newDog) { //check if valid } public List&lt;Dog&gt; getDogs() { //return readonly dogs collection } }
has comment: http://stackoverflow.com/comment/36287652
answers question: http://stackoverflow.com/q/23632094
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36291169

http://stackoverflow.com/q/23653550
has body: I need to display the 3rd page of scanned tiff files. i used the code TIFFReader reader = new TIFFReader(new File(pathOfFile)); RenderedImage image = reader.getPage(2); its sometimes work. and show error : Decoding of old style JPEG-in-TIFF data is not supported. I used aspriseTIFF.jar then how i solve this problem. please reply. thanks in advance
has comment: http://stackoverflow.com/comment/36333705
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Decoding of old style JPEG-in-TIFF data is not supported
has comment: http://stackoverflow.com/comment/36330217
has comment: http://stackoverflow.com/comment/36330255
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36330134
type: Question
has comment: http://stackoverflow.com/comment/36330370
tagged with: tiff
has answer: http://stackoverflow.com/a/23677466

http://stackoverflow.com/comment/36537762
score: 0
comment on: http://stackoverflow.com/q/23759130
has text: If you do a simple `object.getTemplateGroups()`, hibernate will fire a query to get the contents of the set. In hibernate configuration file, you can enable sql logging. e.g., ` true `. Check this link for further details, http://stackoverflow.com/questions/2536829/hibernate-show-real-sql.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36671644
has text: Open the Console app and see if anything happens there.
score: 0
comment on: http://stackoverflow.com/q/23710857
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/76411105
has text: This is resulting to 0. I tested in java 1.7 . It should have return 16 as initial capacity for hashmap is 16.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23628221

http://stackoverflow.com/comment/36353805
has text: Are you sending your messages wrapped in STX/ETX? This code will ignore anything that isn't.
score: 0
comment on: http://stackoverflow.com/q/23662414
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36420717
type: Comment
has text: Thank you so much! Deleting clearRect fixed it for me :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23701418

http://stackoverflow.com/q/23627130
score: 0
answer count: 1
has body: I previously used the following to get my context path on Tomcat-5.0.28 and earlier: String context_path = context.getRealPath("/WEB-INF/"); This worked to return the path to that folder. But on OpenShift (Tomcat 6 - JBoss EWS 1.0) this returns /var/lib/openshift/53.*context_id_here*..18/jbossews/null The null should be: work/Catalina/localhost/_/WEB-INF How can I get the path to the WEB-INF folder on OpenShift using JBOSS/Tomcat? A little background information: When I ran this struts webapp on my own Tomcat server, I deployed a appname.war file in the webapps directory and waited for it to expand (since I had set that option in the server.xml file). Then I move a folder to webapps/appname/ folder with xml files I need to read and write to for my app to work. On OpenShift I used jar xvf appname.war to extract the war file by hand (because that's the default and I don't know how to change it), and then moved the files folder (from the same directory as the war file in my folder after a git add and push) to work/Catalina/localhost/_/WEB-INF/ This is causing a NullPointerException for me when trying to use that path as shown above.
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36346634
has title: Getting the Path to WEB-INF on Openshift Tomcat 6 - JBoss EWS 1.0
type: UnansweredQuestion
tagged with: openshift
tagged with: java
has comment: http://stackoverflow.com/comment/36348620
type: Question
has answer: http://stackoverflow.com/a/23634240
has comment: http://stackoverflow.com/comment/36328663
tagged with: jboss

http://stackoverflow.com/a/23675657
type: Answer
has comment: http://stackoverflow.com/comment/36374131
accepted answer of: http://stackoverflow.com/q/23672617
score: 1
answers question: http://stackoverflow.com/q/23672617
upvote count: 1
has comment: http://stackoverflow.com/comment/36465633
has body: You need to create a new SAXParser : you're changing the factory variable, but your reader still use the old SAXParser : // checking for well-formed-ness using SAX. SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setErrorHandler(new SimpleErrorHandler()); reader.parse(new InputSource("src/addressbook.xml")); System.out.println("Checked well-formed-ness using SAX "); // validating using external schema Using SAX Parser factory.setValidating(false); // set validation to false SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); factory.setSchema(schemaFactory.newSchema(new Source[] { new StreamSource("src/addressbook.xsd") })); parser = factory.newSAXParser(); // create a new parser reader = parser.getXMLReader(); // and refresh your reader reader.setErrorHandler(new SimpleErrorHandler()); reader.parse(new InputSource("src/addressbook.xml")); System.out.println("Validation Checked when Parsing with SAX"); System.out.println("Parsing successful");
has comment: http://stackoverflow.com/comment/36406068
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36479691
has comment: http://stackoverflow.com/comment/36373630
has comment: http://stackoverflow.com/comment/36409397

http://stackoverflow.com/comment/36363938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23671340
score: 0
has text: Export it ? Did not get you . Can you please elaborate a little. I have that jar in my classpath path

http://stackoverflow.com/comment/36626370
comment on: http://stackoverflow.com/q/23739078
score: 0
has text: thanks everyone.. got this fixed ... changed this in jsp file instead of this java file ...working fine
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36381123
score: 0
comment on: http://stackoverflow.com/q/23679970
type: Comment
type: QuestionComment
has text: Allright, reporting back. The file absolute path is printed out and it matches where the file is located nicely. The file exists too according to file.exists() but it just does not delete it.

http://stackoverflow.com/comment/36370127
comment on: http://stackoverflow.com/a/23674114
has text: I think I understand what you're saying and based on that it seems like it should work, but when I actually use it on my string it removes bothe the control characters AND the text tags and everything inside.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23720266
type: Answer
upvote count: 3
has body: The class Checkout can contain a field of ArrayList&lt;Customer&gt; that you should add the customers to. public class Checkout { public ArrayList&lt;Customers&gt; custList = new ArrayList&lt;&gt;(); .... public static void main(String[] args){ ArrayList&lt;Checkout&gt; chkouts = new ArrayList&lt;&gt;(); chkouts.add(new Checkout()); chkouts.get(0).custList.add(new Customer());
accepted answer of: http://stackoverflow.com/q/23720030
answers question: http://stackoverflow.com/q/23720030
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36467561
has comment: http://stackoverflow.com/comment/36468546

http://stackoverflow.com/comment/36528005
type: AnswerComment
type: Comment
has text: that's simple. just make sure the max pool size is not greater than db2 max concurrent connections setting.
comment on: http://stackoverflow.com/a/23754616
score: 1

http://stackoverflow.com/a/23741526
answers question: http://stackoverflow.com/q/23737300
downvote count: 2
type: Answer
upvote count: 6
has body: The best place to validate your html would be http://validator.w3.org/. But that would be manual process. But dont worry jsoup can do this for you as well. The below program is like a workaround but it does the purpose. import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class JsoupValidate { public static void main(String[] args) throws Exception { String invalidHtml = "&lt;div id=\"myDivId\" ' class = claasnamee value='undaa' &gt; &lt;&lt;p&gt; p tagil vanne &lt;br&gt; &lt;span&gt; span close cheythillee!! &lt;/p&gt; &lt;/div&gt;"; Document initialDoc = Jsoup.parseBodyFragment(invalidHtml); Document validatedDoc = Jsoup.connect("http://validator.w3.org/check") .data("fragment", initialDoc.html()) .data("st", "1") .post(); System.out.println("******"); System.out.println("Errors"); System.out.println("******"); for(Element error : validatedDoc.select("li.msg_err")){ System.out.println(error.select("em").text() + " : " + error.select("span.msg").text()); } System.out.println(); System.out.println("**************"); System.out.println("Cleaned output"); System.out.println("**************"); Document cleanedOuput = Jsoup.parse(validatedDoc.select("pre.source").text()); cleanedOuput.select("meta[name=generator]").first().remove(); cleanedOuput.outputSettings().indentAmount(4); cleanedOuput.outputSettings().prettyPrint(true); System.out.println(cleanedOuput.html()); } }
score: 4
accepted answer of: http://stackoverflow.com/q/23737300
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/113989200
has comment: http://stackoverflow.com/comment/90034959

http://stackoverflow.com/q/23643066
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has body: I am running the Pet Clinic sample project comes with Spring3.2.5. Everything is fine with Hibernate, I want to try out EclipseLink. Here is my business-config.xml --> and I am keep getting: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/business-config.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter#62d24dc7' of type [org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter#62d24dc7' defined in class path resource [spring/business-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider What did i do wrong?
has title: Use EclipseLink in Spring 3.2.5 (Pet Clinic project)
has answer: http://stackoverflow.com/a/23666308
tagged with: eclipselink
upvote count: 1
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/36309390
has comment: http://stackoverflow.com/comment/36350422
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/36429110
type: QuestionComment
comment on: http://stackoverflow.com/q/23705381
has text: Are you running the posted code (exactly as it's shown)?
type: Comment
score: 0

http://stackoverflow.com/comment/36535621
type: QuestionComment
has text: Hashing is not the same as encrypting.
score: 1
comment on: http://stackoverflow.com/q/23761505
type: Comment

http://stackoverflow.com/comment/36518043
type: Comment
has text: Share your spring.xml people can help you.Its all about configuration.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23742108

http://stackoverflow.com/a/23664529
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36394831
accepted answer of: http://stackoverflow.com/q/23661856
answers question: http://stackoverflow.com/q/23661856
type: AcceptedAnswer
downvote count: 0
has body: As you refer to in your comment, you can create a pom file of your own that depends on the four jars you talk about. Then, release this to your local nexus. Once this is done, you can depend on it as a pom dependency, which will bring in the four libraries you want.
type: Answer
has comment: http://stackoverflow.com/comment/36396286

encoding
tags question: http://stackoverflow.com/q/23664414
tags question: http://stackoverflow.com/q/23633572
tags question: http://stackoverflow.com/q/23688362
type: Tag
tags question: http://stackoverflow.com/q/23726899
tag name: encoding
tags question: http://stackoverflow.com/q/23699279
tags question: http://stackoverflow.com/q/23646997
tags question: http://stackoverflow.com/q/23662341

http://stackoverflow.com/comment/36372458
comment on: http://stackoverflow.com/a/23675823
has text: I am writing this on my own just for practise
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36348714
score: 0
has text: Basically this should work exactly the same. Do You use any build tool?
comment on: http://stackoverflow.com/q/23661171
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36401159
comment on: http://stackoverflow.com/a/23689791
has text: Don't use 'this.' in a static method. Your printTable method must be static.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23632771
has title: retrieve servletContext in Servlet Async mode in Spring mvc
tagged with: servlets
type: Question
has body: I just switched to using Servlet Async in Spring mvc, for example I have this code: @RequestMapping("/report") public Callable&lt;Void&gt; handleRequest() { return new Callable&lt;Void&gt;() { public Void call() throws Exception { handleRequestIntern(); return null; } }; } Normally I have a Filter that will fill and empty a ThreadLocal with the http request and response that is used further in the code to retrieve the logged in member, etc... However, how can I do this in Async mode? I can't find any Spring mvc tooling for this to make it easy to acess the Request and Response. Note: of course I can pass in the Http request and response, but further in the code, which is not web code, it will access an abstract wrapper that will use the ThreadLocal to read properties like the logged in member.
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/13086821
tagged with: spring
has answer: http://stackoverflow.com/a/23637083
accepted answer: http://stackoverflow.com/a/23637083
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36348456
score: 0
comment on: http://stackoverflow.com/a/23662768
type: Comment
has text: here `random_uuid` must be some value not just a string "random_uuid"
type: AnswerComment

http://stackoverflow.com/q/23665889
has answer: http://stackoverflow.com/a/23665925
accepted answer: http://stackoverflow.com/a/23667309
type: AnsweredQuestion
tagged with: java
tagged with: swing
tagged with: jmenu
has title: ActionListen didn't fire on JMenu
type: Question
tagged with: jpanel
score: 0
answer count: 2
has body: I am fairly new java programming. I created a JMenu and add the actionlisten, but it didn't fire. The JPanel, jpCommentMainPane, is added to JFrame. Also the JFrame has its own menu bar and actionlistener. Would someone tell me how to make it work. Thanks in advance. There is my code to add the JMenu into the JPanel: jpCommentMainPane=new JPanel(); jpCommentMainPane.setLayout(new BorderLayout(10,10)); JPanel totalCommentPane=new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel jpFindPane=new JPanel(new FlowLayout(FlowLayout.LEFT)); totalCommentPane.setPreferredSize(new Dimension(rightPaneWidth,20)); jpFindPane.add(sortMenu()); //add menubar JPanel topPane=new JPanel(); topPane.setLayout(new BorderLayout()); topPane.add(jpFindPane, BorderLayout.SOUTH); jpCommentMainPane.add(topPane, BorderLayout.NORTH); There is the method to return the JMenuBar //Create sort menu bar private JMenuBar sortMenu(){ JMenuBar menuBar=new JMenuBar(); JMenu menu=new JMenu("Sort"); JRadioButtonMenuItem menuItemType=new JRadioButtonMenuItem("Type"); menu.add(menuItemType); JRadioButtonMenuItem menuItemPage=new JRadioButtonMenuItem("Page"); menu.add(menuItemPage); JRadioButtonMenuItem menuItemAuthor=new JRadioButtonMenuItem("Author"); menu.add(menuItemAuthor); JRadioButtonMenuItem menuItemDate=new JRadioButtonMenuItem("Date"); menu.add(menuItemDate); menu.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ Utility.DisplayErrorMsg(pageErrorPrefix+ "line 145"); String command=e.getActionCommand().trim().toUpperCase(); if (command.equals(SortItem.TYPE)){ pageSortBy=SortItem.TYPE; }else if (command.equals(SortItem.PAGE)){ pageSortBy=SortItem.PAGE; }else if(command.equals(SortItem.TYPE)){ pageSortBy=SortItem.TYPE; }else if(command.equals(SortItem.CREATOR)){ pageSortBy=SortItem.CREATOR; }else if (command.equals(SortItem.DATE)){ pageSortBy=SortItem.DATE; } getListCommentPane(); } } ); menuBar.add(menu); return menuBar; }
has answer: http://stackoverflow.com/a/23667309
has comment: http://stackoverflow.com/comment/36353740
possible better answer: http://stackoverflow.com/a/23665925

jsf
tags question: http://stackoverflow.com/q/23651085
tags question: http://stackoverflow.com/q/23648241
type: Tag
tags question: http://stackoverflow.com/q/23721613
tags question: http://stackoverflow.com/q/23734570
tags question: http://stackoverflow.com/q/23721513
tags question: http://stackoverflow.com/q/23652098
tags question: http://stackoverflow.com/q/23649083
tags question: http://stackoverflow.com/q/23696482
tags question: http://stackoverflow.com/q/23618666
tags question: http://stackoverflow.com/q/23721160
tags question: http://stackoverflow.com/q/23707036
tags question: http://stackoverflow.com/q/23659381
tags question: http://stackoverflow.com/q/23726688
tags question: http://stackoverflow.com/q/23751701
tags question: http://stackoverflow.com/q/23777342
tags question: http://stackoverflow.com/q/23636410
tags question: http://stackoverflow.com/q/23639627
tags question: http://stackoverflow.com/q/23688109
tags question: http://stackoverflow.com/q/23689511
tags question: http://stackoverflow.com/q/23722433
tags question: http://stackoverflow.com/q/23703987
tags question: http://stackoverflow.com/q/23677293
tags question: http://stackoverflow.com/q/23731262
tags question: http://stackoverflow.com/q/23638664
tags question: http://stackoverflow.com/q/23712148
tags question: http://stackoverflow.com/q/23693728
tags question: http://stackoverflow.com/q/23659334
tags question: http://stackoverflow.com/q/23755054
tags question: http://stackoverflow.com/q/23673963
tags question: http://stackoverflow.com/q/23647989
tags question: http://stackoverflow.com/q/23720464
tags question: http://stackoverflow.com/q/23656123
tags question: http://stackoverflow.com/q/23745131
tags question: http://stackoverflow.com/q/23726578
tags question: http://stackoverflow.com/q/23702221
tags question: http://stackoverflow.com/q/23707847
tags question: http://stackoverflow.com/q/23683723
tags question: http://stackoverflow.com/q/23749859
tags question: http://stackoverflow.com/q/23768065
tag name: jsf
tags question: http://stackoverflow.com/q/23717827
tags question: http://stackoverflow.com/q/23628474
tags question: http://stackoverflow.com/q/23677717
tags question: http://stackoverflow.com/q/23737779
tags question: http://stackoverflow.com/q/23764617
tags question: http://stackoverflow.com/q/23724013
tags question: http://stackoverflow.com/q/23615744
tags question: http://stackoverflow.com/q/23760191
tags question: http://stackoverflow.com/q/23728388
tags question: http://stackoverflow.com/q/23735925
tags question: http://stackoverflow.com/q/23753286
tags question: http://stackoverflow.com/q/23722918

http://stackoverflow.com/q/23728517
has comment: http://stackoverflow.com/comment/36473764
downvote count: 0
has title: Blurred text in JavaFX TextArea
has body: I am having a weird issue with JavaFX. I designed a simple Scene in SceneBuilder. The text looks ok in a preview, but in the running the app the text looks blurred, consider the following image. Here is the FXML: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.paint.*?> And here is the application class code: FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/br/mviccari/javafxtest/layouts/telaMensagem.fxml")); Parent root = fxmlLoader.load(); TelaMensagemController controller = fxmlLoader.getController(); controller.setParametroDeTeste("PIKACHU EU ESCOLHO VC!"); controller.init(); Stage stage = new Stage(StageStyle.DECORATED); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(labelStatus.getScene().getWindow()); stage.setOpacity(1); stage.setTitle("My New Stage Title"); stage.setScene(new Scene(root, 450, 450)); stage.showAndWait(); I have tried to run the app using JDK 7, this way the text is not blurred anymore, but how can I run it with JDK 8 showing a normal text I have put my project on bitbucket, if anyone tries to see the code or checkout to your machine, you can see this on your own https://mateusviccari@bitbucket.org/mateusviccari/testejavafx.git
has answer: http://stackoverflow.com/a/68037961
favorite count: 0
has answer: http://stackoverflow.com/a/23730755
has answer: http://stackoverflow.com/a/23963494
has answer: http://stackoverflow.com/a/65464467
has answer: http://stackoverflow.com/a/31622654
score: 14
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36473665
upvote count: 14
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/49794701
type: Question
has answer: http://stackoverflow.com/a/49794701
accepted answer: http://stackoverflow.com/a/31622654
answer count: 6

http://stackoverflow.com/comment/41998814
type: QuestionComment
has text: possible duplicate of [Eclipse and copying workspaces](http://stackoverflow.com/questions/2493997/eclipse-and-copying-workspaces)
score: 0
comment on: http://stackoverflow.com/q/23719857
type: Comment

http://stackoverflow.com/comment/36358252
type: QuestionComment
has text: ok, this is a parameter of an exemplary enum: `new float[][] { { 2, 1, 0, 1, 2, 3, 4, 3, 2 }, { .5F, .33F, .2F, .1F, .2F, .33F, .4F, .5F, .5F } }`. This is an array that contains a data of 1) the order of textures 2) display time of each frame. And each single enum contains such an information. I have no idea how to simplify it
comment on: http://stackoverflow.com/q/23667888
score: 0
type: Comment

http://stackoverflow.com/a/23775436
downvote count: 0
has comment: http://stackoverflow.com/comment/36562839
type: Answer
has body: Use Port 587 for TLS/STARTTLS. And following properties only if you use TLS/STARTTLS props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); And if you are trying to connect through SSL. Try only this - 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 session = Session.getDefaultInstance(props, null); Change this with - Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("username@gmail.com", "password"); } });
answers question: http://stackoverflow.com/q/23775391
has comment: http://stackoverflow.com/comment/36562321
score: 1
has comment: http://stackoverflow.com/comment/36562310
upvote count: 1
has comment: http://stackoverflow.com/comment/36562391

http://stackoverflow.com/comment/36290261
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23633572
type: QuestionComment
has text: @ginz See [When is it appropriate to edit someone else's code?](http://meta.stackexchange.com/questions/101583/when-is-it-appropriate-to-edit-someone-elses-code). The general consensus here is that we leave the authors code alone, except for indentation.

http://stackoverflow.com/comment/36314616
type: QuestionComment
type: Comment
score: 2
has text: This would be very handy indeed. If no one chimes in with an answer (and I would be surprised to see one) then I will try to see if I can set something up next week if I have a few minutes z
comment on: http://stackoverflow.com/q/23640512

http://stackoverflow.com/comment/36469664
has text: Is this any better? Sorry for not answering it well enough.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23726610

netbeans
tags question: http://stackoverflow.com/q/23677319
tags question: http://stackoverflow.com/q/23616130
tags question: http://stackoverflow.com/q/23749407
tags question: http://stackoverflow.com/q/23637503
tags question: http://stackoverflow.com/q/23761594
tags question: http://stackoverflow.com/q/23670227
tags question: http://stackoverflow.com/q/23711107
tags question: http://stackoverflow.com/q/23737579
tags question: http://stackoverflow.com/q/23769914
tags question: http://stackoverflow.com/q/23761680
tags question: http://stackoverflow.com/q/23760472
tags question: http://stackoverflow.com/q/23649528
tags question: http://stackoverflow.com/q/23670029
tags question: http://stackoverflow.com/q/23643324
tags question: http://stackoverflow.com/q/23724610
tags question: http://stackoverflow.com/q/23768839
tags question: http://stackoverflow.com/q/23618232
tags question: http://stackoverflow.com/q/23673963
tags question: http://stackoverflow.com/q/23629325
tags question: http://stackoverflow.com/q/23773605
tags question: http://stackoverflow.com/q/23643119
tags question: http://stackoverflow.com/q/23668082
tags question: http://stackoverflow.com/q/23749880
tags question: http://stackoverflow.com/q/23640003
tags question: http://stackoverflow.com/q/23769625
tags question: http://stackoverflow.com/q/23651788
type: Tag
tags question: http://stackoverflow.com/q/23647765
tags question: http://stackoverflow.com/q/23764498
tags question: http://stackoverflow.com/q/23767763
tags question: http://stackoverflow.com/q/23713374
tags question: http://stackoverflow.com/q/23758005
tags question: http://stackoverflow.com/q/23740211
tags question: http://stackoverflow.com/q/23658493
tags question: http://stackoverflow.com/q/23638896
tags question: http://stackoverflow.com/q/23641705
tags question: http://stackoverflow.com/q/23720570
tags question: http://stackoverflow.com/q/23635598
tags question: http://stackoverflow.com/q/23729277
tags question: http://stackoverflow.com/q/23726899
tags question: http://stackoverflow.com/q/23695985
tags question: http://stackoverflow.com/q/23709515
tags question: http://stackoverflow.com/q/23675662
tags question: http://stackoverflow.com/q/23747312
tags question: http://stackoverflow.com/q/23777350
tag name: netbeans
tags question: http://stackoverflow.com/q/23635208
tags question: http://stackoverflow.com/q/23730444
tags question: http://stackoverflow.com/q/23685903
tags question: http://stackoverflow.com/q/23772951
tags question: http://stackoverflow.com/q/23649051
tags question: http://stackoverflow.com/q/23654765
tags question: http://stackoverflow.com/q/23763615
tags question: http://stackoverflow.com/q/23722706
tags question: http://stackoverflow.com/q/23763070

http://stackoverflow.com/q/23709303
has answer: http://stackoverflow.com/a/58927743
type: AnsweredQuestion
score: 2
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23709328
has body: I've been doing some research of this problem but no solution has yet to work for me. I've added empty constructors in the fragment classes and tried with different imports of fragments, but nothing seems to work. I hope you guys can help me! My Activity: package com.example.com.example.android.rssfeed; import android.app.Activity; import android.os.Bundle; public class RssfeedActivity extends Activity implements MyListFragment.OnItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rssfeed); } public void onRssItemSelected(String link) { DetailFragment fragment = (DetailFragment) getFragmentManager().findFragmentById(R.id.detailFragment); if (fragment != null && fragment.isInLayout()) { fragment.setText(link); }//end if }//end method onRssItemSelected }//end class My fragment: package com.example.com.example.android.rssfeed; import android.app.Activity; import android.os.Bundle; import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; public class MyListFragment extends Fragment { public MyListFragment() { } private OnItemSelectedListener listener; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_rsslist_overview, container, false); Button button = (Button) view.findViewById(R.id.btn1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { updateDetail(); }//end onClick }); return view; }//end onCreateView public interface OnItemSelectedListener { public void onRssItemSelected(String link); }//end onItemSelectedListener @Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof OnItemSelectedListener) { listener = (OnItemSelectedListener) activity; } else { throw new ClassCastExceptio…
downvote count: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23709720
has title: InflateException Binary XML file at line #7: Error inflating class fragment
favorite count: 0
accepted answer: http://stackoverflow.com/a/23709328
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2
possible better answer: http://stackoverflow.com/a/23709720

http://stackoverflow.com/comment/36261298
has text: @gstackoverflow The "is a subtype of R2" clause is stating one of the ways that `d1` can be "return-type-substitutable" without a compiler error. That is not a contradiction, it's part of the definition.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23618392
score: 3

http://stackoverflow.com/q/23648108
favorite count: 0
has title: Mocking Couchbase
has comment: http://stackoverflow.com/comment/62145886
type: Question
accepted answer: http://stackoverflow.com/a/23651137
upvote count: 6
tagged with: java
tagged with: couchbase
answer count: 1
has body: I have a Java based data access layer that interacts with Couchbase. In order to apply unit testing to this layer I would like to mock Couchbase. Browsing the net I encountered this project which is also hosted in GitHub. I would like to use it but missing some basic examples. Maybe someone has tried it before and can provide me with some basic usages in Java?
score: 6
tagged with: mocking
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23651137

http://stackoverflow.com/comment/36441171
type: Comment
type: QuestionComment
has text: Yes ı opened new terminal but it returns same result
comment on: http://stackoverflow.com/q/23712144
score: 0

http://stackoverflow.com/comment/36330772
score: 0
has text: What's the exception thrown and how are you calling it from hibernate. See also http://stackoverflow.com/questions/11807698/how-to-retrieve-only-certain-fields-of-an-entity-in-jpql-or-hql-what-is-the-equ
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23649761

http://stackoverflow.com/q/23670452
has body: Syncthing uses the following Go code to compute a "Node ID," a base32 encoded SHA256 hash of an SSL certificate: func certID(bs []byte) string { hf := sha256.New() hf.Write(bs) id := hf.Sum(nil) return strings.Trim(base32.StdEncoding.EncodeToString(id), "=") } As far as I can tell, the certificate is just passed in as raw bytes: // ... remoteID := certID(certs[0].Raw) // ... I have tried to replicate this in Java (I'm somewhat new to Java), using the following method: public static String ComputeSTNodeID(Certificate cert) { MessageDigest md = MessageDigest.getInstance("SHA256"); return BaseEncoding.base32().encode(md.digest(cert.getEncoded())).replaceAll("=", ""); } (BaseEncoding is borrowed from Google's Guava library.) For a given certificate, the calculations are different: Go: T2JOFPRO7UJB4YHXOSCY4U4YQEFLFI355JQKRD7ZB2ZLEPU6RD4Q Java: HMKJKSJPB7CM54YHMYIFAN5F7MZAHOFXX4XG5SQWAZLY4I4ROJFA What am I doing wrong? @fge and I have worked out that the .getEncoded() call is not returning the same thing as what is contained in the Go .Raw member.
accepted answer: http://stackoverflow.com/a/23670880
has comment: http://stackoverflow.com/comment/36365264
has comment: http://stackoverflow.com/comment/36364058
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23670880
has comment: http://stackoverflow.com/comment/36364091
tagged with: hash
has comment: http://stackoverflow.com/comment/36362789
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36364195
tagged with: guava
score: 1
tagged with: java
tagged with: certificate
has comment: http://stackoverflow.com/comment/36362714
type: Question
has title: Mismatched base32 encoded hash of certificate
has comment: http://stackoverflow.com/comment/36365396
has comment: http://stackoverflow.com/comment/36362838

http://stackoverflow.com/comment/36520230
type: Comment
type: QuestionComment
has text: I still cannot make it
score: 0
comment on: http://stackoverflow.com/q/23752875

http://stackoverflow.com/a/23638619
answers question: http://stackoverflow.com/q/23638458
upvote count: 1
has body: You probably started out by saying, I want this to loop until shotHit is 3 or until aiHShotHit is 3. That would be while (!(shotHit == 3 || aiShotHit == 3)); which is "loop while it is not the case that either shotHit or aiShotHit contains the value 3", but it's kind of ugly so you wanted to apply the negation operator to each subexpression and get rid of some parens. The mistake was thinking you can move the negation operator without changing anything else to get while (shotHit != 3 || aiShotHit != 3); This exits the loop only in the event that shotHit is 3 at the same time that aiShotHit is 3. Not what you want. The correct transformation is while (shotHit != 3 &amp;&amp; aiShotHit != 3); This much was covered in the comments. The guidelines for how to safely transform this kind of expression are De Morgan's rules, which describe how to transform conjunctions and disjunctions in terms of each other. Following those rules lets you can move the negation operator and change the parenthesization without changing the meaning of the expression: "not (A or B)" is the same as "(not A) and (not B)" "not (A and B)" is the same as "(not A) or (not B)" Needing to reorganize an expression to make it more readable comes up a lot in programming and this is a tool you need in order to do it safely. If you want to know more about De Morgan's rules you might want to read this answer.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/23760031
tagged with: network-programming
has comment: http://stackoverflow.com/comment/36534297
score: -1
has comment: http://stackoverflow.com/comment/36533291
tagged with: chat
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36532807
favorite count: 0
has answer: http://stackoverflow.com/a/23760583
has body: So here's my problem. I'm working on implementing a chat application though a server/client network, using sockets, between 2 smartphones. My code used as an application, works fine to send messages between the 2 smartphones. But, i would like to put this code, in a different application and using all my code as an activity. And here... it doesn't work anymore. I've copied/pasted all the code of my first chat application in new java classes in the new application, pasted the parts of the Android manifest as well. Only one device seems to connect to the other. Would you have any idea ? Thanks
has comment: http://stackoverflow.com/comment/36533359
has comment: http://stackoverflow.com/comment/36533500
has comment: http://stackoverflow.com/comment/36533530
tagged with: sockets
tagged with: android
has title: Why activity works in an application but doesn't in another application?
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/23739788
answer count: 2
has body: I am new to android programming and now I'm learning how to build an Android alarm clock application where it will display "rise and shine" after 20 seconds from whatever the time happened to be when the button was clicked. However, each time it would force close in both emulator and my phone. And the popped-out window keep displaying "The application alarmmanager2 (process com.example.alarmmanager2) has stopped unexpectedly. Pls try again." And this is the source code: layout: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Alarm Example" /> src/java: package alarmmanager2; import com.example.alarmmanager2.*; import android.os.Bundle; import android.os.SystemClock; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; public class Main extends Activity implements OnClickListener{ final static private long ONE_SECOND = 1000; final static private long TWENTY_SECONDS = ONE_SECOND * 20; PendingIntent pi; BroadcastReceiver br; AlarmManager am; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setup(); findViewById(R.id.the_button).setOnClickListener(this); } private void setup() { br = new BroadcastReceiver() { @Override public void onReceive(Context c, Intent i) { Toast.makeText(c, "Rise and Shine!", Toast.LENGTH_LONG).show(); } }; registerReceiver(br, new IntentFilter("com.authorwjf.wakeywakey") ); pi = PendingIntent.getBroadcast( this, 0, new Intent("com.authorwjf.wakeywakey"), 0 ); am = (AlarmManager)(this.getSystemService( Context.ALARM_SERVICE )); } @Override public void onClick(View v) { am.set( AlarmManager.ELAPSED_REALTI…
downvote count: 1
tagged with: android-layout
tagged with: java
type: UnansweredQuestion
has title: Developing app is forced to close every time
has comment: http://stackoverflow.com/comment/36494075
score: 2
has answer: http://stackoverflow.com/a/23740404
favorite count: 0
has comment: http://stackoverflow.com/comment/36494505
type: Question
has comment: http://stackoverflow.com/comment/36494078
tagged with: android
has answer: http://stackoverflow.com/a/23753586
has comment: http://stackoverflow.com/comment/36494080
upvote count: 3

http://stackoverflow.com/comment/36446085
has text: The app is crashing. Let me get my logcat real quick.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23714726

http://stackoverflow.com/q/23732744
has comment: http://stackoverflow.com/comment/36482417
tagged with: alarmmanager
has comment: http://stackoverflow.com/comment/36481094
score: 0
has title: Set Phone Alarm Code
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23732935
has comment: http://stackoverflow.com/comment/36482601
type: UnansweredQuestion
tagged with: alarm
linked to: http://stackoverflow.com/q/9618748
has body: I am making a app where I get a date-time from the database and then I want to use the time to set an alarm on the phone. Not on the app. The alarm should be set on the Phone's clock application (Android clock). I searched the web and couldn't find any useful answers. Please help. Thanks :D Making my questions more understandable :- My activity has a textview whos value is :- 2014-05-17 16:30 And it has a button. When i click that button i want to set an alarm on the android clock on that time.
has comment: http://stackoverflow.com/comment/36481367
tagged with: java
duplicate of: http://stackoverflow.com/q/9618748
has comment: http://stackoverflow.com/comment/36481008
type: Question
tagged with: android-alarms

http://stackoverflow.com/a/35164108
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23725742
type: Answer
accepted answer of: http://stackoverflow.com/q/23725742
downvote count: 0
has body: You might want to look into the Dual Simplex Method (or Duality Theory). If the standard form of the primal problem is: Maximize = 13*X1 + 23*X2; with constraints: 5*X1 + 15*X2 &lt;= 480; 4*X1 + 4*X2 &lt;= 160; 35*X1 + 20*X2 &lt;= 1190; X1 &gt;= 0; X2 &gt;= 0; Then the dual problem is: Minimize = 480*Y1 + 160*Y2 + 1190*Y3; with constraints: 5*Y1 + 4*Y2 + 35*Y3 &gt;= 13; 15*Y1 + 4*Y2 + 20*Y3 &gt;= 23; Y1 &gt;= 0; Y2 &gt;= 0; Y3 &gt;= 0; I tested both of these problems in LINGO and get the same answer for both (Z = 800, X1 = 12, X2 = 28 -- Y1 = 1, Y2 = 2, Y3 = 0).
score: 1

http://stackoverflow.com/comment/36433454
has text: Read the error message: it explains why.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23707938

http://stackoverflow.com/comment/36284349
type: Comment
score: 0
has text: Did you try reading the error message? Spring Data JPA is autogenerating a query based on the method names on the repository interface, and you don't have a matching property.
comment on: http://stackoverflow.com/q/23630833
type: QuestionComment

http://stackoverflow.com/comment/36468313
comment on: http://stackoverflow.com/a/23725990
type: AnswerComment
has text: This answer would be improved by some explanation alongside the code.
score: 0
type: Comment

http://stackoverflow.com/a/23629256
answers question: http://stackoverflow.com/q/23627894
type: AcceptedAnswer
downvote count: 0
has body: (new FileChoose).run() Why it needs to be like that is clear if you consider the following example: class Bar { def foo {} } object Bar { class foo } new Bar.foo (new Bar).foo
upvote count: 2
has comment: http://stackoverflow.com/comment/36281834
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23627894

http://stackoverflow.com/q/23657595
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/23664444
has answer: http://stackoverflow.com/a/23657989
tagged with: spring-security
favorite count: 0
tagged with: rest
tagged with: spring
linked to: http://stackoverflow.com/q/20031728
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23664444
type: Question
has body: I have a spring-mvc and spring-security + spring-security-social webapplication which I would like to provide restful login to allow a rest client to interact via this application. Let me explain a little bit more: For the web application, everything is working fine. Login, roles, Facebook login, without any xml using Spring-Core version 4 and Spring-Security version 3. Requirement Provide a restful service in which will allow the user to sign in on the application and provide its user all the access like the web login. I've been searching over the web, but I can only find old examples using older spring versions and with xml code.
accepted answer: http://stackoverflow.com/a/23657989
has title: Spring Security 3 Web + Restful Login

http://stackoverflow.com/a/23756541
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36526845
upvote count: 26
accepted answer of: http://stackoverflow.com/q/23756456
type: Answer
has comment: http://stackoverflow.com/comment/36526640
answers question: http://stackoverflow.com/q/23756456
downvote count: 0
score: 26
has body: You can use split(regex,limit) method of String class. Try String[] result = yourString.split("\n", 2); If you want to use OS dependent line separator String[] result = yourString.split(System.lineSeparator(), 2); or OS independent way //since Java 8 String[] result = yourString.split("\\R", 2); //before Java 8 String[] result = yourString.split("\r\n|\r|\n", 2); Now result[0] = "line 1"; result[1] = "line 2\nline 3\n";
has comment: http://stackoverflow.com/comment/36526710
has comment: http://stackoverflow.com/comment/36526401

http://stackoverflow.com/comment/36370861
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23673143
has text: Well, I cannot understand your code (its too fragmented). But You donot need a cvMatrix. FrameGrabber.grab().image====> is an IplImage(which is rotated). You can directly do this in the loop recorder.reocord(FrameGrabber.grab().image);

http://stackoverflow.com/comment/36406040
has text: Ok sure , sir. please wait my response.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23693024
type: AnswerComment

http://stackoverflow.com/a/23739398
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36493436
accepted answer of: http://stackoverflow.com/q/23739353
type: Answer
answers question: http://stackoverflow.com/q/23739353
has comment: http://stackoverflow.com/comment/36493821
downvote count: 0
has body: You must get NPE on listView.setAdapter(adapter); because listView is not initialised correctly. You need to change: ListView listView = (ListView) getActivity().findViewById(R.id.list); to ListView listView = (ListView) rootView .findViewById(R.id.list); and make sure you have list id in fragment_directory. Your view is rootView, so you need that for finding ListView. //Edit please change ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); to ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); but your code is correct, problem is some where else.
score: 1

http://stackoverflow.com/a/23699826
has comment: http://stackoverflow.com/comment/36815285
upvote count: 0
has comment: http://stackoverflow.com/comment/36533681
has comment: http://stackoverflow.com/comment/36580517
answers question: http://stackoverflow.com/q/23696170
has body: The timeout error indicates you were able to open a socket between the client and the server, but that the socket was not serviced in a timely manner, so it closed and gave you that exception. The last time this happened to me, it happened because the client could not find the correct class libraries in its path. The server attempted to open a socket, the client went off looking for the class library and didn't find it, the socket eventually timed out. Double check the class path of both your client and server.
has comment: http://stackoverflow.com/comment/81210288
has comment: http://stackoverflow.com/comment/36534348
has comment: http://stackoverflow.com/comment/36429449
type: Answer
has comment: http://stackoverflow.com/comment/36453378
has comment: http://stackoverflow.com/comment/36888883
downvote count: 1
has comment: http://stackoverflow.com/comment/36580579
score: -1

http://stackoverflow.com/q/23708227
has answer: http://stackoverflow.com/a/23708783
has body: Ok, we have an web app with the following domain: mydomain.com/#article;articleID=1 Now we have a servlet filter mydomain.com/MyFilter public class CrawlServlet implements Filter{ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub HttpServletRequest httpRequest = (HttpServletRequest) request; String fullURLQueryString = getFullURL(httpRequest); // here we can read mydomain.com/#article;articleID=1 // if we open this mydomain.com/#article;articleID=1 we can see the article data that was taken from DB // can we somehow capture that article data? } } Can we be able to achieve that? I want to do that cos I want to show the data to Bot Crawler for indexing my page.
type: UnansweredQuestion
has title: Can a Servlet Filter capture the response of a URL that came from a same Host?
tagged with: java
type: Question
tagged with: servlets
score: 0
answer count: 1

http://stackoverflow.com/comment/36507778
has text: Does http://logging.apache.org/log4j/2.x/manual/thread-context.html help?
comment on: http://stackoverflow.com/q/23746888
score: 0
type: Comment
type: QuestionComment

pom.xml
tags question: http://stackoverflow.com/q/23632010
type: Tag
tag name: pom.xml
tags question: http://stackoverflow.com/q/23653625
tags question: http://stackoverflow.com/q/23653876

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23646098
tags question: http://stackoverflow.com/q/23771902
tags question: http://stackoverflow.com/q/23722593
type: Tag

http://stackoverflow.com/comment/36346927
type: AnswerComment
score: 1
has text: In answer to your last question @GiovanniFar, a fork doesn't know if a philosopher has two forks. That boolean variable would indicate whether that fork is held, but not by whom. The philosopher knows which ones he is holding and can check to see if a specific fork is held by someone else. Think OO.
type: Comment
comment on: http://stackoverflow.com/a/23661252

http://stackoverflow.com/comment/36519542
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23752875
has text: not required. read the docs google maps api v2

http://stackoverflow.com/comment/36345735
type: AnswerComment
score: 0
type: Comment
has text: Yup, that is perfectly valid. As @Holger mentioned in another comment, be sure to synchronize the fork setter methods as well to make them thread-safe.
comment on: http://stackoverflow.com/a/23661366

http://stackoverflow.com/comment/36371782
score: 0
type: AnswerComment
has text: Can you paste the `String` here?
comment on: http://stackoverflow.com/a/23675281
type: Comment

http://stackoverflow.com/q/23671890
linked to: http://stackoverflow.com/q/18226126
has title: Tomcat - asynchronous task for websocket servlet
upvote count: 1
has body: I have a small Java Websocket Servlet running on Tomcat 8.0.5. Usually, it answers every received message immediately. But in some use case, it would be nice to have a scheduled event, that runs exactly once after some delay and sends new messages to clients. I've already done some research, but I am not sure whether those articles fit my requirements: How to run a background task in a servlet based web application? How to schedule a task in Tomcat My approach to solve this would be some kind of a Service, that takes an integer for the delay and some other required parameters. Based on that it creates a new Thread that will send some new messages after doing Thread.sleep(integer). Is that an appropriate solution or is there some 'best practice' to solve this?
has comment: http://stackoverflow.com/comment/36365935
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36366763
tagged with: servlets
linked to: http://stackoverflow.com/q/4691132
has comment: http://stackoverflow.com/comment/36366486
answer count: 0
downvote count: 0
tagged with: websocket
score: 1
has comment: http://stackoverflow.com/comment/36366549
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36365055
type: Question
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/23728264
tagged with: servlets
type: AnsweredQuestion
has title: My servlet returns null
accepted answer: http://stackoverflow.com/a/23728269
type: Question
has body: I wrote the following form and servlet , hoping that the servlet would return the value of the text field from the form , but it returns null instead. What should be corrected ? Simple form public class theServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username=request.getParameter("userName"); response.setContentType("text/html"); PrintWriter writer=response.getWriter(); writer.println(" "); writer.println("userName = "+ username); writer.println(" "); } }
answer count: 1
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23728269
tagged with: jsp

http://stackoverflow.com/a/23650792
answers question: http://stackoverflow.com/q/23650730
has comment: http://stackoverflow.com/comment/36323975
type: Answer
accepted answer of: http://stackoverflow.com/q/23650730
score: 2
downvote count: 0
has body: Replace \ with the URL-encoded value %5c. Example: return new HttpGet("http://hostname.com/io/virtualinput.cgi?action=6:%5c");
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/36327159
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23652558
score: 4
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).

http://stackoverflow.com/q/23725929
has body: I am trying to debug an error I'm getting when I try to login to my JAVA web application. There seems to be some issue with the columns. Here is the stacktrace: anager] (http--127.0.0.1-8080-4) Login failure: javax.security.auth.login.LoginE xception: PB00019: Processing Failed:Query failed at org.jboss.security.auth.spi.DbUtil.getRoleSets(DbUtil.java:166) [pick etbox-4.0.6.final.jar:4.0.6.final] at org.jboss.security.auth.spi.Util.getRoleSets(Util.java:158) [picketbo x-4.0.6.final.jar:4.0.6.final] at org.jboss.security.auth.spi.DatabaseServerLoginModule.getRoleSets(Dat abaseServerLoginModule.java:265) [picketbox-4.0.6.final.jar:4.0.6.final] at org.jboss.security.auth.spi.AbstractServerLoginModule.commit(Abstract ServerLoginModule.java:228) [picketbox-4.0.6.final.jar:4.0.6.final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1 .7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) [rt.jar:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) [rt.jar:1.7.0_51] at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:762) [rt.jar:1.7.0_51] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:2 03) [rt.jar:1.7.0_51] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690) [ rt.jar:1.7.0_51] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688) [ rt.jar:1.7.0_51] at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1. 7.0_51] at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:6 87) [rt.jar:1.7.0_51] at javax.security.auth.login.LoginContext.login(LoginContext.java:596) [ rt.jar:1.7.0_51] at org.jboss.security.authentication.JBossCachedAuthenticationManager.de faultLogin(JBossCachedAuthenticationManager.java:449) [picketbox-infinispan-4.0. 6.final.jar:4.0.6.final] at org.jboss.security.authentication.JB…
downvote count: 0
tagged with: jboss
possible better answer: http://stackoverflow.com/a/23725991
has answer: http://stackoverflow.com/a/23725991
has answer: http://stackoverflow.com/a/23725998
has title: JBoss Form Based Authentication Failure
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23725998
tagged with: mysql
tagged with: authentication
upvote count: 1
type: Question
answer count: 2

http://stackoverflow.com/q/23638880
has title: Java: Strip everything before third slash
has comment: http://stackoverflow.com/comment/36300682
possible better answer: http://stackoverflow.com/a/23639071
has answer: http://stackoverflow.com/a/23639029
answer count: 4
has answer: http://stackoverflow.com/a/23639034
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36300746
accepted answer: http://stackoverflow.com/a/23639061
has body: I'm currently in the progress of making a java application, one of the functions is showing related emails and documents. But the full path to the email (on a sharepoint server) is displayed in the application, for obvious reasons the number of characters depends on the title of the email and the location. But they all have the same in common, there are ALWAYS 3 slashes in the title. Like this: Myserver/client/caseID/Title of Email here Is it possible to get Java to "count" the number of slashes and just delete everything before the third slash?
type: Question
has comment: http://stackoverflow.com/comment/36300703
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23639061
has answer: http://stackoverflow.com/a/23639071

http://stackoverflow.com/comment/36307680
type: Comment
type: QuestionComment
has text: What I mean by information: How to access to the selected image to apply a rectangular area capture? Right now, I have not applied any rectangular area capture, because I do not have access to my buffered image which is selected by my above code.
score: 0
comment on: http://stackoverflow.com/q/23641795

http://stackoverflow.com/a/23717677
answers question: http://stackoverflow.com/q/23717572
has body: It looks as though you are just printing the first item in the split array "words", is it possible the first occurrence of a &lt;> is empty? To view all items in the array you can use a loop like the following: var i; for (i = 0; i &lt; words.length; i++) { System.out.println(words[i]); } Each of those lines will contain all characters until the next "&lt;" so you will then need to trim to the ">" An easier way to do this is using Regular Expressions - there are some good examples here on StackOverflow. Edit: Combining your code with TAsks would produce what you are after: import java.io.*; import java.util.Scanner; public class TickTacTwice { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File("/Users/Muhammed/Documents/tic_tac_twice.txt")); while(sc.hasNextLine()) { String S = sc.nextLine(); Pattern pattern = Pattern.compile("&lt;(.+?)&gt;"); Matcher m = pattern.matcher(S); while(m.find()) { System.out.println(m.group(0)); } } sc.close(); } }
has comment: http://stackoverflow.com/comment/36469037
score: 0
type: Answer

http://stackoverflow.com/a/24197620
has body: You have to look at both the 0x70 and 0x71 tags. 0x70 has the cert data, and 0x71 tells you the format (an over simplification would be 0 uncompressed and 1 is compressed (gzip)) also the value is likely to be more than a single 255 byte buffer. You will need a few more lines of code before you can have a valid byte[] to pass in the X509 "factory".
has comment: http://stackoverflow.com/comment/42982870
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23701657
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36275020
has text: That took a while. Haha. Thanks, @JonSkeet :)
score: 1
comment on: http://stackoverflow.com/a/23625575
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23637233
has comment: http://stackoverflow.com/comment/36297586
has answer: http://stackoverflow.com/a/23637574
has comment: http://stackoverflow.com/comment/36297318
has comment: http://stackoverflow.com/comment/36297618
has comment: http://stackoverflow.com/comment/36297883
answer count: 1
has title: Why would SwingUtilities.invokeLater be throwing a NullPointerException?
favorite count: 0
tagged with: event-dispatch-thread
upvote count: 2
has comment: http://stackoverflow.com/comment/36297317
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36297339
tagged with: swing
has comment: http://stackoverflow.com/comment/36297359
score: 2
has comment: http://stackoverflow.com/comment/36297544
tagged with: java
type: Question
downvote count: 0
has body: I'm getting an exception being thrown intermittently, about one in every five executions of my application, when I try to pass a runnable to SwingUtilities.invokeLater. It seems to only happen when the application starts up, maybe before the Event Dispatch Thread is properly setup? I'm not really sure, but if the application comes up properly, then I don't have any problems after that. Here is the exception: Exception in thread "Thread-3" java.lang.NullPointerException at java.awt.EventQueue.invokeLater(Unknown Source) at javax.swing.SwingUtilities.invokeLater(Unknown Source) at com.mypackage.MyClass.myMethod(MyClass.java:126) I'm not sure why a call to SwingUtilities.invokeLater would die like this. There must be something goofy going on. For reference, here is the actual source code of MyClass.java: 118: public void myMethod(final VariableA variableA, final VariableB variableB, final VariableC variableC) { 119: if (variableA == null) 120: throw new NullPointerException("no variable A"); 121: if (variableB == null) 122: throw new NullPointerException("no variable B"); 123: if (variableC == null) 124: throw new NullPointerException("no variable C"); 125: 126: SwingUtilities.invokeLater(new Runnable() { 127: @Override 128: public void run() { 129: MyClass.this.processMyMethod(variableA, variableB, variableC); 130: }); 131: } 132: } Any ideas here what could be causing this?

http://stackoverflow.com/comment/36552714
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23768393
has text: You don't have to 'control' anything. You have to *analyze.*

http://stackoverflow.com/a/23646848
type: Answer
upvote count: 17
has body: Java doesn't have a syntax like that, but you can put the "or" in a regex: if (!str5.matches(".*(Vertex|Name|Transmittance).*")) { Note that java's matches() (unlike many other languages) must match the whole string to return true, hence the .* at each end of the regex.
answers question: http://stackoverflow.com/q/23646813
downvote count: 0
score: 17

http://stackoverflow.com/a/23646930
type: Answer
has comment: http://stackoverflow.com/comment/36316460
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23646803
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23646803
has body: Add some time in your date and add by loop in your collection ... you can get help how to add some time in date by following link Java : how to add 10 mins in my Time String myTime = "14:10"; SimpleDateFormat df = new SimpleDateFormat("HH:mm"); Date d = df.parse(myTime); Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.MINUTE, 10); String newTime = df.format(cal.getTime());

http://stackoverflow.com/comment/36419267
has text: There are simple String methods in the API (ex. `contains()`). Did you try to google? For example, "java validate timestamp": http://stackoverflow.com/questions/5902310/how-do-i-validate-a-timestamp
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23700606
type: QuestionComment

http://stackoverflow.com/comment/36401388
has text: thank you a lot @rayryeng! I am just a beginner at image processing, but this sure is fun to work with
comment on: http://stackoverflow.com/q/23690425
score: 0
type: Comment
type: QuestionComment

intellij-idea
tags question: http://stackoverflow.com/q/23725813
tags question: http://stackoverflow.com/q/23733374
tags question: http://stackoverflow.com/q/23730887
tags question: http://stackoverflow.com/q/23642449
tags question: http://stackoverflow.com/q/23766466
tags question: http://stackoverflow.com/q/23690140
tags question: http://stackoverflow.com/q/23742934
tags question: http://stackoverflow.com/q/23738111
tags question: http://stackoverflow.com/q/23660161
type: Tag
tags question: http://stackoverflow.com/q/23736986
tags question: http://stackoverflow.com/q/23640513
tag name: intellij-idea
tags question: http://stackoverflow.com/q/23721422
tags question: http://stackoverflow.com/q/23652388
tags question: http://stackoverflow.com/q/23693165
tags question: http://stackoverflow.com/q/23739029
tags question: http://stackoverflow.com/q/23766467
tags question: http://stackoverflow.com/q/23757048
tags question: http://stackoverflow.com/q/23682334
tags question: http://stackoverflow.com/q/23630259
tags question: http://stackoverflow.com/q/23664751
tags question: http://stackoverflow.com/q/23771668
tags question: http://stackoverflow.com/q/23699279
tags question: http://stackoverflow.com/q/23656959
tags question: http://stackoverflow.com/q/23641507
tags question: http://stackoverflow.com/q/23724383
tags question: http://stackoverflow.com/q/23688702
tags question: http://stackoverflow.com/q/23688889
tags question: http://stackoverflow.com/q/23666399
tags question: http://stackoverflow.com/q/23655552
tags question: http://stackoverflow.com/q/23648667
tags question: http://stackoverflow.com/q/23771129
tags question: http://stackoverflow.com/q/23772676
tags question: http://stackoverflow.com/q/23673660
tags question: http://stackoverflow.com/q/23770580
tags question: http://stackoverflow.com/q/23651660
tags question: http://stackoverflow.com/q/23736342
tags question: http://stackoverflow.com/q/23778015
tags question: http://stackoverflow.com/q/23712731

http://stackoverflow.com/a/23628416
has comment: http://stackoverflow.com/comment/36280739
type: Answer
has comment: http://stackoverflow.com/comment/36280589
answers question: http://stackoverflow.com/q/23627799
score: 0
has comment: http://stackoverflow.com/comment/36280543
has comment: http://stackoverflow.com/comment/36287750
has body: This is how I did it, when I had such a requirement public class Schedule { public Schedule()throws Exception{ SchedulerFactory sf=new StdSchedulerFactory(); Scheduler sched=sf.getScheduler(); sched.start(); JobDetail jd=new JobDetailImpl("myjob",sched.DEFAULT_GROUP,QuartzJob.class); SimpleTrigger st=new SimpleTriggerImpl("mytrigger",sched.DEFAULT_GROUP,new Date(), null,SimpleTrigger.REPEAT_INDEFINITELY,60L*1000L); sched.scheduleJob(jd, st); } public static void main(String args[]){ try{ new Schedule(); }catch(Exception e){} } } ================================== public class QuartzJob implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { String[] springConfig = { "resources\\spring-batch.xml" ,"SPRING_BATCH_JOB_NAME" }; CommandLineJobRunner.main( springConfig ); System.out.println("Done"); } }
has comment: http://stackoverflow.com/comment/36280387
has comment: http://stackoverflow.com/comment/36280536
has comment: http://stackoverflow.com/comment/36285583
has comment: http://stackoverflow.com/comment/53268658

http://stackoverflow.com/q/23650953
type: Question
has answer: http://stackoverflow.com/a/23651745
has title: For ehcache to store and object is implementing serializable required?
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23651745
tagged with: serialization
tagged with: ehcache
tagged with: spring
score: 2
upvote count: 2
has body: I've encountered some code that is using Spring ehcache. The objects that are being cached do not implement the serializable interface. class MyObj(){ } List&lt;MyObj&gt; = new ArrayList&lt;MyObj&gt; So even though ArrayList implements serializable should'nt MyObj also implement serializable for ehcache to work correctly ?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36486295
comment on: http://stackoverflow.com/q/23735303
score: 0
has text: @TimB or at least `x.intValue() == y.intValue()`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23680734
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/36382732
has comment: http://stackoverflow.com/comment/36387604
has title: Clicking on a particular button of a particular record in a webTable
accepted answer: http://stackoverflow.com/a/23683598
answer count: 1
downvote count: 0
favorite count: 0
tagged with: xpath
has body: In our application, i have a scenario to click on edit icon for a particular user. So currently i am using the following code: Below is the html source of the Edit button: HemaSundar 52A-4EB-52C-294 HemaSundar HemaSundar Banking, Admin, System, EuropeanGate, SAP, MBS, Audit, Confidential Payments, iPhone App ui-button Here is the code i am using now: WebElement overview = driver.findElement(By.id("defaultOverviewTable_data"));// considering the complete webtable List<WebElement> individualRows = overview.findElements(By.tagName("tr"));//considering invidual user for (WebElement wb: individualRows) { List<WebElement> indWb = wb.findElements(By.tagName("td"));// considering individual columns for individual users System.out.println(indWb.get(1).getText()); if (indWb.get(1).getText().equalsIgnoreCase(username))// if the username equals the expected { List<WebElement> allButtons = wb.findElements(By.tagName("button"));// getting all the buttons of that user for (WebElement edit: allButtons) { System.out.println(edit.getAttribute("title")); if (edit.getAttribute("title").matches("Edit")) { edit.click();// clicking on button where title is Edit. break; } } break; } } Some times in there are more than 300 user in the table, Then if i want to click edit for a user which is at 200 position approximatlely. It is taking more time. Is there any other way by using XPATH for clicking on edit button where username column equal to a particular name? Note: IDs of the buttons are not constant.
upvote count: 2
has answer: http://stackoverflow.com/a/23683598
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36386340
has comment: http://stackoverflow.com/comment/36382943
tagged with: java

http://stackoverflow.com/a/23735674
type: Answer
accepted answer of: http://stackoverflow.com/q/23734947
score: 1
upvote count: 1
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23734947
has body: Change your setDisplay() Method from public void setDisplay(int index){ jplType.add(jlblOptions); jplType.add(jtfOptions); jplType.setBorder(new TitledBorder(employeeTitles[index])); if(index == 0){ jlblOptions.setText("Office:"); jtfOptions.setText(""); } else if(index == 1) { jlblOptions.setText("Air Time:"); jtfOptions.setText("0"); JCheckBox jcbCaptain = new JCheckBox("Is a Captain"); jplType.add(jcbCaptain); } else if(index == 2){ jlblOptions.setText("Air Time:"); jtfOptions.setText("0"); } else { jlblOptions.setText(""); jtfOptions.setText(""); } add(jplType, BorderLayout.CENTER); } to public void setDisplay(int index){ jplType.add(jlblOptions); jplType.add(jtfOptions); jplType.setBorder(new TitledBorder(employeeTitles[index])); if(index == 0){ jlblOptions.setText("Office:"); jtfOptions.setText(""); } else if(index == 1) { jlblOptions.setText("Air Time:"); jtfOptions.setText("0"); JCheckBox jcbCaptain = new JCheckBox("Is a Captain"); jplType.add(jcbCaptain); } else if(index == 2){ jlblOptions.setText("Air Time:"); jtfOptions.setText("0"); } else { jlblOptions.setText(""); jtfOptions.setText(""); } add(jplType, BorderLayout.CENTER); this.revalidate(); }

http://stackoverflow.com/q/23730950
has comment: http://stackoverflow.com/comment/36478374
has comment: http://stackoverflow.com/comment/36478055
has comment: http://stackoverflow.com/comment/36478327
has comment: http://stackoverflow.com/comment/36478198
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23730978
has comment: http://stackoverflow.com/comment/36477964
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36478590
accepted answer: http://stackoverflow.com/a/23730978
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36480026
has comment: http://stackoverflow.com/comment/36478289
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/23731002
answer count: 2
has answer: http://stackoverflow.com/a/23731002
has title: Is there any difference between for loop in java and c?
downvote count: 0
has body: for loop in c int i; int n = 20; for(i = 0; i + n; i-- ) { printf("-\n"); } for loop in java int i; int n=20; for (i = 0; i + n; i--) { System.out.println("-\n"); } In the above example for loop in c is working fine(will print "-" 20 times).But for loop in java shows error as Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from int to boolean why it shows this kind of error?
favorite count: 0
tagged with: iteration

http://stackoverflow.com/a/23699709
type: Answer
has body: The scope of temp_string is identical in both cases, that is, limited to the for loop. The generated byte code is almost identical. public void foo1(List&lt;String&gt; list) { for (int i=0; i&lt;list.size(); i++) { String str = list.get(i); someMethod(str); } } public void foo2(List&lt;String&gt; list) { for (int i=0; i&lt;list.size(); i++) { someMethod(list.get(i)); } } public void foo1(java.util.List); Code: 0: iconst_0 1: istore_2 2: iload_2 3: aload_1 4: invokeinterface #2, 1; //InterfaceMethod java/util/List.size:()I 9: if_icmpge 34 12: aload_1 13: iload_2 14: invokeinterface #3, 2; //InterfaceMethod java/util/List.get:(I)Ljava/lang/Object; 19: checkcast #4; //class java/lang/String 22: astore_3 23: aload_0 24: aload_3 25: invokevirtual #5; //Method someMethod:(Ljava/lang/String;)V 28: iinc 2, 1 31: goto 2 34: return public void foo2(java.util.List); Code: 0: iconst_0 1: istore_2 2: iload_2 3: aload_1 4: invokeinterface #2, 1; //InterfaceMethod java/util/List.size:()I 9: if_icmpge 32 12: aload_0 13: aload_1 14: iload_2 15: invokeinterface #3, 2; //InterfaceMethod java/util/List.get:(I)Ljava/lang/Object; 20: checkcast #4; //class java/lang/String 23: invokevirtual #5; //Method someMethod:(Ljava/lang/String;)V 26: iinc 2, 1 29: goto 2 32: return The only difference with the first loop (assigning to a String, then passing the String to the method) is an extra astore_3 and aload_3. This should be easy for the JVM to optimize out. Also note that the second loop (no extra variable assignment) is easier to read.
score: 0
answers question: http://stackoverflow.com/q/23699452

http://stackoverflow.com/comment/36316602
comment on: http://stackoverflow.com/q/23646997
type: Comment
type: QuestionComment
has text: i am looking for relevant code in java for same output.
score: 0

http://stackoverflow.com/comment/36416234
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your answer. I will look up what you said and verify that everything is as it should be. Unfortunately I can't post too big chunks of the code since it's not open source, but I will make it more clear in further posts. Thanks again, i'll be back and accept the answer if it helped!
comment on: http://stackoverflow.com/a/23698416

http://stackoverflow.com/comment/36260137
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23617672
score: 0
has text: Also note that if you aren't allowed to use a toLowerCase function that you can roll your own compare ignorecase method with the knowledge that the int value of any Capital Character is offset by 32 (20 in hex) from it's lowercase. this only applies to letters though.

http://stackoverflow.com/a/23670296
has comment: http://stackoverflow.com/comment/36362364
score: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36362305
answers question: http://stackoverflow.com/q/23670266
downvote count: 1
has body: No it does not. Check out this blog post to see why. From that link I am posting the basics. Simplicity and Cleanliness Avoid Programming Errors JVM Complexity Easy Development of Tools Also check out this SO answer

http://stackoverflow.com/comment/36518595
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23751361
has text: I mean the Java standalone application and how you include your .dll file in your run command line

http://stackoverflow.com/comment/36453853
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23718474
score: 0
has text: Just updated the post with my test main method, which works as expected

http://stackoverflow.com/q/23621668
has answer: http://stackoverflow.com/a/23621693
has title: Java -- Closing Scanner and Resource Leak
has answer: http://stackoverflow.com/a/45946217
upvote count: 14
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/36267592
tagged with: eclipse
linked to: http://stackoverflow.com/q/12519335
downvote count: 0
type: UnansweredQuestion
score: 14
has comment: http://stackoverflow.com/comment/80101713
favorite count: 0
has body: I'm learning Java and working on some projects for fun. One issue that I have run in to is that when I use a Scanner object Eclipse warns me that: Resource Leak: 'scan' is never closed. So, I added a scan.close(); at the end of my code and that takes care of the warning. The problem comes in because I have other classes in the same package that also use scanner objects and and Eclipse tells me to close scanner in those classes respectively. However, when I do that it seems like it closes ALL of the scanner objects and I get errors during run time. Here is an example of what causes the error: import java.util.Scanner; public class test2 { public static void main(String [] args) { Scanner scan = new Scanner(System.in); int test = 0; do { //Do stuff test = scan.nextInt(); System.out.println(test); scanTest scanTest = new scanTest(); scanTest.test(); } while (test != 0); scan.close(); } } import java.util.Scanner; public class scanTest { public void test() { Scanner scanner = new Scanner(System.in); int blah = scanner.nextInt(); System.out.println(blah); scanner.close(); } } After scanner is closed in the scanTest class and the do loop in test2 is entered again an error occurs at the line test = scan.nextInt(); I tried moving the creation of the scanner object into the do loop just to make a new object every time as well but the error still occurs. Not sure why this is happening or how I can make sure all my I/O objects are closed out without running into problems. One post I came across mentioned that when System.in is closed I cannot be re-opened. If this is the case would I just need to make sure a scanner object with System.in is closed at the very end of the program and @suppress all of the other scanner warnings in other classes? Or would that still leave all those scanner objects open (bad)?
tagged with: java.util.scanner
type: Question
has answer: http://stackoverflow.com/a/23621735

http://stackoverflow.com/comment/36385519
type: Comment
type: QuestionComment
has text: i think you cannot access a jar from another jar for that you will have to place the resource jar at the root with the main jar file and then access it
comment on: http://stackoverflow.com/q/23682386
score: 0

http://stackoverflow.com/a/31242400
has body: As far as I understood you want to access information which is in view fields. To do this you dont need to have controller object in view. But you should have view and model both the objects in Controller. MVC pattern tells that all the connections between view and model should be done through controller only. you can get some more information here http://shulgadim.blogspot.in/2012/01/model-view-controller-mvc-pattern_13.html
answers question: http://stackoverflow.com/q/23696308
score: 0
type: Answer

http://stackoverflow.com/q/23765821
has comment: http://stackoverflow.com/comment/36544829
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36545182
has comment: http://stackoverflow.com/comment/36544706
has title: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet error
has body: Not sure why am I getting this error. Lots of similar questions here but none have worked for me till now. My ivy file is <dependency org="org.springframework" name="spring-core" rev="4.0.3.RELEASE"/> <dependency org="org.springframework" name="spring-context" rev="4.0.3.RELEASE"/> <dependency org="org.springframework" name="spring-web" rev="4.0.3.RELEASE"/> <dependency org="org.springframework" name="spring-webmvc" rev="4.0.3.RELEASE"/> <dependency org="org.springframework" name="spring-beans" rev="4.0.3.RELEASE"/> and my web.xml is <?xml version="1.0" encoding="UTF-8"?> Knox Web Interface action org.springframework.web.servlet.DispatcherServlet 1 action /* I have resolved ivy. Still getting the error. Also i can see the Class in my eclipse. I am really stuck at this. Any help or suggestion is appreciated. PS : I also tried adding < dependency org="org.springframework" name="spring" rev="2.5.6"/> but ivy does not resolve. I get Some projects fail to be resolved Impossible to resolve dependencies of #TestWebProject;working@BLT430LT3201C download failed: com.oracle.toplink#toplink;10.1.3!toplink.jar unresolved dependency: com.oracle#oc4j;1.0: not found unresolved dependency: com.oracle#toplink-essentials;2.41: not found unresolved dependency: javax.ejb#ejb;3.0: not found download failed: com.bea.wlplatform#commonj-twm;1.1!commonj-twm.jar unresolved dependency: jexcelapi#jxl;2.6.6: not found download failed: javax.jms#jms;1.1!jms.jar download failed: javax.faces#jsf-api;1.1!jsf-api.jar download failed: javax.resource#connector;1.0!connector.jar Not sure if this has anything to do with above problem. I am searching http://mvnrepository.com/artifact/org.springframework for all dependency info. My project structure is WEB-INF/lib directory is empty. Source : http://opensourceforgeeks.blogspot.in/2014/05/javalangclassnotfoundexception.html
has comment: http://stackoverflow.com/comment/36544555
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/23766404
has comment: http://stackoverflow.com/comment/36544459
score: 6
tagged with: spring
type: Question
accepted answer: http://stackoverflow.com/a/23766404
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36544794
has comment: http://stackoverflow.com/comment/36544856
tagged with: java
tagged with: ivy
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36544358

http://stackoverflow.com/q/23655338
tagged with: jsp
has answer: http://stackoverflow.com/a/23681862
favorite count: 0
tagged with: ajax
has body: I have one table in mysql which has three field with data inserted. there are three fields in it which are as below. i want to display this data on a web browser with using ajax in java. i search on a net and find this below code are most useful Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ajax_demo","root",""); PreparedStatement ps=con.prepareStatement("select * from ajax"); what are other things i have to implement for displaying output.
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
tagged with: servlets
has comment: http://stackoverflow.com/comment/36343934
has title: How to display data of MYSQL in java with using of AJAX
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36477004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23729786
has text: I am sorry for the late reply! i have edited and showed where i am facing the problem But it is compilable only. I posted whole code because no body has to face the problem when running the code.

http://stackoverflow.com/q/23678919
type: Question
tagged with: xstream
has body: I have xml something like 15 Instead of creating a message object inside parent object, I need to represent message just as a String . So , when I do parent.message , the output is 15 instead of a message object.
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/23709611
score: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: xml-serialization
upvote count: 2
has title: get xml as string instead of class with xstream
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23709611

http://stackoverflow.com/comment/36480734
has text: This is for basic authentication with PUT. If your server doesn't need this to authenticate then simply don't use it.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23731407
type: AnswerComment

http://stackoverflow.com/comment/36515832
has text: You should first find out what does the Ccleaner do (model the behavior and its environment e.g. PC, Registry, HKCR, HKCU..Uninstall etc.) then you can guess how is it composed internally be envisioning how would you write such a tool by yourself. How would you organize the code. This http://stackoverflow.com/a/23301076/2626313 answer contains some useful links, first look at how to paper&pencil model behavior on the Agile Modeling website
type: QuestionComment
comment on: http://stackoverflow.com/q/23740436
type: Comment
score: 0

http://stackoverflow.com/q/23759130
has comment: http://stackoverflow.com/comment/36536354
has comment: http://stackoverflow.com/comment/36540491
answer count: 1
has comment: http://stackoverflow.com/comment/36539297
has comment: http://stackoverflow.com/comment/36539911
has comment: http://stackoverflow.com/comment/36537762
has comment: http://stackoverflow.com/comment/36534478
has body: I got a problem, with my hibernate database connection. At first I post some data: Objects.java: @Entity @Table (name = "objects", schema="genmeta") public class Objects { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int o_id; private String o_name; private String o_desc; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable(name = "genmeta.object_tg_assc", joinColumns = { @JoinColumn(name = "o_id") }, inverseJoinColumns = { @JoinColumn(name = "tg_id") }) private Set&lt;TemplateGroup&gt; templateGroups; @Transient private boolean templateGroupsLoaded = false; /** * Getters and Setters */ } TemplateGroup.java: public class TemplateGroup { @Id @Column(unique=true, nullable=false) private int tg_id; private String tg_name; private String tg_desc; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "templateGroups") private Set&lt;Objects&gt; objects; /** * Getters and Setters */ } My Problem is, how I could get from my class Object later the data? Here is my first try: Code Example: public Set&lt;TemplateGroup&gt; loadTemplateGroups(Objects myObjects) { Session session = factory.openSession(); Set&lt;TemplateGroup&gt; myTG = myObjects.getTemplateGroups(); session.close(); return myTG; } Thanks a lot. Best regards Björn
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36539571
tagged with: many-to-many
tagged with: java
tagged with: hibernate
tagged with: database
accepted answer: http://stackoverflow.com/a/23763814
type: Question
linked to: http://stackoverflow.com/q/2536829
has comment: http://stackoverflow.com/comment/36533619
has comment: http://stackoverflow.com/comment/36540156
linked to: http://stackoverflow.com/q/5404599
has answer: http://stackoverflow.com/a/23763814
has comment: http://stackoverflow.com/comment/36534530
score: 0
has title: Get data in a many-to-many connection

http://stackoverflow.com/comment/36413920
type: QuestionComment
has text: Added error (edited to remove company specifics). The error is no different from each attempt to fix.
comment on: http://stackoverflow.com/q/23697431
score: 0
type: Comment

http://stackoverflow.com/a/23689614
has comment: http://stackoverflow.com/comment/36399499
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23689400
upvote count: 1
has comment: http://stackoverflow.com/comment/36399476
has body: BorderLayout will give you the base requirement, centre and right, but you'll likely need to use something like GridBagLayout to accomplish the second requirement if you have more then one button, but FlowLayout might be able to achieve it as well Updated with an example This is a simple example as a proof of concept... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class SimpleGui { public static void main(String[] args) { new SimpleGui(); } public SimpleGui() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); JButton btn = new JButton("Solve"); JPanel right = new JPanel(); right.add(btn); frame.add(right, BorderLayout.EAST); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setBackground(Color.BLUE); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } } }

apache
tag name: apache
tags question: http://stackoverflow.com/q/23763272
tags question: http://stackoverflow.com/q/23644090
tags question: http://stackoverflow.com/q/23654978
tags question: http://stackoverflow.com/q/23709175
tags question: http://stackoverflow.com/q/23638249
tags question: http://stackoverflow.com/q/23722242
tags question: http://stackoverflow.com/q/23629830
tags question: http://stackoverflow.com/q/23660642
tags question: http://stackoverflow.com/q/23638815
tags question: http://stackoverflow.com/q/23732920
tags question: http://stackoverflow.com/q/23660811
tags question: http://stackoverflow.com/q/23730382
tags question: http://stackoverflow.com/q/23637905
tags question: http://stackoverflow.com/q/23776121
tags question: http://stackoverflow.com/q/23759059
tags question: http://stackoverflow.com/q/23734124
tags question: http://stackoverflow.com/q/23642951
type: Tag
tags question: http://stackoverflow.com/q/23629118
tags question: http://stackoverflow.com/q/23678518
tags question: http://stackoverflow.com/q/23648373
tags question: http://stackoverflow.com/q/23695236
tags question: http://stackoverflow.com/q/23663946

http://stackoverflow.com/q/23706260
has answer: http://stackoverflow.com/a/23706285
has answer: http://stackoverflow.com/a/23708759
has comment: http://stackoverflow.com/comment/36430544
tagged with: optimization
score: 0
has body: Are there any differences between these two snippets? Performance? Readability? Otherwise? if (arg &gt; 0) { for (int i = 0; i &lt; arg; i++) { sb.append("&gt;"); } } else if (arg &lt; 0) { for (int i = 0; i &lt; Math.abs(arg); i++) { sb.append("&lt;"); } } for (int i = 0; i &lt; Math.abs(arg); i++) { if (arg &gt; 0) { sb.append("&gt;"); } else if (arg &lt; 0) { sb.append("&lt;"); } } Personally, I prefer the former, as it more clearly shows that arg is a constant.
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36430523
has title: Is there a benefit to one of these statements
has answer: http://stackoverflow.com/a/23711230
has answer: http://stackoverflow.com/a/23706281
favorite count: 0
has comment: http://stackoverflow.com/comment/36433799
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23708209
tagged with: java
has comment: http://stackoverflow.com/comment/36430621
type: Question

http://stackoverflow.com/q/23656060
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/23659383
tagged with: tyrus
upvote count: 1
answer count: 1
tagged with: websocket
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has title: Should ServerEndpointConfig.Configurator instance be thread safe?
downvote count: 0
has body: I want to share some information between websocket connections. The shared data is a bit complex so I can not use EndpointConfig.getUserProperties(). I want to extend ServerEndpointConfig.Configurator and add my own data structures.(I don't want to override other methods such as getEndpointInstance). The question is should I use thread safe data structures? Or I can use any data structure and web socket container will guarantee that my instance of ServerEndpointConfig.Configurator will be accessed in safe manner.
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/36539773
type: Comment
comment on: http://stackoverflow.com/q/23763350
score: 0
type: QuestionComment
has text: My Classloader is to load a dynamically created class within the app at a later date

http://stackoverflow.com/a/23729164
upvote count: 1
answers question: http://stackoverflow.com/q/23729029
has body: Part of your problem is, you are shadowing your variables... max ++; rBook[] rpg2 = Arrays.copyOf(rpg, rpg.length); rBook[] rpg = Arrays.copyOf(rpg2, max); Here, you've declared rpg as a local variable, so any changes you make to it are not seen by the rest of the class. Try using something more like... rpg = Arrays.copyOf(rpg2, max); instead... You could also consider using System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length) instead...but I'd fix you other problems first ;) rBook[] rpg2 = new rBook[rpg.length + 1]; System.arraycopy(rpg, 0, rpg2, 0, rpg.length - 1); rpg = rpg2; Or something like that...
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23729029
score: 1

http://stackoverflow.com/a/23638100
has comment: http://stackoverflow.com/comment/36299673
has comment: http://stackoverflow.com/comment/36302588
has comment: http://stackoverflow.com/comment/36299125
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/36299020
has body: Try to open a browser and go to http://localhost:8080. If you're lucky, you have another server running and it'll serve a page. Otherwise, I'll try to dig more to help you. EDIT 1 : The server seems to answer (even if the requested resource wasn't found), so you should have another server running. Take a look at http://support.microsoft.com/kb/284285 for troubleshooting HTTP connexion problems, and give us the result
downvote count: 0
has comment: http://stackoverflow.com/comment/36299709
has comment: http://stackoverflow.com/comment/135682868
has comment: http://stackoverflow.com/comment/92463163
accepted answer of: http://stackoverflow.com/q/23637905
has comment: http://stackoverflow.com/comment/36302424
score: 10
answers question: http://stackoverflow.com/q/23637905
has comment: http://stackoverflow.com/comment/36302305
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/87049891

http://stackoverflow.com/a/23701359
has comment: http://stackoverflow.com/comment/36420765
type: Answer
answers question: http://stackoverflow.com/q/23701106
score: 2
has comment: http://stackoverflow.com/comment/36435949
has comment: http://stackoverflow.com/comment/36420972
upvote count: 2
has body: InputStream returnStrem = (InputStream)client.target("http://localhost:8080/TestJerseyProject") .path("rest/save") .request(new MediaType[] {MediaType.APPLICATION_OCTET_STREAM_TYPE}) .get(InputStream.class); With the last statement you are actually asking to collect an instance of InputStream where, in fact, you should be asking for the object you are expecting to receive. From the Server code it seems that you should be requesting a MyObj.class so the client code would actually be more like MyObj myObj = client.target("http://localhost:8080/TestJerseyProject") .path("rest/save") .request(new MediaType[] {MediaType.APPLICATION_OCTET_STREAM_TYPE}) .get(MyObj.class); I am unfamiliar with using streams in this fashion so you may have to tweak it...
has comment: http://stackoverflow.com/comment/36434737
downvote count: 0
has comment: http://stackoverflow.com/comment/36434861
has comment: http://stackoverflow.com/comment/36421179
has comment: http://stackoverflow.com/comment/36421568
has comment: http://stackoverflow.com/comment/36420875

http://stackoverflow.com/comment/36343750
comment on: http://stackoverflow.com/q/23660817
type: QuestionComment
type: Comment
has text: Do you mean build a .class file from a .txt file? I would look into a Java Compiler API.
score: 0

http://stackoverflow.com/comment/36557036
comment on: http://stackoverflow.com/q/23769956
type: Comment
has text: @SotiriosDelimanolis Hello, as you can read, i did clarify the question and i was given many proper answers. Thanks for the suggestions.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36497122
type: Comment
comment on: http://stackoverflow.com/a/23725072
type: AnswerComment
has text: Well then this won't help you!
score: 0

http://stackoverflow.com/q/23767458
tagged with: ubuntu
tagged with: linux
has comment: http://stackoverflow.com/comment/36548650
linked to: http://stackoverflow.com/q/1736828
linked to: http://stackoverflow.com/q/1457071
has comment: http://stackoverflow.com/comment/36548998
has answer: http://stackoverflow.com/a/23768415
type: UnansweredQuestion
has body: I use ubuntu. The way ubuntu handles keyboard input is different from that of windows. In ubuntu, after a key pressed event is triggered, a key released event is triggered immediately after that, even if you do not release the key. These false key Released events are making it difficult for me to program games, especially programming the collision detection. No matter how perfect my code is, I am not able to solve the problem. As a proof, if you just write a program which will output whether a key is pressed or release, you will see that the output in ubuntu will appear like this - keyPressed > keyReleased > keyPressed > keyReleased and so on even if you do not release the key. Whereas in windows - key Pressed > key Pressed > key Pressed> key Pressed and so on. Do you know any way to deal with this? Here is a simple code that will make my issue clear, if you run this on ubuntu:- import java.awt.Dimension; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; public class Strange extends JPanel implements KeyListener{ public Strange(){ this.setPreferredSize(new Dimension(500, 500)); addKeyListener(this); setFocusable(true); JFrame frame=new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(this); frame.pack(); frame.setVisible(true); } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_LEFT) System.out.println("left is pressed"); } @Override public void keyReleased(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_LEFT) System.out.println("left is released"); } @Override public void keyTyped(KeyEvent e) {} public static void main(String[] args){ new Strange(); } }
has comment: http://stackoverflow.com/comment/36549324
has comment: http://stackoverflow.com/comment/36547810
has comment: http://stackoverflow.com/comment/36548824
tagged with: keyevent
has comment: http://stackoverflow.com/comment/36549149
score: 0
tagged with: java
tagged with: keylistener
has title: How do you handle keyboard events in linux?
has comment: http://stackoverflow.com/comment/36552511
type: Question
has comment: http://stackoverflow.com/comment/36548165
answer count: 1

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/23741625
tags question: http://stackoverflow.com/q/23656857
tag name: restful-architecture

http://stackoverflow.com/q/23728360
answer count: 1
has comment: http://stackoverflow.com/comment/36473242
has comment: http://stackoverflow.com/comment/36473243
has comment: http://stackoverflow.com/comment/36473236
has title: Why do JButtons that open webpages only work the first time one is clicked and then get deactivated?
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36473219
tagged with: jbutton
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23728382
has comment: http://stackoverflow.com/comment/36473261
type: Question
downvote count: 0
tagged with: url
has comment: http://stackoverflow.com/comment/36473229
favorite count: 0
has body: I have a set of JButtons, each of which opens a separate YouTube video webpage. When first running the program, I can click on any ONE button and get the video page. When I try to get another video page with a button click, it doesn't work - in fact, all the buttons are deactivated. This is the case whether or not I close the video webpage. How can I keep all the buttons activated? Thanks in advance. Here's the code for reference. The button links and tags are populated from a text file. //import statements public class VideoRecord extends JFrame { private File videoRecordFile; public VideoRecord() throws FileNotFoundException { setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new GridLayout(2,2)); setSize(new Dimension(500, 500)); videoRecordFile = new File("videorecord.txt"); getButtons(); pack(); } public void getButtons() throws FileNotFoundException { Scanner input = new Scanner(videoRecordFile); while (input.hasNextLine()) { Scanner lineInput = new Scanner(input.nextLine()); while (lineInput.hasNext()) { final String urlString = lineInput.next(); String buttonText = lineInput.next(); JButton btn = new JButton(buttonText); add(btn); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { URL videoURL = new URL(urlString); URLConnection videoConnection = videoURL.openConnection(); videoConnection.connect(); openWebpage(videoURL); } catch (MalformedURLException mue) {} catch (IOException ioe) {} setEnabled(false); } }); } } } public static void openWebpage(URI uri) { Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null &amp;&amp; desktop.isSupported(Desktop.Action.BROWSE)) { try { desktop.browse(uri); } catch (Exception e) { e.printStackTrace(); } } } public static void openWebpage(URL url) { try { openWebpage(url.toURI()); } catch (URISyntaxException e) { e.printStackTrace(); } } public static void main(String[] args) throws FileNotFoundException { VideoRecor…
accepted answer: http://stackoverflow.com/a/23728382

http://stackoverflow.com/comment/36387080
type: Comment
comment on: http://stackoverflow.com/a/23683085
score: 0
type: AnswerComment
has text: kindly can you please explain how to use thread insted of loop i am new to threads??

http://stackoverflow.com/comment/96783545
type: Comment
comment on: http://stackoverflow.com/a/23637530
score: 0
type: AnswerComment
has text: This is several years old now, but I agree with the majority here. Using a loop for a non-looping syntax counter-intuitive. As stated by Andrei, would it not be better to abstract this to a method and do the following: `if (!condition) return;` You can then follow this same pattern with guard statements all the way until you are ready to execute `//do something`. No looping required. This seems much more readable to me as a programmer will first assume that a loop will loop more than once.

http://stackoverflow.com/a/23738479
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36492043
has comment: http://stackoverflow.com/comment/36491757
upvote count: 1
answers question: http://stackoverflow.com/q/23738151
has body: You should work only with Date object instread of String. Format your date into string only when you whant to display it. With a Date object you will be able to get the value in ms and do computation on it. You can also use Calendar to breakdown a date.
type: Answer

http://stackoverflow.com/comment/36283383
type: QuestionComment
has text: Use Javadoc. Alternatively if you are using some IDE, user Classname.<ctrl+space>
comment on: http://stackoverflow.com/q/23630143
score: 0
type: Comment

http://stackoverflow.com/comment/36323112
has text: Here you are showing an SQL join, that's not something which relates to a Lucene index directly. You need to show your entities and how you index them. Are the entities mapping the INDEXING and DATA_PROPERTY tables associated? As the question stands now, there is not enough information to help you.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23625846
type: Comment

http://stackoverflow.com/a/23669629
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23668508
has body: First of all just insert an ImageIcon in JLabel. If you want an image act as button, you have to add MouseListener &amp; implement mouseClicked() as I did. import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.*; public class MyFrame extends JFrame{ private JLabel label; private static MyFrame frame; public MyFrame(){ initComponent(); label.addMouseListener(new MouseListener(){ @Override public void mouseClicked(MouseEvent arg0) { JOptionPane.showMessageDialog(frame, "You just clicked the image"); } @Override public void mouseEntered(MouseEvent arg0) {} @Override public void mouseExited(MouseEvent arg0) {} @Override public void mousePressed(MouseEvent arg0) {} @Override public void mouseReleased(MouseEvent arg0) {} }); } private void initComponent() { this.setSize(400, 400); this.setLocationRelativeTo(null); label = new JLabel(); label.setIcon(new ImageIcon(getClass().getResource("res/image.png"))); add(label); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible (true); } public static void main(String[] args) { frame = new MyFrame(); } }
score: 1
upvote count: 1

http://stackoverflow.com/comment/36397500
has text: I am using an outer loop to get the substrings of length from the string, so 'sub' should be different for every loop
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23688231
score: 0

http://stackoverflow.com/comment/36554369
type: QuestionComment
comment on: http://stackoverflow.com/q/23770886
has text: Why did you use `super` instead of `this`?
score: 5
type: Comment

http://stackoverflow.com/a/23706894
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/23706745
accepted answer of: http://stackoverflow.com/q/23706745
type: Answer
has body: This is because a for loop uses this format: for(initialization; boolean_expression; update){ //do this } The problem is, the boolean_expression part of your loop will never be true. You're doing: for(int i=1; i==2500; i++) Your for loop starts out with the initialization i = 1. i cannot be 2500 and 1 at the same time. What you should be doing is this: for(int i = 1; i &lt;= 2500; i++){ //do something here } This will run while i &lt;= 2500, and add 1 to i every time it loops, making it run 2,500 times. Also, another thing I noticed is that you don't have curly-brackets in your for loop, so it loops, but never does anything. You should add {} curly-brackets to your for loop, just like you would do for an if statement. So, your for loop should look like this: for(int i = 1; i &lt;= 2500; i++){ if(val.prime(i)==i){ System.out.println(i); } else if(val.divall(i)==2){ break; } else if(val.div3(i)==0){ System.out.println(i + ""); } else if(val.div8(i)==0){ System.out.println(i); } }
has comment: http://stackoverflow.com/comment/36432030

http://stackoverflow.com/q/23679642
has answer: http://stackoverflow.com/a/23680040
score: 0
answer count: 2
has body: I have the following property file MyCat.MyVal1=a,b,c,d,e MyCat.MyVal2=z,d,e MyCat.MyVal3=a,b And need to construct a map with key being the key of the property file and the value a list Strings being the property value e.g. MyMap(String,List) Example having a map with Key = MyCat.MyVal1 value List a,b,c,d,e Key = MyCat.MyVal2 value List z,d,e Now I know you can read a specific value from a property file using Spring into a list @Component class MyClass { @Value("${my.property.name}") private String[] myValues; } And ultimately the only way I can figure out how to do this is to write a custom class to read all the properties line by line and take the value of the property and split them and create a list from based on that and construct a map. Just wanted to ask if there is an easier way of doing this?
linked to: http://stackoverflow.com/q/14760200
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23680215
tagged with: spring
tagged with: dictionary
tagged with: properties
tagged with: list
tagged with: java
type: Question
has title: Reading values from a property file into a Map<PropertyName, ListOfValues>?

http://stackoverflow.com/a/23639128
score: 0
has comment: http://stackoverflow.com/comment/36305770
type: Answer
has comment: http://stackoverflow.com/comment/36306903
has body: I did a similar work some time ago, I used the hosts files to block all the entries that spybot search &amp; destroy marked as "dangerous" sites. If you want to secure the site will be freeed when the app crashes, you could use a second program or thread (don't know how complex your application is) that checks if the programm is still running. Microsoft has the following entry for displaying task names: http://msdn.microsoft.com/en-us/library/windows/desktop/aa446864(v=vs.85).aspx Maybe try this code and check for your application to be alive. However, the user will notice a second task in his taskmanager........! To patch host files I used this java-method which saves entrys from a Default list model: try { BufferedWriter out; this.out = new BufferedWriter(new FileWriter("C:\\Windows\\System32\\drivers\\etc\\hosts")); for (int save = 0; save &lt; Blocker.model.size(); save++) { this.out.write((String)Blocker.model.getElementAt(save)); this.out.newLine(); } this.out.close(); } catch (IOException fail) { JOptionPane.showMessageDialog(null, "Speichern konnte nicht abgeschlossen werden", "About", 0); } I'm not sure if this will really help you, anyway good luck at your project. (Note that you have to run as administrator to get write rights to hosts-file)
has comment: http://stackoverflow.com/comment/36306241
answers question: http://stackoverflow.com/q/23638794

http://stackoverflow.com/comment/36424339
type: Comment
type: QuestionComment
has text: I've edited the post with more details of my problem.
comment on: http://stackoverflow.com/q/23687691
score: 0

http://stackoverflow.com/comment/36290149
type: QuestionComment
has text: This question doesn't have anything specific to vaadin. What you need is a method to validate string in Java. Check the link in my comment above.
score: 0
comment on: http://stackoverflow.com/q/23630943
type: Comment

http://stackoverflow.com/q/23715723
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23715772
accepted answer: http://stackoverflow.com/a/23715772
has body: I'm developing a plugin for Bukkit and I'm starting to experiment with SQL. I have everything working, and have functions for less code bloat, etc. My problem is that I noticed when I execute SQL updates the server will freeze all operations for about 5 seconds. With more looking into it, I had just enclosed all SQL statements into threads, and the issue has gone away. From my own personal guess, I imagine the freezing is caused by the SQL executing inside of the server thread, when these statements are executed since I'm waiting back on a result from the database, it will cause the main server thread to freeze until it retrieves these results, thus by putting the statements into a seperate thread this fixes the issue. My question is, is it okay that I just put all SQL statements in threads? Is this a duct tape fix? Can I do a better job at fixing this issue? Example Function public void makeUpdate(String statement){ // TO BE USED WITH - INSERT, UPDATE, or DELETE Connection con = null; Statement st = null; String url = "jdbc:mysql://127.0.0.1/mydata_base"; String user = "myuser"; String password = "mypassword"; try { con = (Connection) DriverManager.getConnection(url, user, password); st = (Statement) con.createStatement(); int rs = st.executeUpdate(statement); } catch (SQLException ex) { Logger lgr = Logger.getLogger(Version.class.getName()); lgr.log(Level.SEVERE, ex.getMessage(), ex); } finally { try { if (st != null) { st.close(); } if (con != null) { con.close(); } } catch (SQLException ex) { Logger lgr = Logger.getLogger(Version.class.getName()); lgr.log(Level.WARNING, ex.getMessage(), ex); } } } Example of code that causes server to freeze // Here would be 3 statements updating user info. // This would cause the server to freeze for about 5 seconds until these completed. makeUpdate("UPDATE blah SET blah = blah WHERE blah = blah"); makeUpdate("UPDATE blah SET blah = blah WHERE blah = blah"); makeUpdate("UPDATE blah SET blah = blah WHERE blah = blah"); Example o…
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
tagged with: bukkit
type: Question
has title: Java - SQL And Threads - Dealing With Freezing
score: 0

http://stackoverflow.com/q/23678092
tagged with: screenshot
tagged with: java
type: Question
tagged with: ios
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24281168
tagged with: macos
type: UnansweredQuestion
has body: Is it possible to capture iOS device/Simulator safari web page from MAC? Now i am proceeding to writing automation for web page loading in safari. Need to capture screenshot for loading page. Have tried with driver = new Augmenter().augment(driver); //Get the screenshot File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); System.out.println("Screenshot completed"); But came to know that it is not working in real device. So anyone please suggest how to capture device screenshot from MAC?
has title: Capture entire iphone safari web page from MAC
tagged with: safari

http://stackoverflow.com/q/23733541
linked to: http://stackoverflow.com/q/26237880
has comment: http://stackoverflow.com/comment/52946017
tagged with: java
tagged with: jenkins-plugins
has answer: http://stackoverflow.com/a/23752934
type: Question
score: 5
upvote count: 5
has body: I'm running the latest version of Jenkins (v 1.563) and Node (0.10.28). I have a Java project that builds fine. When I add a pre build step as a node script ( with Provide Node &amp; npm bin/ folder to PATH checked), I get the following error although I have given 777 permissions to everything (node, tomcat, jenkins). FATAL: command execution failed java.io.IOException: Cannot run program "/home/sam/Apps/apache-tomcat-8.0.5/temp/hudson5090518537487301688.js" (in directory "/home/sam/.jenkins/jobs/WhiteSwan/workspace"): error=13, Permission Denied.... Build step "Execute NodeJS Script" marked build as failure. When I remove the nodejs step, it builds fine. My Script is simple, node --version grunt --version bower --version Full Error: Checking out Revision e90d7b870646165dba30bd1a663644c0292e9844 (origin/master) &gt; git config core.sparsecheckout &gt; git checkout -f e90d7b870646165dba30bd1a663644c0292e9844 &gt; git rev-list e90d7b870646165dba30bd1a663644c0292e9844 [workspace] $ /home/sam/Apps/apache-tomcat-8.0.5/temp/hudson5090518537487301688.js FATAL: command execution failed java.io.IOException: Cannot run program "/home/sam/Apps/apache-tomcat-8.0.5/temp /hudson5090518537487301688.js" (in directory "/home/sam/.jenkins/jobs/WhiteSwan /workspace"): error=13, Permission denied at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042) at hudson.Proc$LocalProc.&lt;init&gt;(Proc.java:244) at hudson.Proc$LocalProc.&lt;init&gt;(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:775) at jenkins.plugins.nodejs.tools.DecoratedLauncher.launch(DecoratedLauncher.java:49) at jenkins.plugins.nodejs.tools.NpmPackagesBuildWrapper$2.launch(NpmPackagesBuildWrapper.java:88) at hudson.Launcher$ProcStarter.start(Launcher.java:355) at hudson.Launcher$ProcStarter.join(Launcher.java:362) at jenkins.plugins.nodejs.NodeJsCommandInterpreter.perform(NodeJsCommandInterpreter.java:84) at jenkins.plugins.nodejs.NodeJsCommandInterpreter.perform(NodeJsCommandInterpreter.java:42…
answer count: 2
has answer: http://stackoverflow.com/a/37203066
downvote count: 0
favorite count: 0
tagged with: jenkins
has title: Jenkins And NodeJS Plugin - Permission Denied Error=13
type: UnansweredQuestion
tagged with: node.js

http://stackoverflow.com/a/23765472
type: Answer
answers question: http://stackoverflow.com/q/23765424
score: 0
has body: That command will take command line arguments. The arguments depend on the operating system you're running on. This is one of those questions where the answer is "it depends". See this question for some background info.

http://stackoverflow.com/q/23686133
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36392639
has comment: http://stackoverflow.com/comment/36395326
type: UnansweredQuestion
has title: Async Task: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
tagged with: android
has answer: http://stackoverflow.com/a/23686254
has comment: http://stackoverflow.com/comment/36395410
has comment: http://stackoverflow.com/comment/36392668
tagged with: multithreading
type: Question
tagged with: java
has body: I am getting the following java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() when trying to get the new instance of a classObject.getNewInstance(). Everything I have read involved altering the UI thread. Is that the case here? If so, how to I get around this exception? Code (Example used): public class MainActivityAsyncClass extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { postData(params[0]); return null; } public void postData(String methodToRun) { Class[] noParams = {}; try { Class mainActivityClass = Class.forName("com.MainActivity"); Method asyncRun = mainActivityClass.getDeclaredMethod(methodToRun, noParams); Object obj = mainActivityClass.newInstance(); //&lt;-- Error is thrown here asyncRun.invoke(obj, null); } catch(Exception e){ Util.appendLog("Error in async task. Exception: " + e.getMessage() + " " + e.getStackTrace()); } } }

http://stackoverflow.com/a/23754906
has comment: http://stackoverflow.com/comment/36523735
downvote count: 0
has comment: http://stackoverflow.com/comment/36523501
type: Answer
score: 3
upvote count: 3
has body: Like the error says, you need to catch an IOException too. Since FileNotFoundException is a subclass of IOException, you don't need to explicity catch FileNotFoundException unless you want to display a different error message. Change it to: catch (IOException e) { System.out.println("File not read properly"); e.printStackTrace(); } With Java 7, it is possible to catch multiple exceptions in a single catch block as shown below, but it is not necessary in this case because FileNotFoundException is a subclass of IOException. catch (FileNotFoundException | IOException e) { e.printStackTrace(); }
answers question: http://stackoverflow.com/q/23754863

http://stackoverflow.com/a/23676470
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23674558
has body: The exception you get is: android.os.NetworkOnMainThreadException And the stack trace reveals where the cause: 05-15 10:50:12.123: E/AndroidRuntime(19371): at com.parse.ParseRequest.initialize(ParseRequest.java:118) 05-15 10:50:12.123: E/AndroidRuntime(19371): at com.parse.Parse.initialize(Parse.java:109) 05-15 10:50:12.123: E/AndroidRuntime(19371): at nl.creationinc.swopp2.Clothing.onCreate(Clothing.java:22) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.Activity.performCreate(Activity.java:5312) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) 05-15 10:50:12.123: E/AndroidRuntime(19371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552) Parse.initialize perform a request over SSL, which is not allowed in the main thread, so you get the exception. You should not perform any Parse operation on the UI thread, not just the get operations.
has comment: http://stackoverflow.com/comment/36376180

http://stackoverflow.com/comment/36508450
comment on: http://stackoverflow.com/q/23747212
has text: Genius! That was the cause!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23728160
has title: How to switch between java swing panels on jframe?
answer count: 1
has answer: http://stackoverflow.com/a/23728180
duplicate of: http://stackoverflow.com/q/6476289
type: UnansweredQuestion
tagged with: java
tagged with: swing
linked to: http://stackoverflow.com/q/6476289
type: Question
has body: I programmed the game Hangman, which displays all its components onto one panel. That panel is then displayed onto the JFrame but now I want to have a startup screen with two different buttons, "normal mode" and "timed mode". I also want to have a win and losing screen both of which have a label stating that "you won/lost." They also have 3 different buttons, "play again","go to main menu", and "exit". Can someone explain how I would go about doing this?
tagged with: cardlayout
tagged with: jpanel
score: 0

http://stackoverflow.com/q/23646458
has answer: http://stackoverflow.com/a/23646510
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36335965
has comment: http://stackoverflow.com/comment/36318090
favorite count: 0
has comment: http://stackoverflow.com/comment/36318030
answer count: 3
has body: I have annotated text file on the following format: <paragraph> Buffer Overflow in client/mysql.cc in Oracle MySQL and MariaDB before 5.2 allows remote database servers ... ... What I would like to do is to create a Java code to parse the above text file and put it in the following format: Buffer weakness overflow weakness in O <--- 'O' means doesn't have annotation Oracle application MySQL application ... ... I tried to tokenize the file, but the problem is, I will do parsing and formatting again, and I could lose some useful information!! Please any help !!
type: UnansweredQuestion
tagged with: annotations
tagged with: gate
upvote count: 1
has answer: http://stackoverflow.com/a/23647064
has answer: http://stackoverflow.com/a/23652659
score: 1
tagged with: java
has title: extract annotated text from text file by using java code

http://stackoverflow.com/q/23714390
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36445436
score: -5
has answer: http://stackoverflow.com/a/23714546
downvote count: 5
tagged with: binary-search
accepted answer: http://stackoverflow.com/a/23714546
type: Question
favorite count: 0
answer count: 2
has body: I tried to run this code to search for a name by using the binary search, but it's not working. What's wrong with this code or method? public static int BinarySearchForStudentsName(String StudentName[],String Name) { int left = 0; int right = count - 1; int middle; while (true) { middle = (left + right) / 2; int copmarison = Name.compareTo(StudentName[middle]); if (Name.equals(StudentName[middle])) { return middle; } else if (left &gt; right) { return count; } else { if (copmarison &gt; 0) { middle = middle + 1; } else { middle = middle - 1; } } } } public static void main(String[] args) { String a[]={"A","B","C","D"}; int index = BinarySearchForStudentsName(a,"M"); if (index == count) { System.out.println("not found"); } else { System.out.println("founded at " + index); } }}
has title: Searching using BinarySearch
possible better answer: http://stackoverflow.com/a/23714601
tagged with: java
has comment: http://stackoverflow.com/comment/36445345
has comment: http://stackoverflow.com/comment/36445694
has answer: http://stackoverflow.com/a/23714601

http://stackoverflow.com/a/23777474
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36731834
type: Answer
answers question: http://stackoverflow.com/q/23768759
has body: You can use addListSelectionListener, add a listener on your second list which implements ListSelectionListener and in this listener implements valueChanged(ListSelectionEvent e), in this method check if desired value is checked and make your list invisible, I give you a source sample: import java.awt.EventQueue; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class SwingSample { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SwingSample window = new SwingSample(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public SwingSample() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout(1,2)); // create the first list String[] data = {"one", "two", "three", "four"}; JList firstList = new JList(data); frame.add(firstList); // create the second list String[] numbers = {"1", "2", "invisible", "4"}; JList secondList = new JList(numbers); frame.add(secondList); // the listener myListListener listener = new myListListener(firstList); secondList.addListSelectionListener(listener); } } class myListListener implements ListSelectionListener{ private JList jlist; public myListListener(JList value){ this.jlist = value; } public void valueChanged(ListSelectionEvent e) { boolean adjust = e.getValueIsAdjusting(); if(!adjust){ // get the selected value String value = (String)((JList)e.getSource()).getSelectedValue(); // if condition is accomplished make the second list invisible if(value.equals("invisible")){ jlist.setVisible(false); } else{ jlist.setVisible(true); } } } } Hope this helps,
score: 0
accepted answer of: http://stackoverflow.com/q/23768759

http://stackoverflow.com/q/23619898
tagged with: multithreading
has answer: http://stackoverflow.com/a/23620140
has answer: http://stackoverflow.com/a/23619942
has body: I have a program that loads a large file into the memory, loading it line by line, into an array. One line = one index in the array. Each line of data needs to be "used / processed". I then have a static AtomicInteger in the main class as well. I create multiple worker threads, and each worker thread, gets the data it needs by calling MainClass.array[MainClass.atomicint.getAndIncrement()] This works, but now that I am starting to use larger files, I am getting out of memoery errors, etc. How can I do this so that I don't get out of memoery.
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/36264073
has answer: http://stackoverflow.com/a/23619937
type: UnansweredQuestion
has title: Java - alternative to loading large file into memory
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36264079

http://stackoverflow.com/a/23696042
has comment: http://stackoverflow.com/comment/36486524
upvote count: 1
has body: As far as I can tell, you're trying to use a verifying CSV parser on invalid data (e.g. Row_No is blank everywhere but the header in your input file). I'm not certain if that's allowed with your parser, but I don't believe you need to parse the file yet. As an example, I would do it with StringTokenizer and a Scanner like so - public static void main(String[] args) { String inputFile = "c:/input.csv"; String outputFile = "c:/output.csv"; int lineNumber = 0; // &lt;-- keep a line count. Scanner scanner = null; PrintWriter pw = null; try { pw = new PrintWriter(outputFile); // &lt;-- output File source = new File(inputFile); scanner = new Scanner(source); // &lt;-- input while (scanner.hasNextLine()) { String line = scanner.nextLine(); line = (line != null) ? line.trim() : ""; if (line.length() &lt; 1) { continue; } // line 0 is the header. if (lineNumber != 0) { pw.print(lineNumber); pw.print(", "); } int tokenCount = 0; StringTokenizer st = new StringTokenizer(line, ","); while (st.hasMoreTokens()) { String token = st.nextToken(); if (tokenCount != 0) { pw.print(", "); } pw.print(token.trim()); tokenCount++; } pw.println(); lineNumber++; } } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (scanner != null) { scanner.close(); } if (pw != null) { pw.close(); } } } After running the above, I generated the output.csv (based on your input.csv) - Row_No, User, Actions 1, John, SQL transaction 2, Suman, Transaction failed 3, Ram, Button pressed to retrieve details
has comment: http://stackoverflow.com/comment/36481107
answers question: http://stackoverflow.com/q/23695595
type: Answer
accepted answer of: http://stackoverflow.com/q/23695595
downvote count: 0
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36479028
has text: Fyi, your question is confusing because we don't use the word "throw" when referring to a compile-time problem.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23731574

http://stackoverflow.com/comment/36534295
comment on: http://stackoverflow.com/q/23760809
score: 0
type: Comment
type: QuestionComment
has text: Learn about the page life cycle.

p6spy
type: Tag
tag name: p6spy
tags question: http://stackoverflow.com/q/23651482

http://stackoverflow.com/comment/37212766
has text: This question is still listed as unanswered. Would you please accept and upvote my answer if it seems appropriate? Thanks.
comment on: http://stackoverflow.com/q/23702673
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36370769
has text: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode got the right version of whatever jar that depends on
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23674788

http://stackoverflow.com/a/23726846
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23724609
has comment: http://stackoverflow.com/comment/36470401
type: Answer
has body: I understand this is possibly the worst approach ever You will get really terrible movement since the character will jump many pixels at one time (depending on the size of your image). Therefore as the character is moving, the JSCrollPane is scrolling, so I don't have to scroll to it. After you add the Icon to a different label you can use the scrollRectToVisible(..) method of the label. You will need to make the Rectangle size equal to the size of the scrollpanes viewport to force the viewport to scroll every time. So you will need to calculate the x/y position to make sure the label stays centered in the viewport.
score: 0
answers question: http://stackoverflow.com/q/23724609

http://stackoverflow.com/comment/36334938
score: 0
has text: Here are several ways to rotate the Image: http://stackoverflow.com/questions/4918482/rotating-bufferedimage-instances
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23656093

http://stackoverflow.com/q/23777331
has title: List of connected audio input devices on Android
type: UnansweredQuestion
tagged with: android
has body: My application must record sound only from external microphone. Is there a way to get list of available microphones? I'm using AudioRecord for sound capturing. Thanks in advance.
has comment: http://stackoverflow.com/comment/36569934
score: 3
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36568045
has answer: http://stackoverflow.com/a/23809778
upvote count: 3
answer count: 1
linked to: http://stackoverflow.com/q/14708636
favorite count: 0
has comment: http://stackoverflow.com/comment/36567378

http://stackoverflow.com/comment/36358772
type: QuestionComment
has text: As an aside, if you have a few compile errors, it would be good if you included them in the question, so that we don't have to find them all for ourselves. This will get you a faster response.
comment on: http://stackoverflow.com/q/23668095
score: 0
type: Comment

http://stackoverflow.com/comment/36497552
type: QuestionComment
has text: What would suggest that it WOULDN'T be 3 (depending, as @user3580294 suggests, what you mean by "create")?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23741636

http://stackoverflow.com/comment/36566374
comment on: http://stackoverflow.com/a/23724310
type: Comment
has text: Thank you Rafik, for the details.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23637670
upvote count: 0
linked to: http://stackoverflow.com/q/17620641
has comment: http://stackoverflow.com/comment/36298173
tagged with: java
duplicate of: http://stackoverflow.com/q/17620641
type: Question
has title: simple time countdown string
has body: i am sorry for asking question that already answered in other post. i already have tick method running each second, since i don't know about time format, i only display counter (int variable type) from 1800 (30 minutes) , subtract it one (sec) by each tick , until 0. can you teach me how to make it to display 30:00, 29:59 .. instead of 1800,1799 until 00:00 ..? if possible, i don't want to implement any other method to get it done. if you have any idea how to make this possible as simple as possible.. e.g by using time or date type thank you.
has comment: http://stackoverflow.com/comment/36298207
has comment: http://stackoverflow.com/comment/36299496
has answer: http://stackoverflow.com/a/23637736
downvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: time
tagged with: android
score: -3

http://stackoverflow.com/comment/36349799
type: QuestionComment
has text: @fge quite right, I apologise for haste, I'll remove all other traces :)
score: 0
comment on: http://stackoverflow.com/q/23663547
type: Comment

data-structures
tags question: http://stackoverflow.com/q/23641112
tag name: data-structures
tags question: http://stackoverflow.com/q/23730416
tags question: http://stackoverflow.com/q/23692652
tags question: http://stackoverflow.com/q/23623017
tags question: http://stackoverflow.com/q/23772102
tags question: http://stackoverflow.com/q/23747954
tags question: http://stackoverflow.com/q/23624121
tags question: http://stackoverflow.com/q/23621245
tags question: http://stackoverflow.com/q/23690948
tags question: http://stackoverflow.com/q/23768289
tags question: http://stackoverflow.com/q/23657547
tags question: http://stackoverflow.com/q/23717775
tags question: http://stackoverflow.com/q/23764521
tags question: http://stackoverflow.com/q/23672725
tags question: http://stackoverflow.com/q/23722712
tags question: http://stackoverflow.com/q/23639334
tags question: http://stackoverflow.com/q/23772151
tags question: http://stackoverflow.com/q/23675753
type: Tag
tags question: http://stackoverflow.com/q/23722011
tags question: http://stackoverflow.com/q/23664036

http://stackoverflow.com/comment/36343973
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23660943
has text: @MiguelPortugal You aren't using the return value. You're only invoking the method and not using the return value.
type: AnswerComment

http://stackoverflow.com/q/23742506
has comment: http://stackoverflow.com/comment/36499481
type: Question
tagged with: kml
has comment: http://stackoverflow.com/comment/36499782
score: 0
has title: how to create the actual kml file after generating the code?
has comment: http://stackoverflow.com/comment/36499458
type: UnansweredQuestion
has body: I have the code to generate a KML file and everything is fine except the part where I create the actual file. I've read some examples from the internet but I'm getting the same errors in all of them, here's the code I have: public void crearMapa() { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); kml = docBuilder.newDocument(); Element document = kml.createElement("Document"); kml.appendChild(document); definirConnex(document); for(int i = 0; i &lt; a_etnies.size(); i++) definirTot(i,document); for (Entry&lt;String, Enclavament&gt; entry : a_enclavaments.entrySet()) colocacio(entry.getValue(),document); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(kml); StreamResult result = new StreamResult(new File("mapa.kml")); transformer.transform(source, result); } catch (Exception e) { e.printStackTrace(); } } I've tried another code but I get the same error: TRANSFORMER EXCEPTION!javax.xml.transform.TransformerException: java.lang.NullPointerException In this line: transformer.transform(source, result); I don't understan why is this happening. Is there any other way of doing this? EDIT: Code updated to a more clean version. kml is a Document type
has comment: http://stackoverflow.com/comment/36500048
answer count: 0
tagged with: java
tagged with: file
tagged with: document

http://stackoverflow.com/a/23754616
has comment: http://stackoverflow.com/comment/36527839
score: 3
has comment: http://stackoverflow.com/comment/36526848
has comment: http://stackoverflow.com/comment/36526714
has comment: http://stackoverflow.com/comment/36523334
has comment: http://stackoverflow.com/comment/36523434
has comment: http://stackoverflow.com/comment/36525738
has comment: http://stackoverflow.com/comment/36523366
has comment: http://stackoverflow.com/comment/36827101
has body: Since you are already using Spring, it's as simple as that: @Transactional(timeout = 300) The Transaction annotation allow you to supply a timeout value(in seconds) and the transaction manager will forward it to the JTA transaction manager or your Data Source connection pool. It works nice with Bitronix Transaction Manager, which automatically picks it up. You also need to make sure the java.sql.Conenction are always being closed and Transaction are always committed (when all operations succeeded) or rollbacked on failure. Invalidating the user http session has nothing to do with jdbc connections. Your jdbc connection should always be committed/rollbacked and closed(which in case on connection pooling, will release the connection to the pool). And make sure the max pool size is not greater than tour db max concurrent connections setting.
has comment: http://stackoverflow.com/comment/36526215
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36526384
answers question: http://stackoverflow.com/q/23753510
has comment: http://stackoverflow.com/comment/36523463
accepted answer of: http://stackoverflow.com/q/23753510
has comment: http://stackoverflow.com/comment/36827462
type: Answer
has comment: http://stackoverflow.com/comment/36529870
has comment: http://stackoverflow.com/comment/36523101
upvote count: 3
has comment: http://stackoverflow.com/comment/36526239
has comment: http://stackoverflow.com/comment/36530798
has comment: http://stackoverflow.com/comment/36528015
has comment: http://stackoverflow.com/comment/36528005
has comment: http://stackoverflow.com/comment/36526501

http://stackoverflow.com/comment/36668467
type: Comment
type: QuestionComment
has text: @DirkyJerky You solved it for me, thank you! The java on my machine is different that what the server is using. Thank you!
score: 0
comment on: http://stackoverflow.com/q/23688674

http://stackoverflow.com/a/23693147
has comment: http://stackoverflow.com/comment/36407246
has comment: http://stackoverflow.com/comment/36406513
score: 1
has comment: http://stackoverflow.com/comment/36406808
accepted answer of: http://stackoverflow.com/q/23693099
answers question: http://stackoverflow.com/q/23693099
has comment: http://stackoverflow.com/comment/36406691
has comment: http://stackoverflow.com/comment/36406776
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36407226
has comment: http://stackoverflow.com/comment/36406674
has comment: http://stackoverflow.com/comment/36406445
has body: add your class name in your manifest file. hope this solve your problem &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:name=".MyApplication"&gt; ........ for further reading , how to extends Application class, read here.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36511631
type: Comment
has text: I'm pretty sure in the case of a crash the server would just *stop*. Can't really rely on anything for a crash. idk about a shutdown though...
score: 0
comment on: http://stackoverflow.com/q/23748797
type: QuestionComment

http://stackoverflow.com/comment/36352301
comment on: http://stackoverflow.com/a/23664194
has text: Hi @nos, Whilst that worked for me, it's now apparent that when i run my app, the background is very temperamental and only appears every now and then. Is there a reason behind this?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23702857
tagged with: selenium
type: Question
tagged with: java
tagged with: webdriver
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23709609
has answer: http://stackoverflow.com/a/23705330
type: UnansweredQuestion
has title: how to export existing firefox preferences to WebDriver?
has body: I would like to export preferences from existing Firefox profile into WebDriver profile. Can anyone help me on this?

http://stackoverflow.com/comment/36279031
has text: @Durga now check it clerly and try
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23627754

http://stackoverflow.com/a/23750806
score: 2
answers question: http://stackoverflow.com/q/23750032
upvote count: 2
has body: I'm not sure if it is the nicest approach. But I'd do something like: val map = ... val limit = 1073741824L val res = map.foldLeft(Vector(Vector[String]())){ case (result, (path, size)) =&gt; if(result.last.map(map(_)).sum + size &gt; limit) { result :+ Vector(path) } else result.updated(result.size - 1, result.last :+ path) }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36448938
comment on: http://stackoverflow.com/q/23715942
has text: It's bloat. There was a discussion in the meta about this. Basically, Stack Overflow is for professional Q&A, and things like "plz halp" or "thanks" distract from the actual question.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23625904
type: Answer
answers question: http://stackoverflow.com/q/23625439
has body: check if the classpath of your project contains the file mysql-connector-java-5.1.6.jar. Did maven run without problems?
has comment: http://stackoverflow.com/comment/36275291
upvote count: 1
has comment: http://stackoverflow.com/comment/36276942
score: 1
downvote count: 0

http://stackoverflow.com/comment/36528445
type: AnswerComment
has text: Please copy it from my post if this is what you want. change the color as per your requirement. change red to black if needed. This is more related to html css styling.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23757679

http://stackoverflow.com/comment/36280967
score: 0
type: Comment
has text: I don't believe the suggested duplicate was correct and I've reopened. Perhaps `@SuppressWarnings` is the only option, but I'd like to see someone explicitly state that this code can only be solved by that solution.
type: QuestionComment
comment on: http://stackoverflow.com/q/23628697

http://stackoverflow.com/comment/36404541
score: 0
comment on: http://stackoverflow.com/q/23692249
type: Comment
type: QuestionComment
has text: More: http://stackoverflow.com/q/16085286/1065197 http://stackoverflow.com/q/103654/1065197

http://stackoverflow.com/a/23677168
answers question: http://stackoverflow.com/q/23676681
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36379298
has comment: http://stackoverflow.com/comment/36378887
score: 2
has body: You can use Apache-Commons-CSV to parse the CSV file and then use CGLIB to generate Java class files at runtime.

http://stackoverflow.com/q/23756244
upvote count: 1
answer count: 1
downvote count: 0
has body: Good day fellas, I'm a confused about which session bean am to use for my application. I'm trying to build a mobile web app like Facebook which can allow multiple users at the same time. I surf the internet to get more information. From the info I gathered from stack overflow and other tutorials, is that a Stateful session beans maintain state both within and between transactions (conversational state) and that its meant for a client. Stateless does not but support multiple clients to pool the bean instance. Whilst Singleton is a little similar to Stateless bean. My question is which session bean am I to use for the application. Thanks for your quick response. NB: Client (Mobile phone) communicate with the servlet and the servlet communicates with EJB to pull data from the database. public class LoginServlet extends HttpServlet { @EJB CampusianDataBaseBeanLocal campusianDataBaseBean; Campusian campusian; Gson gson; @Override public void init() throws ServletException { super.init(); campusian = new Campusian(); gson = new Gson(); } /** * Processes requests for both HTTP * GET and * POST methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String username = request.getParameter("campusianUserName"); String password = request.getParameter("campusianPassword"); String gsonString; campusian.setUserName(username); campusian.setPassword(password); System.out.println("First time: "+username); /** * This check if the username and password entered by user is correct. * If yes set campusian setSuccess to true and convert the object to string using gson * Else set object campusian method to false */ if (campusianDataBaseBe…
favorite count: 0
tagged with: ejb-3.0
type: UnansweredQuestion
tagged with: session-bean
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36525972
tagged with: servlets
has title: When to use Session Bean
has answer: http://stackoverflow.com/a/23756552

http://stackoverflow.com/a/23746957
has body: Is there a way to output all swing events with the handles that caused them to the console? For debugging to help find where events are coming from, one can use AWTEventListeners to listen to all events that are dispatched. Simply try with AWTEventListener. Add more AWTEvent whatever you want to listen for. long eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.KEY_EVENT_MASK; Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent e) { String paramString = e.paramString(); System.out.println(paramString); } }, eventMask); sample output; MOUSE_MOVED,(131,144),absolute(131,144),clickCount=0 MOUSE_PRESSED,(131,144),absolute(131,144),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1 MOUSE_RELEASED,(131,144),absolute(131,144),button=1,modifiers=Button1,clickCount=1 MOUSE_CLICKED,(131,144),absolute(131,144),button=1,modifiers=Button1,clickCount=1 MOUSE_MOVED,(134,143),absolute(134,143),clickCount=0 MOUSE_MOVED,(135,142),absolute(135,142),clickCount=0 MOUSE_MOVED,(172,118),absolute(172,118),clickCount=0 KEY_PRESSED,keyCode=70,keyText=F,keyChar='f',keyLocation=KEY_LOCATION_STANDARD,rawCode=70,primaryLevelUnicode=102,scancode=33,extendedKeyCode=0x46 key pressed:70 KEY_TYPED,keyCode=0,keyText=Unknown keyCode: 0x0,keyChar='f',keyLocation=KEY_LOCATION_UNKNOWN,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0 KEY_PRESSED,keyCode=68,keyText=D,keyChar='d',keyLocation=KEY_LOCATION_STANDARD,rawCode=68,primaryLevelUnicode=100,scancode=32,extendedKeyCode=0x44 key pressed:68 KEY_TYPED,keyCode=0,keyText=Unknown keyCode: 0x0,keyChar='d',keyLocation=KEY_LOCATION_UNKNOWN,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0 KEY_PRESSED,keyCode=83,keyText=S,keyChar='s',keyLocation=KEY_LOCATION_STANDARD,rawCode=83,primaryLevelUnicode=115,scancode=31,extendedKeyCode=0x53 key pressed:83 KEY_TYPED,keyCode=0,keyText=Unknown keyCode: 0x0,keyCh…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23746804
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23746804
downvote count: 0
score: 4

http://stackoverflow.com/comment/36265641
type: Comment
has text: @Xanathos Without code example which we could use to reproduce this problem we can only guess what is wrong. You should post [MCVE](http://stackoverflow.com/help/mcve)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23620410

http://stackoverflow.com/comment/36446593
type: AnswerComment
has text: Thanks brother. You just got the nerve. This is exactly what I wanted to achieve. I further request you to please elaborate on, _that interpolates non-linearly between two colors_ and how to achieve the same. (+1)
comment on: http://stackoverflow.com/a/23713317
type: Comment
score: 0

http://stackoverflow.com/a/23771857
score: 1
has comment: http://stackoverflow.com/comment/36584931
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36570593
has body: MovieScrollPane.add(movie); Don't add components directly to the scrollpane. Normally a JPanel is added the the viewport of the scrollpane. Then, whenever you add a component to a visible GUI the basic code is: panel.add(...); panel.revalidate(); panel.repaint(); This makes sure the layout manager is invoked to the preferred size can be recalculated. Also, follow Java naming conventions. Variable names should NOT start with an upper case characters.
type: Answer
has comment: http://stackoverflow.com/comment/36586919
answers question: http://stackoverflow.com/q/23771846
upvote count: 1
has comment: http://stackoverflow.com/comment/36556192
accepted answer of: http://stackoverflow.com/q/23771846

http://stackoverflow.com/comment/36466744
has text: Yes, that does it. Thanks a lot!
comment on: http://stackoverflow.com/a/23721331
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36559327
has text: uhh i got the format wrong, but i used your frame and it still did not work
type: Comment
comment on: http://stackoverflow.com/a/23769724
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36400389
has text: There are libraries which implement deep cloning, you may want to see if an off-the-shelf solution will do what you need, before trying to reinvent the wheel.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23689965
score: 0

http://stackoverflow.com/a/23757123
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36703884
has body: Remove anything besides a number in the string then parse it String string = rsBundle.getString("SPAN_NUMBER"); if(string != null) { string = string.replaceAll("\\D",""); if(string.length()==0) string="0"; int i = Integer.parseInt(string); }
type: Answer
has comment: http://stackoverflow.com/comment/36528275
answers question: http://stackoverflow.com/q/23756962
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23756962

http://stackoverflow.com/comment/36460481
has text: I don't know what are you saying without trying it and follow the links that I shared. I don't know what is the issue in this way. How it's not a right way. You don't need to edit the Sticker size?
type: AnswerComment
comment on: http://stackoverflow.com/a/23722004
score: 0
type: Comment

http://stackoverflow.com/comment/36469893
type: AnswerComment
comment on: http://stackoverflow.com/a/23726610
type: Comment
has text: Thanks :) actually i am v new to java.. did you mean to add the variableToPass in this ... ListEmployeeList TheEmNo = new ListEmployeeList (); sorry i couldnt understand much can u plz explain bit more :) thanks
score: 0

http://stackoverflow.com/q/23648054
downvote count: 0
has body: I am moving my application from a relational DB to objectify / google app engine. The application has a relationship which is modelled as follows: One Message can be sent to many Users. Each User can have many Messages addressed to them. I need to be able to scan for all Messages addressed to a particular User. How do I do this with Objectify?
favorite count: 0
tagged with: objectify
type: Question
tagged with: google-app-engine
has title: many to many relationship using objectify?
has answer: http://stackoverflow.com/a/23649599
has answer: http://stackoverflow.com/a/23659294
upvote count: 2
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23649481
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/36548962
comment on: http://stackoverflow.com/q/23767679
score: 0
type: QuestionComment
type: Comment
has text: See also http://stackoverflow.com/questions/3590000/what-does-java-lang-thread-interrupt-do

http://stackoverflow.com/comment/36467638
type: QuestionComment
comment on: http://stackoverflow.com/q/23725713
score: 0
type: Comment
has text: @ Peter I don't consider myself higher yet

http://stackoverflow.com/a/23637474
upvote count: 3
score: 3
has body: Might as well say "I didn't find any practical use of for loop...everything which can be done with for loop, can be don with while loop (assuming)". Technically you can replace any loop with literally any other loop given enough finangling with the loop guards and such. Some loops are just nicer to read than others. do-while is primarily "better" if you want to perform an action at least once, e.g. asking for input, or getting some random value until it fits into some constraint. You can do such an action by performing the action once outside a "regular" loop and looping from there, but it's just neater to use do-while.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23637381

http://stackoverflow.com/comment/36473236
type: Comment
type: QuestionComment
has text: @MadProgrammer: that should be an answer.
score: 0
comment on: http://stackoverflow.com/q/23728360

http://stackoverflow.com/q/23653894
duplicate of: http://stackoverflow.com/q/14057224
has body: i am trying to write parser for DOT(graphviz) language using antlr. there is a problem when antlr generates parse tree .some times when i debug my grammer with some input and trace the steps of tree generation , i can see that some subtrees are exactly duplicated in my tree. at first time it comes with green color but exactly after that the same subtree will come with black color. on a quick look it seems that it happens when i use "?" (operator) in my grammer as you know this operator means some token is opational. does anyone have any idea why even antlr trying to change the color of tree?! here is my grammer : grammar Dot; options { backtrack = true; memoize = true; output = AST; ASTLabelType = CommonTree; } tokens { // operators and special characters O_BRACKET = '{'; C_BRACKET = '}'; O_SQR_BRACKET = '['; C_SQR_BRACKET = ']'; SEMI_COLON = ';'; EQUAL = '='; COMMA = ','; COLON = ':'; LPAREN = '('; RPAREN = ')'; // case-insensitive keywords GRAPH; DIGRAPH; STRICT; NODE; EDGE; SUBGRAPH; // tokens from imaginary nodes GRAPH_ROOT; SUBGRAPH_ROOT; STMT_LIST; EDGE_STMT; NODE_STMT; ATTR_LIST; ATTR; } @header { package org.cesta.parsers.dot; import java.util.logging.Logger; } @members { private boolean hasErrors = false; private Logger logger = Logger.getLogger(this.getClass().getName()); public void setLogger(Logger newLogger){ logger = newLogger; } @Override public void emitErrorMessage(String message) { hasErrors = true; if (logger!=null) logger.warning(message); super.emitErrorMessage(message); } public boolean hasErrors(){ return hasErrors; } } @lexer::header { package org.cesta.parsers.dot; } @lexer::members { } graph : graphModifier ID? O_BRACKET stmt_list C_BRACKET -&gt; ^(GRAPH_ROOT graphModifier ID? stmt_list) ; graphModifier : (STRICT)? (GRAPH | DIGRAPH) ; stmt_list : stmt (SEMI_COLON* stmt)* SEMI_COLON* -&gt; ^(STMT_LIST stmt+) ; stmt : attr_stmt | edge_stmt | subgraph | ID EQUAL ID -&gt; ^(ATTR ID EQUAL ID) | node_stmt ; attr_stmt : (GRAPH^ | NODE^ | EDGE^) (a…
favorite count: 0
tagged with: dot
answer count: 0
tagged with: antlr3
linked to: http://stackoverflow.com/q/14057224
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
has title: AST tree in antlr
tagged with: java
tagged with: antlr
downvote count: 0

http://stackoverflow.com/comment/36292775
type: QuestionComment
has text: @BheshGurung Er, there is only one Bar[] - the one in the constructor of `Foo`.
score: 0
comment on: http://stackoverflow.com/q/23634492
type: Comment

http://stackoverflow.com/a/57180641
type: Answer
has body: From this blog post: Only recently, with the CDI 1.1 version; may 2013 (Java EE 7); you have the possibility to receive a CDI event when the container is ready. public class CDIStartup { public void postConstruct(@Observes @Initialized(ApplicationScoped.class) Object o) { // CDI Ready } }
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/110662336
answers question: http://stackoverflow.com/q/23627866
upvote count: 3

http://stackoverflow.com/a/23723921
score: 0
has body: /*(7)print clockA, clockB, clockC on separate lines */ System.out.println(clockA()); System.out.println(clockB()); System.out.println(clockC()); you are using clockC() since you added () it refer to a method. if you want to print your variable, use : /*(7)print clockA, clockB, clockC on separate lines */ System.out.println(clockA); System.out.println(clockB); System.out.println(clockC);
type: Answer
answers question: http://stackoverflow.com/q/23723890

http://stackoverflow.com/a/23757283
downvote count: 0
has body: The code above gets an element from the tree and then tries to execute the JavaScript code element.click(). Those two are not related in any way. Specifically, Selenium (or rather Java) won't make any attempt to read your mind and magically connect the local variable element to JavaScript. You will have to use the JavaScript DOM API to locate the element inside of js.executeScript().
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23757106

http://stackoverflow.com/q/23656063
tagged with: spring
has body: I have two Java projects, "A" and "B", and B has a Maven dependency on A. I started creating tests for B, but when I try to run the tests it wont work. The error is that when testing B my test uses the spring context of A. Any idea of how can I exclude the A context from the tests of B? I'm using this to set the context of the tests from B @ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {BTestContext.class}) I tried to use exclude filters in BTestContext but that didnt work. @ComponentScan(basePackages = {"com.foo.b"}, excludeFilters = @ComponentScan.Filter(value = ABeanConfig.class))
has answer: http://stackoverflow.com/a/23656639
downvote count: 0
score: 1
tagged with: java
has title: How to exclude a spring context of a project which depends on another project while testing
tagged with: unit-testing
type: Question
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36434827
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23708673
has text: it gives me error on.. button.setOnClickListener(this); -- cannot accept value as fragment

http://stackoverflow.com/q/23710983
tagged with: mysql
type: Question
has title: Strange behavior in Java-JList searching
has comment: http://stackoverflow.com/comment/36440292
score: 0
tagged with: jlist
answer count: 0
type: UnansweredQuestion
tagged with: swing
has body: I've been struggling for hours with this method which has a strange behavior. Scenario: two jlists, menuList and productList filled with data from a mysql db, the first contains the "categories" and the second the products of that category. Both of them are populated with a Vector of objects. The problem is when I perform a search of a products it works fine in all circumstances except immediately after I save a new menu (category). In this case, the index of the menuList is successfully moved to the right category in which the products I was searching is in, but productList remains blank. This is the code of the method which makes the search. private void bFindProductActionPerformed(java.awt.event.ActionEvent evt) { Product product = new Product(); product.setProductName(searchedProduct.getText()); bNewProduct.setEnabled(false); Vector&lt;Product&gt; productVoices = DBConnection.searchProduct(product); if (!productVoices.isEmpty()) { modelProductList.clear(); disableProductButtons(); menuName.setText(""); productName.setText(""); int idMenu = 0; for (int i = 0; i &lt; productVoices.size(); i++) { Product current = (Product) productVoices.get(i); modelProductList.addElement(current); idMenu = current.getMenuId(); } productList.setModel(modelProductList); for (int i = 0; i &lt; modelMenuList.getSize(); i++) { Menu current = (Menu) modelMenuList.getElementAt(i); if (idMenu == current.getMenuId()) { int currentId = modelMenuList.indexOf(current); menuList.setSelectedIndex(currentId); menuList.requestFocus(); } } } else { JOptionPane.showMessageDialog(null, "No product found", "", JOptionPane.WARNING_MESSAGE); searchedProduct.setText("Search..."); } } And this is the code of the methos which saves a new menu (or updates an existing one): private void bSaveMenuActionPerformed(java.awt.event.ActionEvent evt) { //If there's a selected menu updates if (!menuList.isSelectionEmpty()) { Menu selectedMenu = (Menu) menuList.getSelectedValue(); listIndex = menuList.getSelectedInd…
has comment: http://stackoverflow.com/comment/36439838
tagged with: java

http://stackoverflow.com/q/23757428
has title: JNI CallStaticObjectMethod return NULL in c++
has comment: http://stackoverflow.com/comment/36533812
has comment: http://stackoverflow.com/comment/36535565
tagged with: c++
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36536780
has comment: http://stackoverflow.com/comment/36534927
tagged with: java
has comment: http://stackoverflow.com/comment/36536365
accepted answer: http://stackoverflow.com/a/23828558
type: Question
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/36535714
has body: Here is the code in C++ ,where i create a Java VM and i need to call a function from a jar. JavaVM *jvm; /* denotes a Java VM */ JNIEnv *env; /* pointer to native method interface */ JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */ jmethodID constr = NULL; jmethodID Read_XML = NULL; JavaVMOption* options = new JavaVMOption[1]; options[0].optionString = "-Djava.class.path=&lt;path_to_my_jar&gt;"; vm_args.version = JNI_VERSION_1_6; vm_args.nOptions = 1; vm_args.options = options; vm_args.ignoreUnrecognized = JNI_TRUE; /* load and initialize a Java VM, return a JNI interface * pointer in env */ long status = JNI_CreateJavaVM(&amp;jvm, (void**)&amp;env, &amp;vm_args); if (status == JNI_ERR){ cout &lt;&lt; "Fail: Unable to load JVM \t Exit" &lt;&lt; endl; } jclass xml_read = env-&gt;FindClass("&lt;MyClass&gt;"); if (env-&gt;ExceptionCheck()){ cout &lt;&lt; "Fail:"; } constr = env-&gt;GetMethodID(xml_read, "&lt;init&gt;", "()V"); if (env-&gt;ExceptionCheck()){ cout &lt;&lt; "Fail:"; } Read_XML = env-&gt;GetStaticMethodID(xml_read,"readFromXML", "(Ljava/lang/String;)L&lt;MyClass&gt;;"); if (env-&gt;ExceptionCheck()){ cout &lt;&lt; "Fail:"; } const char* filepath = "&lt;My_filepath&gt;"; const jstring file = env-&gt;NewStringUTF(filepath); jobject ret_obj = env-&gt;CallStaticObjectMethod(xml_read,Read_XML,file); if (env-&gt;ExceptionCheck()){ cout &lt;&lt; "Fail:"; } Now the ret_obj is NULL.The Java function i am calling takes a String as argument and returns an Object from another Class different from MyClass. Java Method is like this public static SomeClass readFromXML(String filepath) UPDATE 1 Inside the CallStaticObjectMethod we have this jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID, ...) { va_list args; jobject result; va_start(args,methodID); result = functions-&gt;CallStaticObjectMethodV(this,clazz,methodID,args); va_end(args); return result; } After va_start(args,methodID); the value of args is somnething like this 0x002cf5fc "0…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36536651
has comment: http://stackoverflow.com/comment/36536107
favorite count: 0
has comment: http://stackoverflow.com/comment/36537303
has answer: http://stackoverflow.com/a/23828558
upvote count: 2
has comment: http://stackoverflow.com/comment/36535681

http://stackoverflow.com/a/23697906
has comment: http://stackoverflow.com/comment/36416973
has comment: http://stackoverflow.com/comment/36417423
score: 0
has comment: http://stackoverflow.com/comment/36416471
has comment: http://stackoverflow.com/comment/36415399
has comment: http://stackoverflow.com/comment/36417567
has comment: http://stackoverflow.com/comment/36416747
has comment: http://stackoverflow.com/comment/36416252
has comment: http://stackoverflow.com/comment/36416211
has body: I don't understand why you create a Date, then you convert it in Time to display it. Just do : Date yourDate = ... DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy"); System.out.println(sdf.format(yourDate)); It will display your date as you need. But, maybe what you need is a java.sql.Date ? So, check this: How to convert java.util.Date to java.sql.Date?
answers question: http://stackoverflow.com/q/23697675
has comment: http://stackoverflow.com/comment/36416153
has comment: http://stackoverflow.com/comment/36416666
type: Answer
has comment: http://stackoverflow.com/comment/36416915
has comment: http://stackoverflow.com/comment/36417648
has comment: http://stackoverflow.com/comment/36417287

http://stackoverflow.com/comment/36443522
has text: @user3647958 looks like you still don't understand that the values in the ` ` won't be sent to the server. The only thing you can send are ` ` and ` ` values. Just put some of them in your view and those will be the values you can retrieve from the servlet.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23713364
type: AnswerComment

http://stackoverflow.com/comment/84171997
type: AnswerComment
type: Comment
score: 0
has text: @ddarellis Trying to inform that this issue came back in 3.9.0 in a different processor. We can still solve the issue by adding the Given config in the Outbound end point for request reply.
comment on: http://stackoverflow.com/a/48561588

http://stackoverflow.com/a/23653959
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23651636
has body: ContentMap is node properties exposed as a Map. What you want to iterate over are subnodes, hence it can't work. Looking at your structure, it looks like a link list area, if that is so &lt;cms:area name="events" /&gt; should be enough in the component that renders area and in the area itself something like: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ taglib prefix="cms" uri="http://magnolia-cms.com/taglib/templating-components/cms"%&gt; &lt;div id="${def.parameters.divId}"&gt; &lt;c:forEach items="${components}" var="component"&gt; &lt;cms:component content="${component}" /&gt; &lt;/c:forEach&gt; &lt;/div&gt; where components should be exposed implicitly in the area. Try to get magnolia-templating-samples module from git/nexus for more examples like that. HTH, Jan
answers question: http://stackoverflow.com/q/23651636
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23668968
answers question: http://stackoverflow.com/q/23668808
has comment: http://stackoverflow.com/comment/36379810
has comment: http://stackoverflow.com/comment/36379964
has body: Normally you can find string.xml in res->values folder path. But you can also open in second way like this. Open any of your activity's xml file. Below is an image of xml file Press Ctrl Key and move your mouse pointer to the text where it is indicating @string/loginTitle and click. This will open your string.xml file.
has comment: http://stackoverflow.com/comment/36380084
score: 0
has comment: http://stackoverflow.com/comment/36383278
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36413559
has comment: http://stackoverflow.com/comment/36584762
type: Answer
accepted answer of: http://stackoverflow.com/q/23668808

http://stackoverflow.com/q/23675398
tagged with: jna
has comment: http://stackoverflow.com/comment/36372570
has answer: http://stackoverflow.com/a/23705602
accepted answer: http://stackoverflow.com/a/23705602
has comment: http://stackoverflow.com/comment/36371815
has comment: http://stackoverflow.com/comment/36371716
favorite count: 0
has comment: http://stackoverflow.com/comment/36373188
has comment: http://stackoverflow.com/comment/36372664
tagged with: c#
type: AnsweredQuestion
tagged with: java
has title: C# dll method call from Java
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/36371834
has body: Has anyone an idea about what is wrong with my attempt to call a method from a C# dll in my Java code? Here is my example: Java code: public class CsDllHandler { public interface IKeywordRun extends Library { public String KeywordRun(String action, String xpath, String inputData, String verifyData); } private static IKeywordRun jnaInstance = null; public void runDllMethod(String action, String xpath, String inputData, String verifyData) { NativeLibrary.addSearchPath(${projectDllName}, "${projectPath}/bin/x64/Debug"); jnaInstance = (IKeywordRun) Native.loadLibrary( ${projectDllName}, IKeywordRun.class); String csResult = jnaInstance.KeywordRun(action, xpath, inputData, verifyData); System.out.println(csResult); } } And in C#: [RGiesecke.DllExport.DllExport] public static string KeywordRun(string action, string xpath, string inputData, string verifyData) { return "C# here"; } The Unmanaged Exports nuget should be enough for me to call this method (in theory) but I have some strange error: Exception in thread "main" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokePointer(Native Method) at com.sun.jna.Function.invokePointer(Function.java:470) at com.sun.jna.Function.invokeString(Function.java:651) at com.sun.jna.Function.invoke(Function.java:395) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at com.sun.proxy.$Proxy0.KeywordRun(Unknown Source) at auto.test.keywords.utils.CsDllHandler.runDllMethod(CsDllHandler.java:34) at auto.test.keywords.runner.MainClass.main(MainClass.java:24)
answer count: 1
upvote count: 6
score: 4

http://stackoverflow.com/q/23774941
tagged with: java
tagged with: sony-smartwatch
type: Question
has comment: http://stackoverflow.com/comment/36591347
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23794606
has comment: http://stackoverflow.com/comment/36593315
has comment: http://stackoverflow.com/comment/36561324
type: UnansweredQuestion
has title: Using SCREEN_STATE_OFF properly
has body: I'm trying to use SCREEN_STATE_OFF. Based on the documentation I should set this screen state + in registration do this: public boolean supportsLowPowerMode() { return true; } Having done that, it seems my application behaves strangely to users. When they start my control, it immediately disappears (but still seems to be running as it keeps sending some intents). Based on the documentation I'd expect they'll see a 4 colored version of screen with no backlight? I do only have an emulator, and the problem cannot be simulated there. I'm setting SCREEN_STATE_OFF in the onResume method of the control, if that could be a problem. Any advice how to properly set SCREEN_STATE_OFF and still show the app to users

http://stackoverflow.com/comment/36549324
type: QuestionComment
comment on: http://stackoverflow.com/q/23767458
has text: @adnankamili uh... i don't think so :D thanks for commenting.
score: 0
type: Comment

http://stackoverflow.com/comment/36329525
score: 0
type: Comment
type: QuestionComment
has text: Ok. I was just asking because if you use both together it means "filter Tweets with these keywords or from these users". It doesn't look like that's your problem though. :-)
comment on: http://stackoverflow.com/q/23648397

http://stackoverflow.com/a/25237633
upvote count: 3
has comment: http://stackoverflow.com/comment/39322850
has comment: http://stackoverflow.com/comment/39317635
has comment: http://stackoverflow.com/comment/39323305
has body: Here is how I made a point cloud using tetrahedrons in a triangle mesh. seems to run faster than using spheres or squares. this code helped me scalafx google code import java.util.ArrayList; import javafx.scene.shape.TriangleMesh; public class TetrahedronMesh extends TriangleMesh { private ArrayList&lt;Point3i&gt; vertices; private int[] facesLink; public TetrahedronMesh(double length, ArrayList&lt;Point3i&gt; v) { this.vertices = v; if (length &gt; 0.0) { float[] points = new float[vertices.size() * 12]; int[] faces = new int[vertices.size() * 24]; facesLink = new int[vertices.size() * 4]; float[] texCoords = new float[vertices.size() * 12]; int vertexCounter = 0; int primitiveCounter = 0; int pointCounter = 0; int facesCounter = 0; int texCounter = 0; for (Point3i vertex : vertices) { vertex.scale(100); points[primitiveCounter] = vertex.x; points[primitiveCounter + 1] = (float) (vertex.y - (length * Math.sqrt(3.0) / 3.0)); points[primitiveCounter + 2] = -vertex.z; points[primitiveCounter + 3] = (float) (vertex.x + (length / 2.0)); points[primitiveCounter + 4] = (float) (vertex.y + (length * Math.sqrt(3.0) / 6.0)); points[primitiveCounter + 5] = -vertex.z; points[primitiveCounter + 6] = (float) (vertex.x - (length / 2.0)); points[primitiveCounter + 7] = (float) (vertex.y + (length * Math.sqrt(3.0) / 6.0)); points[primitiveCounter + 8] = -vertex.z; points[primitiveCounter + 9] = vertex.x; points[primitiveCounter + 10] = vertex.y; points[primitiveCounter + 11] = (float) -(vertex.z - (length * Math .sqrt(2.0 / 3.0))); faces[facesCounter] = pointCounter + 0; faces[facesCounter + 1] = pointCounter + 0; faces[facesCounter + 2] = pointCounter + 1; faces[facesCounter + 3] = pointCounter + 1; faces[facesCounter + 4] = pointCounter + 2; faces[facesCounter + 5] = pointCounter + 2; faces[facesCounter + 6] = pointCounter + 1; faces[facesCounter + 7] = pointCounter + 1; faces[facesCounter + 8] = pointCounter + 0; faces[facesCounter + 9] = pointCounter + 0; faces[facesCounter + 1…
downvote count: 0
answers question: http://stackoverflow.com/q/23749614
type: Answer
score: 3

http://stackoverflow.com/comment/36359489
comment on: http://stackoverflow.com/q/23668818
score: 0
type: Comment
type: QuestionComment
has text: You could use [`Desktop`](http://docs.oracle.com/javase/tutorial/uiswing/misc/desktop.html) to open the associated program for the specified file or the [Sound API](http://docs.oracle.com/javase/tutorial/sound/) to play it your self...

http://stackoverflow.com/a/23672185
has body: The first level cache is only valid for as long as the current running Session (a.k.a EntityManager) is open. Two concurrent transactions will run in different Session(s), hence each one will have it's own 1st Level Cache, which is not what you aim for. You want the 2nd Level Cache, which is shared between concurrent Session(s): EhCache is a very well-known 2nd Level Cache implementation, Infinispan which is developed by Red Hat.
has comment: http://stackoverflow.com/comment/36367586
score: 2
answers question: http://stackoverflow.com/q/23671227
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/36336731
has text: And please show the full stack trace, whenever you ask a question in java the stack trace is the main thing that will help us help you.
comment on: http://stackoverflow.com/q/23656915
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36490889
has text: What do you mean by "shouldn't the references change"? Shouldn't *which* references change? I suspect you're confused about what the immutability of String really means.
score: 1
comment on: http://stackoverflow.com/q/23737927
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23666185
score: 0
has comment: http://stackoverflow.com/comment/36354896
has comment: http://stackoverflow.com/comment/36354912
has comment: http://stackoverflow.com/comment/36354864
has comment: http://stackoverflow.com/comment/36354948
has comment: http://stackoverflow.com/comment/36354859
has body: Error Message: Cannot Find Symbol When a Java program is being compiled the compiler creates a list of all the identifiers in use. If it can't find what an identifier refers to (e.g., there is no declaration statement for a variable) it cannot complete the compilation. This is what the cannot find symbol error message is saying, it doesn't have enough information to piece together what the Java code wants to execute. Please validate all the variables declared in your code specially jTextAreal and Chaine and it must be accessible as well. Have you declared it anywhere in code as shown below? JTextArea jTextAreal = new JTextArea(); String Chaine; Note : Respect the Java Naming Convention. I have collected all your comments it's the same (error) when you declare or not jTextAreal is an objet in my interface There are two possibilities that may result in this compile time error Cannot Find Symbol Variable jTextAreal is not declared at all. jTextAreal is not accessible here. Finally I got the it public class Principale extends javax.swing.JDialog { Object jTextAreal; It should be JTextArea jTextAreal instead of Object jTextAreal because Object class doesn't have any setText() method.
answers question: http://stackoverflow.com/q/23666177
has comment: http://stackoverflow.com/comment/36354793
type: Answer
has comment: http://stackoverflow.com/comment/36354940
has comment: http://stackoverflow.com/comment/36354807

http://stackoverflow.com/comment/36440270
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23711430
has text: Why would an import statement be useful when dealing with nullpointerexceptions? Right now, you're just throwing a wall of code at us. Read http://www.sscce.org/ for more info.
score: 0

http://stackoverflow.com/comment/36447542
type: Comment
score: 1
has text: Thanks for your fast reply. PDPageContentStream.setStrokingColor( 255, 0, 0 ); solved it. I didn´t know the differences. Is there any documantation where I can find such things?
type: QuestionComment
comment on: http://stackoverflow.com/q/23713959

http://stackoverflow.com/comment/36419423
score: 0
has text: am testing on Nexus 5 with android 4.4.2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23700475

http://stackoverflow.com/a/23731647
type: Answer
score: 4
has body: This is as far as you can go (at least with the standard libraries). The mouse "jumps" are system dependent, specifically on the "sampling rate" of the listener. I'm not aware of a JVM parameter affecting it, but wouldn't be surprised if there is something in that spirit. The jumps are in opposite relation to the mouse acceleration (the mouse can move a "long" distance between the samples). public class Stop extends JFrame { static Robot robot = null; static Rectangle bounds = new Rectangle(300, 300, 300, 300); static int lastX = 450; static int lastY = 450; Stop() { try { robot = new Robot(); } catch (AWTException e) { e.printStackTrace(); } addMouseMotionListener(new MouseStop()); getContentPane().add(new JLabel("&lt;html&gt;A sticky situation&lt;br&gt;Hold SHIFT to get out of it", JLabel.CENTER)); setDefaultCloseOperation(EXIT_ON_CLOSE); setBounds(bounds); setVisible(true); } private static class MouseStop extends MouseAdapter { @Override public void mouseMoved(MouseEvent e) { if(e.isShiftDown()) { lastX = e.getXOnScreen(); lastY = e.getYOnScreen(); } else robot.mouseMove(lastX, lastY); } } public static void main(String args[]) { new Stop(); } } Edit: I have just gotten an idea involving painting of the cursor to appear as if the mouse is not moving at all. I'll add code if I get something working.
accepted answer of: http://stackoverflow.com/q/23724973
upvote count: 4
answers question: http://stackoverflow.com/q/23724973
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23770487
upvote count: 1
type: AcceptedAnswer
has body: You can't actually cast the output of toArray() in that fashion. You need to supply the type to the toArray() call so that it returns an array of the appropriate type. For instance: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("foo"); list.add("bar"); String[] arr1 = (String[]) list.toArray(); // this throws a ClassCastException String[] arr2 = list.toArray(new String[0]); // this works You just need to replace this line String[] values = (String[]) entry.getValue().toArray(); with this one String[] values = entry.getValue().toArray(new String[0]); and your code should work.
type: Answer
accepted answer of: http://stackoverflow.com/q/23770188
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23770188

http://stackoverflow.com/q/23737958
has comment: http://stackoverflow.com/comment/36491275
type: Question
has comment: http://stackoverflow.com/comment/36491370
tagged with: jndi
tagged with: java
has comment: http://stackoverflow.com/comment/36491148
tagged with: jboss
score: 0
has comment: http://stackoverflow.com/comment/36491009
has comment: http://stackoverflow.com/comment/36495341
has comment: http://stackoverflow.com/comment/36491671
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36497645
has comment: http://stackoverflow.com/comment/36495069
tagged with: spring
has body: I have 2 deployables: First, my entity layer, which is an EAR file packaging an EJB. JBoss EAP 6.2 says it's all good, and provides these JNDI names: java:global/entityLayerEar-1.0/entity-service/TestDao!com.test.dao.TestDao java:app/entity-service/TestDao!com.test.dao.TestDao java:module/TestDao!com.test.dao.TestDao java:jboss/exported/entityLayerEar-1.0/entity-service/TestDao!com.test.dao.TestDao java:global/entityLayerEar-1.0/entity-service/TestDao java:app/entity-service/TestDao java:module/TestDao Second, my application layer, which is a WAR file containing an EJB. It too gets its JNDI names. java:global/application/RequestHandler!com.test.application.RequestHandlerInterface java:app/application/RequestHandler!com.test.application.RequestHandlerInterface java:module/RequestHandler!com.test.application.RequestHandlerInterface java:global/application/RequestHandler java:app/application/RequestHandler java:module/RequestHandler Now I'm just trying to get my TestDao EJB injected in my RequestHandler. Is that too much to ask? I first tried with @Local, and @EJB wouldn't find it. I then tried JNDI lookup on "new InitialContext()", and got: Caused by: java.lang.ClassCastException: com.test.dao.TestDao$$$view2 cannot be cast to com.test.dao.TestDao I couldn't work this out. I presumed JBoss EAP 6.2 just doesn't support injecting local beans from other EARs. So I tried @Remote: @Remote public interface TestDao {...} and @Stateless(name="TestDao") public class TestDaoImpl implements TestDao {...} But in my RequestHandler class, @EJB private TestDao testDao; will not find it. It gets: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.test.dao.TestDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.ejb.EJB(beanName=, mappedName=, beanInterface=class java.lang.Object, description=, name=, lookup=)} I've tried @EJB(name="TestDao"), @EJB(look…
has title: Spring / EJB3.1 JNDI multiple-ear problems
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/36491925
has comment: http://stackoverflow.com/comment/36496775
answer count: 0

http://stackoverflow.com/comment/36377218
type: Comment
type: QuestionComment
has text: but it did. How can I rotate the bitmap and override existing file?
comment on: http://stackoverflow.com/q/23677098
score: 0

http://stackoverflow.com/q/23757856
has title: How to print align with my display
favorite count: 0
type: UnansweredQuestion
has body: for (int j = 0; j &lt; numStu; j++) { System.out.println((j + 1) + "\t" + StudentName[j] + "\t\t\t" + (Marks[j]) + "\t" + Grade[j]); } No. Name Marks Grade 1 ADRIAN TAN 46.00 C- 2 KIM CHEE LIONG HAN 76.00 A- 3 PETER LIM AH MENG 64.00 B- 4 WAYNE WALKER 23.00 F Sorry for previous question >&lt; This is my output for the command above. The desired output is: No. Name Marks Grade 1 ADRIAN TAN 46.00 C- 2 KIM CHEE LIONG HAN 76.00 A- 3 PETER LIM AH MENG 64.00 B- 4 WAYNE WALKER 23.00 F
has answer: http://stackoverflow.com/a/23757986
upvote count: 2
tagged with: output
type: Question
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/23759294
linked to: http://stackoverflow.com/q/15961130
answer count: 2
downvote count: 4
tagged with: printing
duplicate of: http://stackoverflow.com/q/15961130
tagged with: alignment

http://stackoverflow.com/comment/36488940
score: 0
comment on: http://stackoverflow.com/q/23736491
type: Comment
type: QuestionComment
has text: Can you show the code your are using?

http://stackoverflow.com/a/23775659
type: AcceptedAnswer
downvote count: 0
has body: By using this("My Name"); from inside a constructor, you are invoking another overloaded constructor of the Class A, but, you haven't define a constructor which accepts String argument. So compiler complains it. Possible corrected version public class A{ String name; public A(){ this("My Name"); } public A(String name){ this.name = name; } }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23775610
accepted answer of: http://stackoverflow.com/q/23775610

http://stackoverflow.com/a/23727021
has comment: http://stackoverflow.com/comment/36471099
has comment: http://stackoverflow.com/comment/36471007
answers question: http://stackoverflow.com/q/23713809
has comment: http://stackoverflow.com/comment/36478943
has comment: http://stackoverflow.com/comment/36472470
type: Answer
has comment: http://stackoverflow.com/comment/36471170
has comment: http://stackoverflow.com/comment/36474295
has body: This might help: Deferred Binding Using Replacement The first type of deferred binding uses replacement. Replacement means overriding the implementation of one java class with another that is determined at compile time. For example, this technique is used to conditionalize the implementation of some widgets, such as the PopupPanel. The use of for the PopupPanel class is shown in the previous section describing the deferred binding rules. The actual replacement rules are specified in Popup.gwt.xml, as shown below: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsDeferred.html
score: 0
has comment: http://stackoverflow.com/comment/36472483

http://stackoverflow.com/q/23696956
has answer: http://stackoverflow.com/a/23700911
has comment: http://stackoverflow.com/comment/36416288
has comment: http://stackoverflow.com/comment/36416716
answer count: 1
has comment: http://stackoverflow.com/comment/36418727
favorite count: 0
accepted answer: http://stackoverflow.com/a/23700911
score: 1
has comment: http://stackoverflow.com/comment/36418131
has comment: http://stackoverflow.com/comment/36416906
tagged with: super
has body: I want to resize the grid in gridworld from the default 10x10 to whatever I want. I've been testing it with 15x15 just to see if it works. But I can't seem to figure this out and other sources on the internet say that what I'm doing should work. The grid stays at 10x10 even though I try and set rowSize &amp; colSize, how can I fix this so that it opens the grid to a 15x15 screen? This class is where I resize the grid import info.gridworld.actor.*; import info.gridworld.grid.BoundedGrid; public class pokeGrid extends ActorWorld{ private static final int rowSize = 15; private static final int colSize = 15; public pokeGrid(){ super(new BoundedGrid&lt;Actor&gt;(rowSize, colSize)); } } This class is the runner for the actor public class BeecherBugRunner extends pokeGrid { private static pokeGrid world = new pokeGrid(); public static void main(String[] args) { ActorWorld world = new ActorWorld(); BeecherBug beecher = new BeecherBug(4); world.add(new Location(7, 8), beecher); world.show(); } }
has comment: http://stackoverflow.com/comment/36416318
type: AnsweredQuestion
has title: Having problems trying to resize gridworld grid
tagged with: java
downvote count: 3
tagged with: gridworld
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36416477

http://stackoverflow.com/a/23640229
answers question: http://stackoverflow.com/q/23635159
score: 0
has body: When the activity comes to the front, onNewIntent() is called, you can start your AsyncTask there.
type: Answer
has comment: http://stackoverflow.com/comment/36327231
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36338202
accepted answer of: http://stackoverflow.com/q/23635159

http://stackoverflow.com/comment/36498588
score: 0
comment on: http://stackoverflow.com/a/23711277
type: AnswerComment
has text: Thanks a lot for the continued help Bohemian. I added the names to the bottom of my original question since I can't do formatting in the comments. The last two names don't follow their formatting rules so I don't think there is code that can account for it, I'll ask the lenders to fix their file.
type: Comment

http://stackoverflow.com/comment/36549626
comment on: http://stackoverflow.com/q/23764824
has text: I'm sorry. I didn't see your comment. No I have not. I should probably try it, do I need to remove both fragments? Or am I lost when I say that?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36489667
comment on: http://stackoverflow.com/a/23734168
type: AnswerComment
has text: @Vishrant- I just need to put my files on a server, and run a batch command to execute it. Server takes care of the rest.
score: 0
type: Comment

http://stackoverflow.com/comment/36526994
has text: I guess the `rsBundle.getString` has something to it that returns `null` or something else when the value is `0`. Just add a check for this and you're done.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23756962

http://stackoverflow.com/comment/36292084
has text: I verified in Java APIs and made it shorter, thanks Sergiy for hints!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23632983
type: AnswerComment

http://stackoverflow.com/comment/36374781
score: 0
type: Comment
has text: welcome :) happy to help . Feel free to up vote and accept the answer if it helped . so that it would useful to ohters
type: AnswerComment
comment on: http://stackoverflow.com/a/23676521

http://stackoverflow.com/a/23727197
answers question: http://stackoverflow.com/q/23726578
upvote count: 1
has body: &lt;h:outputText value="#{blogManager.item.text}" should be &lt;h:outputText value="#{item.text}" You should also initialize the new entity in a bean's constructor, if it doesn't need an initialization value from a service. Edit : Try changing @Named("blogmanager") to @Named("blogManager") and in your facelet, replace &lt;h:inputTextarea value="#{blogmanager.blogEntity.text}" by &lt;h:inputTextarea value="#{blogManager.blogEntity.text}" &gt; In the Java programming language, the convention / standard way to name objects is to use a lower case letter for the first letter. i.e change BlogEntity to blogEntity. Your problem is not related to that, but still it's a good thing to stick to standards.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23726578
score: 1

http://stackoverflow.com/q/23695240
tagged with: illegalstateexception
answer count: 1
has comment: http://stackoverflow.com/comment/36409217
has title: Android: Getting an IllegalStateException that I cannot catch
accepted answer: http://stackoverflow.com/a/23695314
tagged with: android
has body: I'm getting an error in my application. My usual debugging method is to track down the line causing the problem, wrap it up in Logs, and figure out what I did wrong. In this case, I believe I know which line is causing the problem, but it's stumping me. Worse, I wrapped it in try/catch and nothing is being caught. So I conclude one of two things is going on: I'm wrong about which line is causing the error I did something stupid and it's staring me in the face So tell me, is there any chance the error is not caused by the setText line? And if not, why couldn't catch catch it? (BTW, clicking on the line 207 link brings me to the "try" line. The method this is in is called from an onClick method. R.id.updater_title refers to a TextView inside the inflater. mThis refers to "this" from ) Based on these lines of code: LayoutInflater layoutInflater = (LayoutInflater) mThis.getSystemService(LAYOUT_INFLATER_SERVICE); View view=layoutInflater.from(mThis).inflate(R.layout.connection_update,null); if (v.getId() == R.id.AddFriendButton) { //Change dialog to Add Log.d("editUserDialog","updater_title: " + R.id.updater_title + "; AddTitle: " + R.string.Friends_AddTitle); Log.d("editUserDialog","AddTitle: " + getString(R.string.Friends_AddTitle)); try {((TextView)findViewById(R.id.updater_title)).setText(R.string.Friends_AddTitle);} catch(Exception e) {Log.e("editUserDialog","Err: " + e.getMessage());} Log.d("editUserDialog - Add", "updater_title changed"); Log.d("editUserDialog - Add","StateList1 = " + StateList.get(1)); friendState.set(0,StateList.get(1),"your friend"); //"your friend" should ideally be replaces with friend's name } And this Log stack: 05-16 00:34:26.295 17798-17798/com.farmsoft.lunchguru.app D/editUserDialog﹕ updater_title: 2131165293; AddTitle: 2131361798 05-16 00:34:26.445 17798-17798/com.farmsoft.lunchguru.app D/editUserDialog﹕ AddTitle: Add New Friend 05-16 00:34:26.455 17798-17798/com.farmsoft.lunchguru.app D/AndroidRuntime﹕ Shutting down VM 05-16 00:34:26.4…
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: error-handling
type: Question
has answer: http://stackoverflow.com/a/23695314

http://stackoverflow.com/comment/63341382
type: AnswerComment
has text: @Prashanth Debbadwar I think you forgot to stop the first run before starting it a second time. For the 2nd attempt, the tomcat server could not start since port 8080 was still in use by the 1st run. Click the red 'Terminate' button before attempting to run a 2nd time. Hope that helps.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28349142

http://stackoverflow.com/comment/36843941
comment on: http://stackoverflow.com/a/23717684
type: Comment
has text: @wal Now that you mention it... :)
type: AnswerComment
score: 0

task
type: Tag
tags question: http://stackoverflow.com/q/23675209
tag name: task
tags question: http://stackoverflow.com/q/23740323
tags question: http://stackoverflow.com/q/23701639

applet
tags question: http://stackoverflow.com/q/23746816
tags question: http://stackoverflow.com/q/23646029
tags question: http://stackoverflow.com/q/23721291
tags question: http://stackoverflow.com/q/23719242
tags question: http://stackoverflow.com/q/23645530
tags question: http://stackoverflow.com/q/23772354
tags question: http://stackoverflow.com/q/23752595
tags question: http://stackoverflow.com/q/23705083
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/23664071
tags question: http://stackoverflow.com/q/23670838
tags question: http://stackoverflow.com/q/23701232
tags question: http://stackoverflow.com/q/23732994
tags question: http://stackoverflow.com/q/23652511
tags question: http://stackoverflow.com/q/23643679
tags question: http://stackoverflow.com/q/23658651
tags question: http://stackoverflow.com/q/23651659
tags question: http://stackoverflow.com/q/23737359
tags question: http://stackoverflow.com/q/23770007
tags question: http://stackoverflow.com/q/23737038
tags question: http://stackoverflow.com/q/23634784
tags question: http://stackoverflow.com/q/23743447
tags question: http://stackoverflow.com/q/23704024
tags question: http://stackoverflow.com/q/23718078
tags question: http://stackoverflow.com/q/23746085
tags question: http://stackoverflow.com/q/23626127
tags question: http://stackoverflow.com/q/23642816

http://stackoverflow.com/q/23681760
has comment: http://stackoverflow.com/comment/36384744
type: AnsweredQuestion
tagged with: java
has title: Java File and Files classes both not recognizing UNC directories
has body: I've created both a File and Files object in Java based on a UNC path. When I check to see if the object isDirectory, both classes return false: sourceDirectory = new File( "\\\\mymachine\\test\\new\\" ); boolean b = sourceDirectory.isDirectory(); Path path = sourceDirectory.toPath(); boolean a = Files.isDirectory( path ); results: b=false and a=false What do I need to do to have my UNC directory recognized as a directory by File and Files?
has comment: http://stackoverflow.com/comment/36385193
type: Question
has answer: http://stackoverflow.com/a/23682547
accepted answer: http://stackoverflow.com/a/23682547
score: 0
answer count: 1

http://stackoverflow.com/comment/36365255
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23671817
has text: @Raghunandan I dont know when this changed but that was the problem, Im amazed that it didnt give me an error in the code because of that, Thankyou got the fix been trying to get that figured out for about 3h so far....

http://stackoverflow.com/q/23617691
score: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/8577545
answer count: 1
has title: javax.el.PropertyNotFoundException error on jsp
type: UnansweredQuestion
tagged with: servlets
tagged with: jstl
tagged with: jsp
tagged with: propertynotfoundexception
type: Question
has body: I have a List<Products> which contains data of my products table. On a servlet I am getting this List<Products>. I am passing this list to JSP by following code: List<Products>Products=new SessionBeanClass().DisplayProducts(arr); request.setAttribute("Products",Products); request.getRequestDispatcher("sample2.jsp").forward(request, response); And I am displaying data of LIST on JSP by following code: <c:forEach items="${requestScope['Products']}" var="emp" > ${emp.getPrice()} </c:forEach> But when I write like this <c:forEach items="${requestScope['Products']}" var="emp" > ${emp.Price()} </c:forEach> It shows me an error javax.el.PropertyNotFoundException 'Price' not found Why?
has answer: http://stackoverflow.com/a/23617723
linked to: http://stackoverflow.com/q/8577545

http://stackoverflow.com/comment/36283558
type: Comment
type: QuestionComment
has text: What error do you get?
score: 0
comment on: http://stackoverflow.com/q/23630429

http://stackoverflow.com/q/23739415
has body: my question is simple, why we need the main() method?. jvm call public static void main() method to start application. as well as static block also executed after classes loaded. without main() the program gives main method not found exception but you can avoid this error by adding System.exit(0) line at the static block after your statements, then whats the point of main() method?. is there any functionality's not available without main method? class A{ public static void main(String ar[]){ ..... .... } // VS static{ .... ... System.exit(0); // to avoid main method not found error } }
type: Question
has answer: http://stackoverflow.com/a/23739497
has answer: http://stackoverflow.com/a/23739699
has answer: http://stackoverflow.com/a/23739465
has comment: http://stackoverflow.com/comment/36495019
has comment: http://stackoverflow.com/comment/36493581
has comment: http://stackoverflow.com/comment/36494053
has answer: http://stackoverflow.com/a/23739520
has comment: http://stackoverflow.com/comment/36493493
possible better answer: http://stackoverflow.com/a/23739465
has comment: http://stackoverflow.com/comment/36495328
downvote count: 0
favorite count: 0
has title: difference between static block vs main method in java
answer count: 4
accepted answer: http://stackoverflow.com/a/23739520
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36495263
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23703974
score: 4
has comment: http://stackoverflow.com/comment/36793908
upvote count: 4
downvote count: 0
has body: About saving the state of JSF application on a temporary basis, without using session: An alternative is using t:saveState of Apache Tomahawk library; another more recent alternative is using CDI @ConversationScope &lt;t:saveState&gt; is from old JSF 1.x times and its use should remain for those applications. @ConversationScope comes from CDI 1.0, to extend the life of the state of JSF beans and components along several requests, and uses an identifer that pass along the requests. The best alternative when using JSF 2 is @javax.faces.bean.ViewScoped, and since JSF 2.2 you should use @javax.faces.view.ViewScoped which is compatible with CDI 1.1. If you're going to use JSF 2.0.x or 2.1.x along with CDI 1.0, then you won't be able to use @ViewScoped. To solve this, there are third party libraries that allows view scope for your JSF beans managed by CDI. Does it worth replacing t:saveState to @ConversationScope? Since you're migrating to JSF 2.x, you must drop usage of &lt;t:saveState&gt; at all. Depending on the JSF 2.x version, you should use @ViewScope or its alternative. I would not recommend using @ConversationScope unless you want/need to keep the beans alive through several views like when implementing a flow, but JSF 2.2 also solves this by using @FlowScoped. More info: How to choose the right bean scope? JSF CDI : Conversation scope bean[s] best practice
answers question: http://stackoverflow.com/q/23702221
type: Answer
has comment: http://stackoverflow.com/comment/36491877
has comment: http://stackoverflow.com/comment/36491921

http://stackoverflow.com/comment/51725363
type: Comment
has text: kleopatra, I give a link to latest worked code on GitHub. In my latest version I do not use flag "hardCancel". I just add listeners to underlying text field and call updateItem() in overriden cancelEdit().
comment on: http://stackoverflow.com/a/28096298
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36451578
comment on: http://stackoverflow.com/a/23717428
score: 0
type: AnswerComment
type: Comment
has text: The OP "...would like to try and do it all in an if statement..."

http://stackoverflow.com/comment/37098708
comment on: http://stackoverflow.com/a/23721074
type: AnswerComment
has text: If the player is a JavaFX node, it is automatically repainted when you reposition it.
score: 0
type: Comment

eclipse-plugin
tags question: http://stackoverflow.com/q/23658947
tags question: http://stackoverflow.com/q/23759575
tags question: http://stackoverflow.com/q/23637460
tags question: http://stackoverflow.com/q/23714967
tags question: http://stackoverflow.com/q/23675830
type: Tag
tags question: http://stackoverflow.com/q/23709774
tags question: http://stackoverflow.com/q/23629116
tags question: http://stackoverflow.com/q/23697621
tags question: http://stackoverflow.com/q/23661247
tags question: http://stackoverflow.com/q/23716474
tags question: http://stackoverflow.com/q/23765336
tags question: http://stackoverflow.com/q/23625279
tags question: http://stackoverflow.com/q/23660251
tags question: http://stackoverflow.com/q/23671024
tags question: http://stackoverflow.com/q/23659414
tags question: http://stackoverflow.com/q/23721680
tags question: http://stackoverflow.com/q/23763345
tags question: http://stackoverflow.com/q/23658224
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/23675654
tags question: http://stackoverflow.com/q/23691464

http://stackoverflow.com/a/23764448
has comment: http://stackoverflow.com/comment/132766774
has comment: http://stackoverflow.com/comment/134829143
answers question: http://stackoverflow.com/q/23764265
upvote count: 3
type: Answer
downvote count: 0
has body: ZipOutputStream#closeEntry() closes the current entry in the zip file, and because you only have one entry it isn'y that big of a deal. If you need to put another entry in you just have to close the current entry first before putting the next one in. ZipOutputStream#close() closes the file stream completely, use this when you are done adding stuff to your stream. TL;DR Put the closeEntry() first if you use it, I don't know if its even necessary to close the last entry in this type of OutputStream.
score: 3

http://stackoverflow.com/comment/36552619
score: 0
has text: you are totally correct sir, I never reset the byte array
type: AnswerComment
comment on: http://stackoverflow.com/a/23769991
type: Comment

http://stackoverflow.com/q/23633412
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
score: 2
has body: I have the following generic method in my own Persistence-class: @SuppressWarnings("unchecked") public static &lt;T&gt; T getByCondition(Class&lt;T&gt; clazz, String database, Object id){ EntityManager em = getEntityManager(database); Query q = em.createQuery("SELECT t FROM "+clazz.getName()+" t WHERE t.id = :id").setParameter("id", id); T result = (T) q.getSingleResult(); return result; } The method works pretty fine, but I am concerned about the "+clazz.getName()+" in the Query as I am not very sure if this could lead to an sql-injection. Is there a better way to declare the Class I want to search for in the Query? Thanks in advance for your answers. :-)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23633568
tagged with: java
accepted answer: http://stackoverflow.com/a/23633568
type: Question
tagged with: jpa
has title: How can i make a secure createQuery in a generic method in Java?

http://stackoverflow.com/comment/70924450
type: Comment
has text: appreciate! when you stop discovery you stopping your device. so Don't do that
comment on: http://stackoverflow.com/a/23850036
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36449805
type: QuestionComment
comment on: http://stackoverflow.com/q/23716272
has text: Two reasons- a) It allows me to access them without creating an instance b) As they do not interact with instance variables, they can be static. Other static methods I was hoping to create include a method to return an array of objects which are unsynced.
score: 0
type: Comment

http://stackoverflow.com/comment/36281532
has text: in my situation there will be more that 30 threads, How will cancel all the asynch task at once??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23629195

http://stackoverflow.com/comment/36266725
type: Comment
type: QuestionComment
score: 1
has text: i believe you should pass your url to the HttpPost
comment on: http://stackoverflow.com/q/23621192

http://stackoverflow.com/comment/36521754
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23754112
type: Comment
has text: Ok. I see that. You are only reading one file it seems.. what is your logic here ?

http://stackoverflow.com/q/23759219
possible better answer: http://stackoverflow.com/a/23759348
type: Question
has comment: http://stackoverflow.com/comment/36530993
tagged with: java
has comment: http://stackoverflow.com/comment/36531133
has answer: http://stackoverflow.com/a/23759800
accepted answer: http://stackoverflow.com/a/23759800
has comment: http://stackoverflow.com/comment/36531040
score: 0
has comment: http://stackoverflow.com/comment/36531246
tagged with: vector
upvote count: 1
downvote count: 1
tagged with: arrays
has title: How to get a sequence of 5 numbers from an array
tagged with: sorting
favorite count: 0
answer count: 3
has body: I want to get a sequence of 5 numbers from an array. For example : int arr1[] = {3,88,99,5,4,6,22,32,7,45}; // array where there is the sequence 3,4,5,6,7 Vector&lt;Integer&gt; myVec = new Vector&lt;Integer&gt;(); // vector wehre to save the sequence Now what do I have to do to get the sequence from that array? I have a code here but it does not work properly: for(int i = 0; i &lt; arr1.length -1; i++) { int a = arr1[i]; int b = arr1[i+1]; int c = b - a; if(c == 1) { myvec.add(arr1[i]); } } How should I change my code to solve this?
has answer: http://stackoverflow.com/a/23759348
has answer: http://stackoverflow.com/a/23759619
has comment: http://stackoverflow.com/comment/36531315
type: AnsweredQuestion

http://stackoverflow.com/comment/36407781
score: 1
type: AnswerComment
type: Comment
has text: great, but where to set the password for the application to use and where to put the encrypted password for db?
comment on: http://stackoverflow.com/a/23693839

http://stackoverflow.com/comment/36513793
score: 0
has text: @pjs - fair enough, I was talking about entropy.
comment on: http://stackoverflow.com/q/23747810
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23637905
downvote count: 0
answer count: 6
tagged with: tomcat
favorite count: 0
possible better answer: http://stackoverflow.com/a/26396847
has answer: http://stackoverflow.com/a/49900541
upvote count: 11
accepted answer: http://stackoverflow.com/a/23638100
has answer: http://stackoverflow.com/a/77967720
score: 11
tagged with: localhost
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/70649717
has title: Port 8080 already being used by "SYSTEM"
tagged with: java
has answer: http://stackoverflow.com/a/66179393
has body: apache tomcat is not working on port 8080. I tried to figure out what program is running on port 8080 with the netstat command **C:\Users\SGaiks&gt;netstat -aon | find ":8080" TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4 TCP [::]:8080 [::]:0 LISTENING 4** the program having PID 4 is running on port 8080, so I checked what program is having PID 4 in the task manager and I get SYSTEM (here are the details since I cannot post screenshots) Name :- SYSTEM PID :- 4 Status :- Running Username:- SYSTEM CPU :- 01 Memory :- 88k Description :- NT Kernal &amp; System what does this actually mean? how do i disable the program that is using port 8080? I have seen many similar questions asked but that didn't help. (dont know if doing this is right) --> I also changed the port to some random port (localhost:2200) to run tomcat on localhost and it successfully runs. but I want it to run on localhost:8080
type: Question
has answer: http://stackoverflow.com/a/26396847
has answer: http://stackoverflow.com/a/23638100
tagged with: apache

http://stackoverflow.com/comment/36488528
type: Comment
comment on: http://stackoverflow.com/a/23736606
has text: I mean it shouldn't be use anymore, because it's been replaced by something better and word obsolete is ok to use in that sense.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23745737
score: -1
has comment: http://stackoverflow.com/comment/36505546
accepted answer: http://stackoverflow.com/a/23745817
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36505507
type: AnsweredQuestion
has body: it's my first time in development field and i'm really stuck -_- I'm developing a java application using netbeans IDE 7.4. I created all my frames and they are all working. I have a table in my database named (user) contains one username and password(i'm using mysql with wampserver) the activation of all the interfaces comes after the identification . now i want to add another user with limited privileges(can't use some buttons) how is it possible to do that? Do i have to create two versions of every frame for each user? and how to connect them to the database?
tagged with: java
has answer: http://stackoverflow.com/a/23745817
tagged with: mysql
downvote count: 1
type: Question
has title: authentification in a java application

http://stackoverflow.com/comment/36537571
has text: Possibly they are transient dependencies under a different group/artifactId. Check mvn dependency:tree to see ALL the dependencies Maven will pull in and where they are coming from.
comment on: http://stackoverflow.com/q/23762473
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23701656
score: 1
tagged with: java
upvote count: 1
has title: map.size() not working with static map
type: Question
has comment: http://stackoverflow.com/comment/36421330
has comment: http://stackoverflow.com/comment/36421326
tagged with: spring-batch
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36421310
favorite count: 0
has answer: http://stackoverflow.com/a/23701829
type: UnansweredQuestion
has body: Hey i am trying to get the size of Static map from other class... i am defining Static map in one class...as tasklet.class package com.hcsc.ccsp.nonadj.subrogation.integration; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; import org.springframework.util.Assert; import com.hcsc.ccsp.nonadj.subrogation.batch.Subrogation; import com.hcsc.ccsp.nonadj.subrogation.common.SubrogationConstants; /** * @author Manan Shah * */ public class SubrogationFileTransferTasklet implements Tasklet, InitializingBean { private Logger logger = LogManager .getLogger(SubrogationFileTransferTasklet.class); private Resource inputfile; private Resource outputfile; public static String fileLastName; public static String header = null; public static String trailer = null; public static List&lt;Subrogation&gt; fileDataListSubro = new ArrayList&lt;Subrogation&gt;(); public List&lt;String&gt; fileDataListS = new ArrayList&lt;String&gt;(); public static TreeMap&lt;String, Subrogation&gt; map = new TreeMap&lt;String, Subrogation&gt;(); public int counter = 0; public String value; @Override public void afterPropertiesSet() throws Exception { Assert.notNull(inputfile, "inputfile must be set"); } public void setTrailer(String trailer) { this.trailer = trailer; } public void setHeader(String header) { this.header = hea…
has answer: http://stackoverflow.com/a/23701794
has comment: http://stackoverflow.com/comment/36421432

http://stackoverflow.com/comment/36300230
comment on: http://stackoverflow.com/a/23619804
has text: I mean, the folder with the catalina.sh gets deleted and rebuilt. It's within the target directory. So, if I put stuff in there, it will disappear...
type: AnswerComment
score: 0
type: Comment

woodstock
tag name: woodstock
tags question: http://stackoverflow.com/q/23761594
type: Tag

http://stackoverflow.com/comment/36307987
score: 0
type: Comment
type: QuestionComment
has text: your regex should be `[0-9]+` with coma and minus, lines like `Some-Word` and `di it better, faster, stronger` will also be true.
comment on: http://stackoverflow.com/q/23642322

http://stackoverflow.com/a/23629753
score: 0
has body: change StringBuilder param = new StringBuilder(); if (a != null) { for (String str : a) { param.append("'").append(str).append("', "); } } StringBuilder param1 = new StringBuilder(); if (b != null) { for (String str : b) { param1.append("'").append(str).append("', "); } } String prm = param.toString().length() &gt; 2 ? param.toString() .substring(0, param.toString().length() - 2) : null; String prm1 = param1.toString().length() &gt; 2 ? param1.toString() .substring(0, param1.toString().length() - 2) : null; String query = "select * from products where "; if (prm != null &amp;&amp; prm1 != null) { query += "Brand in (" + prm + ") or Flavour in (" + prm1 + ")"; } else if (prm != null &amp;&amp; prm1 == null) { query += "Brand in (" + prm + ")"; } else if (prm1 != null &amp;&amp; prm == null) { query += "Flavour in (" + prm1 + ")"; }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23626304
answers question: http://stackoverflow.com/q/23626304

http://stackoverflow.com/comment/36484852
comment on: http://stackoverflow.com/q/23734845
type: QuestionComment
type: Comment
score: 2
has text: Use a JSON processor such as [Jackson](https://github.com/FasterXML/jackson).

http://stackoverflow.com/comment/36561131
type: QuestionComment
comment on: http://stackoverflow.com/q/23774563
score: 0
has text: Do you wish to simply get a signature as a image or do you also want to authenticate the user by his signature? The later can be done using JavaCv(OpenCv Wrapper). For simply getting the signature, you can create a custom view. Make a class to extend the View class, override onTouchEvent, then here you can use Path.lineTo(X,Y).
type: Comment

http://stackoverflow.com/a/23711202
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36439607
has comment: http://stackoverflow.com/comment/36440160
has comment: http://stackoverflow.com/comment/36440687
type: Answer
has comment: http://stackoverflow.com/comment/36440113
has body: There is slight problem in your code. In the finally block need to do it like this. Check for null if fis != null. This will throw a null pointer which is unhandled. This will not log in log file. finally { try { if(fis != null) { fis.close(); } } catch (IOException ex) { // Do some thing } When a thread is terminated due to uncaught exception it calls printStackTrace() and that is why you see the exception console all the time. These exceptions will not show up in your lo4j.log files. But you can see them in your application server log files for e.g. if you are using tomcat you will see them in catalina.out. What you need is UncaughtExceptionHandler that will log to your log file. See this how to add UncaughtExceptionHandler
has comment: http://stackoverflow.com/comment/36439715
accepted answer of: http://stackoverflow.com/q/23710666
has comment: http://stackoverflow.com/comment/36439611
answers question: http://stackoverflow.com/q/23710666
has comment: http://stackoverflow.com/comment/36440047
score: 0
has comment: http://stackoverflow.com/comment/36439588

http://stackoverflow.com/q/23688521
has answer: http://stackoverflow.com/a/23688595
has title: Recursion - incrementing a number and returning
has answer: http://stackoverflow.com/a/23688645
has body: Ok, this must be something really stupid....my statement is returning 2: When I print out the values they are all correct The return statement is wrong somehow Code: public static void main (String [] args) { System.out.println(countToTen(1)); } public static int countToTen(int last_answer){ last_answer++; if(last_answer != 10){ countToTen(last_answer); } return last_answer; }
type: Question
has comment: http://stackoverflow.com/comment/36397326
type: AnsweredQuestion
tagged with: recursion
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/23688563
accepted answer: http://stackoverflow.com/a/23688563
has answer: http://stackoverflow.com/a/23688625
has answer: http://stackoverflow.com/a/23688562
has comment: http://stackoverflow.com/comment/36397602
has comment: http://stackoverflow.com/comment/36397399
possible better answer: http://stackoverflow.com/a/23688625
has comment: http://stackoverflow.com/comment/36397370
has answer: http://stackoverflow.com/a/23688808
tagged with: java

http://stackoverflow.com/q/23620472
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36265417
favorite count: 0
has answer: http://stackoverflow.com/a/23624789
type: AnsweredQuestion
tagged with: paint
has title: Passing a drawn graphic
has comment: http://stackoverflow.com/comment/36266390
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: graphics
has body: I'm trying to pass a graphics element up the chain. I need to have the ability to draw a number of different die and return the correct one for each instance. I can get this to compile but I don't know if i'm doing this correctly. I want to pass the graphics component to a panel to be displayed. My shortened paint class import java.awt.*; import javax.swing.*; class DiePaint extends JPanel { Graphics g; public Graphics dieSwitch(int inInt) { return die1(); } private Graphics die1() { //reset drawing repaint(); //draw a die with 1 pip g.setColor(Color.BLACK); g.drawRect(0,0,50,50); g.drawOval(24,24,2,2); g.fillOval(24,24,2,2); //return graphic return g; } } A method in my other class i'm trying to use to call it. private void setDie() { //set die labels die1P.paint(drawDie.dieSwitch(game.getDie(0))); }
tagged with: java
has answer: http://stackoverflow.com/a/23621929
accepted answer: http://stackoverflow.com/a/23621929
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/23624789

http://stackoverflow.com/comment/36307712
comment on: http://stackoverflow.com/a/23640811
score: 0
type: AnswerComment
type: Comment
has text: @selena You want a split pane between the list and the label?

http://stackoverflow.com/q/23678143
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 1
tagged with: jdbctemplate
type: Question
has answer: http://stackoverflow.com/a/23680626
accepted answer: http://stackoverflow.com/a/23680626
upvote count: 5
score: 4
has body: what we are planning to do is we want a single project but want to use three different frame works to-gather, so is it a good idea or can this is achievable ? we have already project build up with spring and hibernate but we want to extend it with jdbc template. please guide on common quetions like -New Session factory required or not ? -Can we use pojos with hibernate annotations with jdbc template or we have to create new one ? -Will this create problem on performance if average is 500 users at a time ? Thanks in advance.
answer count: 1
has title: Spring Hibernate and JDBC Template in a Single Project
favorite count: 0
linked to: http://stackoverflow.com/q/6777419

http://stackoverflow.com/comment/36326613
type: Comment
has text: But now we're back at my initial question: With my "WeightedPanel" class I am trying to implement the exact behaviour of Android's LinearLayout with Swing: A panel that - when added as the only component of a frame - consumes the entire space available in that frame. The only panel parameter should be "Horizontal" or "Vertical". Then, each component added to that panel will be stacked horizontally or vertically, with the weight argument specifying the amount of space this component is to consume in proportion to all other components added to that panel.
comment on: http://stackoverflow.com/a/23651551
score: 0
type: AnswerComment

http://stackoverflow.com/a/23926383
score: 4
upvote count: 4
downvote count: 0
type: Answer
has body: Its Data alignment issue.Your code is not able to put used data structures in computer's right memory successfully,that caused this issue This link explains this fact correctly.
answers question: http://stackoverflow.com/q/23769803
has comment: http://stackoverflow.com/comment/36883174

http://stackoverflow.com/comment/36566113
comment on: http://stackoverflow.com/a/23767199
type: AnswerComment
has text: I got it as Table : 1 has 3 rows. Table : 2 has 2 rows. Table : 3 has 5 rows. I just copy pasted your xml to an html file and processed it. So in that case i suppose your complete url is returning more rows. Can you share the url or complete html?
type: Comment
score: 1

http://stackoverflow.com/q/23692101
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/23692194
accepted answer: http://stackoverflow.com/a/23692194
has comment: http://stackoverflow.com/comment/36405630
has answer: http://stackoverflow.com/a/23692500
possible better answer: http://stackoverflow.com/a/23692277
has title: Maven Spring boot compilation error?
has answer: http://stackoverflow.com/a/57424265
downvote count: 0
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/23692277
answer count: 4
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36404304
tagged with: maven
has body: I am trying to compile a spring boot project with mvn package command but I am getting this error. I believe I have the JDK 1.7_55 installed. [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.144s [INFO] Finished at: Fri May 16 11:57:18 EST 2014 [INFO] Final Memory: 8M/154M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project m yproject: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? Here is the output of the javac. testspring&gt;javac -version javac 1.7.0_55 And here is the output of maven version. ..\testspring&gt;mvn -v Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-20 00:51:28+1100) Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.0.5\bin\.. Java version: 1.7.0_55, vendor: Oracle Corporation Java home: C:\Program Files\Java\jre7 Default locale: en_AU, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows"
type: Question

http://stackoverflow.com/q/23676192
answer count: 3
has comment: http://stackoverflow.com/comment/36373154
has comment: http://stackoverflow.com/comment/36373653
has title: Fullscreensize & Frame in front of it
has answer: http://stackoverflow.com/a/23677193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36373529
tagged with: java
has body: I am (still) a beginner in Java, and I created a little software which contains a main frame. I need to cover all the Desktop behind my software such as a windows 98 installing screen : (I need the black and blue screen behing, covering all the task bar etc). In order to do this, I used GraphicsDevice which goes full screen. It is exactly what I needed : public class Fond_noir extends JFrame { private boolean isFullScreen = false; private GraphicsDevice device; public Fond_noir(int etat) { GraphicsEnvironment env = GraphicsEnvironment .getLocalGraphicsEnvironment(); this.device = env.getDefaultScreenDevice(); initFullScreen(etat); } private void initFullScreen(int etat) { isFullScreen = device.isFullScreenSupported(); if (etat==0) { setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); } if (etat==1) { setDefaultCloseOperation(DISPOSE_ON_CLOSE); } setUndecorated(isFullScreen); setResizable(!isFullScreen); if (isFullScreen) { // Full-screen mode device.setFullScreenWindow(this); validate(); } else { // Windowed mode this.setExtendedState(MAXIMIZED_BOTH); this.setVisible(true); } } } Then, I call this method in a main somewhere else, (there's no problem with this) : public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Fond_noir(0); Choix_Langue inst = new Choix_Langue(); // main frame inst.setLocationRelativeTo(null); inst.setVisible(true); } } ); } But the problem is, that my main frame can't show-up, and it's hidden behind my fullscreen.. I'd like the opposite ! Or when I click on my main frame in my task bar (aften using the window key of my keyboard ofc..) I can only see my main frame, and the fullscreen is not showing-up with the frame => Is there a way to show both my frame and my GraphicsDevice ? Using "priorities" between them..? Thanks for reading !
tagged with: swing
has comment: http://stackoverflow.com/comment/36373106
type: Question
tagged with: fullscreen
has comment: http://stackoverflow.com/comment/36373693
has answer: http://stackoverflow.com/a/23678404
has answer: http://stackoverflow.com/a/23676659
accepted answer: http://stackoverflow.com/a/23677193
linked to: http://stackoverflow.com/q/19435048
score: 0
possible better answer: http://stackoverflow.com/a/23676659
has comment: http://stackoverflow.com/comment/36373898

xmlunit
tags question: http://stackoverflow.com/q/23748801
tag name: xmlunit
tags question: http://stackoverflow.com/q/23752354
type: Tag

http://stackoverflow.com/comment/36275591
has text: @user3587554 - I second Maroun Maroun. A minimal understanding of the problem is a must. I doubt whether the OP is completely aware of what extends means. Like we all did (and still do), the OP should go back and check the basics.
comment on: http://stackoverflow.com/a/23625942
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/36317056
has text: The same way, set the series paint. If each series shares a common name I might write a new renderer
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23632421

http://stackoverflow.com/comment/36429339
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23705574
has text: Is the jar file for org.geotools.cs.GeographicCoordinateSystem in the lib folder? Also look into this: http://docs.oracle.com/cd/E11035_01/wls100/programming/classloading.html
type: Comment

http://stackoverflow.com/comment/36301016
score: 0
type: AnswerComment
has text: I changed welcome file from index.jsp to default.jsp in web.xml and tried but it is still giving the same error. And checked by removing welcome-file-list tag too but no result. And I checked it by modifying the url-pattern to "/*.action" but encountering same problem.
comment on: http://stackoverflow.com/a/23638956
type: Comment

http://stackoverflow.com/q/23706358
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23706545
has comment: http://stackoverflow.com/comment/36432154
has comment: http://stackoverflow.com/comment/36430828
score: 7
has comment: http://stackoverflow.com/comment/36430729
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/179427
has answer: http://stackoverflow.com/a/23706882
has comment: http://stackoverflow.com/comment/36430757
tagged with: floating-point
type: Question
has comment: http://stackoverflow.com/comment/36431260
has comment: http://stackoverflow.com/comment/36430726
upvote count: 9
possible better answer: http://stackoverflow.com/a/23706882
has comment: http://stackoverflow.com/comment/36430701
linked to: http://stackoverflow.com/q/6837007
has comment: http://stackoverflow.com/comment/36431020
accepted answer: http://stackoverflow.com/a/23706545
has comment: http://stackoverflow.com/comment/73337819
has comment: http://stackoverflow.com/comment/36430867
has title: In Java, how do I test whether a list of `Double` contains a particular value
has answer: http://stackoverflow.com/a/23707213
favorite count: 0
has body: Background: Floating point numbers have rounding issues, so they should never be compared with "==". Question: In Java, how do I test whether a list of Double contains a particular value. I am aware of various workarounds, but I am looking for the most elegant solution, presumably the ones that make use of Java or 3rd party library features. import java.util.ArrayList; import java.util.List; public class Test { public static void main(String[] args) { // should be 1.38, but end up with 1.3800000000000001 Double d1 = new Double(1.37 + 0.01); System.out.println("d1=" + d1); // won't be able to test the element for containment List&lt;Double&gt; list = new ArrayList&lt;Double&gt;(); list.add(d1); System.out.println(list.contains(1.38)); } } Output is: d1=1.3800000000000001 false Thank you.
has comment: http://stackoverflow.com/comment/36430724
has answer: http://stackoverflow.com/a/23706568
has comment: http://stackoverflow.com/comment/36430790

http://stackoverflow.com/comment/36501416
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23743162
has text: Remember, having the same _toString()_ implementation (as shown by your logging) isn't enough for the objects to be equal. You must have _mod1.equals(mod2) == true_ which, if you have not overridden the _equals()_ method in _Module_ is the same as _mod1 == mod2_.

http://stackoverflow.com/q/23727648
linked to: http://stackoverflow.com/q/1158777
has title: How to rename a file without making another file (Java)
has comment: http://stackoverflow.com/comment/36471943
accepted answer: http://stackoverflow.com/a/23727684
linked to: http://stackoverflow.com/q/1914474
downvote count: 1
has answer: http://stackoverflow.com/a/23727672
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: rename
has answer: http://stackoverflow.com/a/23727684
has body: I am looking for a away to rename a file to a string. renameTo only takes another file as a parameter, but I want it to take a string. So basically, how do I implement this method here? public static void renameFile(File toBeRenamed, String new_name) { } I would like to rename the file "toBeRenamed" to "new_name". Do I have to make another file called new_name, or is there some workaround? Thanks! EDIT: Thanks for the answer Luiggi. Here is a pic of the new error:
has comment: http://stackoverflow.com/comment/36471756
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/36471731
possible better answer: http://stackoverflow.com/a/23727672
favorite count: 0

http://stackoverflow.com/comment/36445380
comment on: http://stackoverflow.com/q/23713884
score: 0
type: Comment
has text: One of my main questions is where is the cache data to be stored? Say someone selects an option from a dropdown and the results are returned from a DB. How do I store those results such that the person can close the web browser, reopen it, select the same dropdown option but this time it retrieves the saved data rather than pulling from the DB again. Where am I retrieving this data from? A .Ser file?
type: QuestionComment

http://stackoverflow.com/comment/36385866
comment on: http://stackoverflow.com/q/23680020
has text: You could keep a reference to the current MediaPlayer object as a private field of the class; that way you can call stop() on it before replacing it with the new one. Or event better, reuse the MediaPlayer object.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36416492
has text: Compilers (or, in Java's case, Hotspot) are very good at common subexpression removal. Code should be readable by programmers, and should visibly conform to requirements.
comment on: http://stackoverflow.com/q/23699268
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/q/23699859
score: 0
has title: Starting eXtreme Scale containers automatically
has body: I am stuck at trying to deploy war application which contains objectGrid.xml and objectGridDeployment.xml in its META-INF directory and should according to documentation (http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.extremescale.admin.doc%2Ftxsstartwas.html) automatically start new container grid. But it doesn't :( More than that, if I make a mistake in XML server would not see it. I decided to go back and test at least tutorial (https://www.ibm.com/developerworks/community/blogs/714470bb-75c8-4f99-8aca-766c0d55a21c/entry/websphere_extreme_scale_getting_started_with_websphere_application_server_sample5?lang=en) but it doesn't work either. Please help! My environment: WebSphere Liberty Profile for Developers (installed from wlp-developers-runtime-8.5.5.0.jar) WebSphere eXtreme Scale (installed from wxs-wlp_8.6.0.4.jar) Configuration files in attachments and my war application (http://we.tl/VRn98fooP5)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36665900
tagged with: java
has answer: http://stackoverflow.com/a/31544494
accepted answer: http://stackoverflow.com/a/31544494
tagged with: ibm-wxs
type: Question
has comment: http://stackoverflow.com/comment/36602031
tagged with: websphere
tagged with: enterprise
answer count: 1
tagged with: grid-computing

http://stackoverflow.com/a/23663249
type: Answer
answers question: http://stackoverflow.com/q/23662306
has comment: http://stackoverflow.com/comment/36348878
has body: It's very simple. First of all you need to attach lombok.jar to your project. Right click your project &amp; go to properties. Attach external jar/library. Now import the following:- import lombok.Getter; import lombok.Setter; import lombok.AccessLevel; // and so on.... Now you're able to use @Getter @Setter as follows:- @Getter @Setter private Car car; Now you're able to use getCar() &amp; setCar(...) Note:- You may need to enable annotation processing for NetBeans. Don't ask me how to do that. Just google it or visit lombok's site.
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/a/45394054
type: Answer
answers question: http://stackoverflow.com/q/23734004
score: 0
has body: Ehlo, team! I try copy rows from List to XSSLSheet For this I try execute next code: HashMap&lt;String, XSSFRow&gt; listRows = new HashMap&lt;String, XSSFRow&gt;(); List&lt;XSSFRow&gt; rl = new ArrayList&lt;XSSFRow&gt;(listRows.values()); CellCopyPolicy ccp = new CellCopyPolicy(); ccp.setCopyCellValue(true); ccp.setCopyCellStyle(false); ccp.setCopyMergedRegions(false); destSheet.copyRows(rl, 5, ccp) But system responds with the following message: java.lang.IllegalArgumentException: Invalid row number (-354) outside allowable range (0..1048575) org.apache.poi.xssf.usermodel.XSSFRow.setRowNum(XSSFRow.java:407) org.apache.poi.xssf.usermodel.XSSFSheet.createRow(XSSFSheet.java:739) org.apache.poi.xssf.usermodel.XSSFSheet.copyRows(XSSFSheet.java:2897) In my case resolve of this trouble - add parametr to CellCopyPolicy: ccp.setCondenseRows(true); Code working area: HashMap&lt;String, XSSFRow&gt; listRows = new HashMap&lt;String, XSSFRow&gt;(); List&lt;XSSFRow&gt; rl = new ArrayList&lt;XSSFRow&gt;(listRows.values()); CellCopyPolicy ccp = new CellCopyPolicy(); ccp.setCopyCellValue(true); ccp.setCopyCellStyle(false); ccp.setCopyMergedRegions(false); ccp.setCondenseRows(true); //look here destSheet.copyRows(rl, 5, ccp) Best regards &amp; 73 )

http://stackoverflow.com/comment/36462054
comment on: http://stackoverflow.com/a/23722145
score: 0
type: AnswerComment
type: Comment
has text: that means the view doe snot belong to the fragment layout. Yes youa re supposed to post the xml where you have the view and the fragment code. rest all unnecessary

http://stackoverflow.com/comment/36316324
type: QuestionComment
type: Comment
has text: @MadProgrammer What should I change the row/column weights or `fill` to? I tried to remove the `fill` line but then it seems to resize my panels to a size of 10x10 pixels. Same thing happened when I removed the rowWeights / columnWeights line.
comment on: http://stackoverflow.com/q/23646297
score: 0

http://stackoverflow.com/comment/36349820
type: Comment
type: QuestionComment
has text: Are you using an IDE? If so, what language compatibility level is it set to? If it's set to 1.4 or below, you'll get this error message. `printf` uses vararg methods, a feature that wasn't introduced until Java 1.5 (aka Java 5).
comment on: http://stackoverflow.com/q/23663319
score: 0

http://stackoverflow.com/comment/36445184
has text: Try with `gfx.clearRect(0, 0, getWidth(), getHeight());` in your code before new drawing.
score: 1
comment on: http://stackoverflow.com/a/23714284
type: AnswerComment
type: Comment

websphere-8
tags question: http://stackoverflow.com/q/23656786
tags question: http://stackoverflow.com/q/23685196
tags question: http://stackoverflow.com/q/23764475
type: Tag
tag name: websphere-8

http://stackoverflow.com/comment/36283193
has text: I have difficulties in understanding in what you have said. +1 for mentioning 'pool of connections'.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23630188

http://stackoverflow.com/a/23681174
answers question: http://stackoverflow.com/q/23680939
has body: You need to do something like this: public class ComboBoxDemo ... implements ActionListener { . . . departments.addActionListener(this); . . . public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String department= (String)cb.getSelectedItem(); updateCourse(department); } . . . } You can get the selected item in this method and accordingly you can populate course combo box. Here is the link to get you started
type: Answer
score: 0

http://stackoverflow.com/q/23764167
score: 5
has comment: http://stackoverflow.com/comment/78160643
has answer: http://stackoverflow.com/a/23764313
tagged with: findbugs
has body: FindBugs recognizes the following bug in my code: Suspicious comparison of Long references I have tried Googling this particular error but with no luck. As far as I know comparing fields of data type Long should be done with == operator. if (materialDefinition.getId() == definitionToRemoveFromClass.getId()) { //... } I am certain both methods .getId() return a Long. Is this really an issue and if so, how do I fix it?
has title: Java FindBugs: Suspicious comparison of Long references
favorite count: 0
possible better answer: http://stackoverflow.com/a/23764313
has answer: http://stackoverflow.com/a/23764215
accepted answer: http://stackoverflow.com/a/23764215
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/45259367
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36540744
downvote count: 1
has answer: http://stackoverflow.com/a/23764218
type: Question

http://stackoverflow.com/comment/36493609
has text: Ah, I somehow hadn't considered the possibility of identical run times. Thanks, I'll see how an ArrayList goes.
score: 1
comment on: http://stackoverflow.com/a/23739375
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23635563
score: 0
has comment: http://stackoverflow.com/comment/36319444
type: Answer
has body: No - JavaFX has no setRedraw() to queue drawings - but you are free to construct the Node hierarchy in a detached mode and then attach the whole graph-structure at once (most nodes if not attached to the SG can be used in a none-ui thread as well - unfortunately webview is one of the exceptions!)
has comment: http://stackoverflow.com/comment/36320440
answers question: http://stackoverflow.com/q/23632775

http://stackoverflow.com/q/23765512
has title: Parsing XML having list of objects into javaobject using Xstream
tagged with: java
type: Question
answer count: 1
has body: I want to convert a XML to java object using Xstream. Below is how my implementation to do this. I have a XML which looks like: spacekey1 spacekey2 spacekey3 Test1 Test1value Test2 Test2value ITest3 Test3Value spacekey11 spacekey22 spacekey33 Test1 Test1value1 Test2 Test2value2 ITest3 Test3Value3 and I have 2 java objects for which I want to convert the above XML using Xstream: CWATST.class @XStreamAlias("CWATSR") public class CWATSR { @XStreamImplicit private List atsp; //Getters and setters } WrappedReflectingDefinition.class @XStreamAlias("ATSP") public class ATSP implements Serializable { @XStreamImplicit(itemFieldName = "Keys") @XmlElement(name = "Keys") private List<String> Keys; @XStreamAlias("STATM") private Map<String, String> STATM; // Getters and setters } My Xstream code is (body is the XML stated above): xstream.processAnnotations(CWATSR .class); xstream.processAnnotations(ATSP.class); CWATSR cwatsr = (CWATSR ) xstream.fromXML(body); I get the following exception: Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: Keys:Keys at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:464) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:396) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:247) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller…
accepted answer: http://stackoverflow.com/a/23778571
score: 0
has comment: http://stackoverflow.com/comment/36548292
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23778571
linked to: http://stackoverflow.com/q/10438124
type: AnsweredQuestion
tagged with: xstream

http://stackoverflow.com/a/23631527
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36289234
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23626633
has comment: http://stackoverflow.com/comment/36290583
has comment: http://stackoverflow.com/comment/36291022
has comment: http://stackoverflow.com/comment/36289993
score: 1
has body: The reason why it isn't the same is because you didn't account for the headers in the PNG file. If you take a look at your Java code, you are reading in the image as a byte stream in your readImage method. For PNG, there are headers involved such as the size of the image and how many bits of colour per pixel there are. Not only are you grabbing image data (which by the way is compressed using a version of LZW so you're not even reading in raw image data), but you are also grabbing in extra information which is being collected in your correlation code. What's confusing is that you are reading in the image fine using the BufferedImage type at the beginning of your correlation code to obtain the rows and columns. Why did you switch to using a byte stream in your readImage method? As such, you need to change your readImage method to take in the BufferedImage object, or reread the data like you did in the correlation method in your readImage method. Once you do that, use the BufferedImage methods to access the RGB pixels. FWIW, if you are reading in the image as grayscale, then every channel should give you the same intensity so you can operate on one channel alone. Doesn't matter which.... but make sure that you're doing correlation on grayscale images. It is ambiguous when you go to colour, as there is currently no set standard on how to do this. Using BufferedImage, you can use the getRGB method to obtain the pixel you want at column x and row y. x traverses from left to right, while y traverses from top to bottom. When you call getRGB it returns a single 32-bit integer in ARGB format. Each channel is 8 bits. As such, the first 8 bits (MSB) are the alpha value, the second 8 bits are for red, the third 8 bits are for green, and the final 8 are for blue. Depending on what channel you want, you need to bitshift and mask out the bits you don't need to get the value you want. As an example: int rgb = img.getRGB(x, y); int alpha = rgb &gt;&gt; 24 &amp; 0xFF; int red = rgb &…
upvote count: 1
has comment: http://stackoverflow.com/comment/36290226
accepted answer of: http://stackoverflow.com/q/23626633
has comment: http://stackoverflow.com/comment/36291595
has comment: http://stackoverflow.com/comment/36307259

http://stackoverflow.com/q/23655885
has comment: http://stackoverflow.com/comment/36362747
has body: I am trying to do simple chat application using android. Like whatapp, I want to run background service continuously whether activity is running or not running. 2.When I get message, then there should be notification. Once clicked on notification, activity will be opened. Using which API, I can do above all those things?
tagged with: java
type: Question
tagged with: android-service
score: 0
answer count: 2
has title: Android continuous running service
has answer: http://stackoverflow.com/a/23655970
linked to: http://stackoverflow.com/q/5203883
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23656030
tagged with: android-intent
duplicate of: http://stackoverflow.com/q/5203883

http://stackoverflow.com/comment/36535661
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23761257
has text: Once you start to use ColumnLabelProvider you have to use it for all columns.

http://stackoverflow.com/q/23748101
score: 1
tagged with: java
upvote count: 1
tagged with: wsdl2java
has body: I am getting Cannot find dispatch method for exception when I send the request. Could not find where the problem is. <soapenv:Body> <idt:completeRequest> <idt:transactionId>1111</idt:transactionId> <idt:transactionTime></idt:transactionTime> </idt:completeRequest> </soapenv:Body> <S:Body> <ns2:Fault xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"> ns2:Client Cannot find dispatch method for {https://svp.idt.net/WebServices/IDTSvpAPI}completeRequest </ns2:Fault> </S:Body> WSDL file ---- Contract first approach I am getting Cannot find dispatch method for exception when I send the request. Could not find where the problem is. <xsd:complexType name="transactResponse"> <xsd:sequence> <xsd:element name="requestTransactionId" type="xsd:string" /> <xsd:element name="responseCode" type="xsd:string" /> <xsd:element name="processErrorMessage" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:element name="transactResponse" type="tns:transactResponse"/> <xsd:complexType name="completeRequest"> <xsd:sequence> <xsd:element name="transactionId" type="xsd:string" /> <xsd:element name="transactionTime" type="xsd:dateTime" /> </xsd:sequence> </xsd:complexType> <xsd:element name="completeRequest" type="tns:completeRequest"/> <xsd:complexType name="completeResponse"> <xsd:sequence> <xsd:element name="responseCode" type="xsd:string" /> <xsd:element name="processErrorMessage" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:element name="completeResponse" type="tns:completeResponse"/> <xsd:complexType name="cancelRequest"> <xsd:sequence> <xsd:element name="transactionId" type="xsd:string" /> <xsd:element name="statusCode" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:element name="cancelRequest" type="tns:cancelRequest"/> <xsd:complexType name="cancelResponse"> <xsd:sequence> <xsd:element name="responseCode" type="xsd:string" /> <xsd:element name="processErrorMessage" type="xsd:string" /> </xs…
type: Question
has title: Cannot find dispatch method for {https://svp.idt.net/WebServices/IDTSvpAPI}completeRequest
tagged with: wsdl
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: soa
answer count: 0

http://stackoverflow.com/comment/36322136
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23649618
has text: @AdityaEkbote I have renamed mail host name, but yes I do have account on it. Account is <no reply> account so it's password is not with me.
type: Comment

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/23736986

http://stackoverflow.com/comment/36535421
comment on: http://stackoverflow.com/q/23761242
has text: Sure thing. Maybe there is some solution with lombok?
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36259091
type: QuestionComment
comment on: http://stackoverflow.com/q/23617073
has text: I was just asking for help, for Christs sake.
score: 0
type: Comment

http://stackoverflow.com/a/23628340
has comment: http://stackoverflow.com/comment/36280074
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36489483
has comment: http://stackoverflow.com/comment/36513604
has comment: http://stackoverflow.com/comment/36481606
has comment: http://stackoverflow.com/comment/36572268
has comment: http://stackoverflow.com/comment/36280260
has body: I started learning JavaFX last summner and it is really great and easy to use. I don't think you should know anything before start learning. A little bit xml knowladge can be beneficial but I don't think it is necassary because JavaFX secene builder generates .fxml files generically. So you can directly start using it.
has comment: http://stackoverflow.com/comment/36279955
answers question: http://stackoverflow.com/q/23628196
upvote count: 1

http://stackoverflow.com/a/23875553
has body: Your first approach is almost the same I used in a project time ago. The difference is that I was not sharing the modulus and exponent but the whole public key encoded in base 64 (without the -----BEGIN/END PUBLIC KEY----- header/footer), converting it back and forth to the appropriate classes in the end device. Basically the same concept is applied to encrypted data, always share Base64 encoded data to avoid conversion issues. So far your approach thus should be fine if you hadn't any conversion issue (and you can find issues easily by converting the public keys to its base64 representation, on both android and iOS the string should be exactly the same, otherwise something bad happened). The problem you have (getting error - too much data for RSA block) is because the text you are encrypting is too large for the key size you provided. RSA can only encrypt messages that are several bytes shorter than the modulus of the key pair thus the error. What you should be doing is, generate a one-time encryption symmetric key used to encrypt/decrypt the data, exchange the data encrypted with the symmetric key and the key encrypted using RSA. This is how roughly any correctly designed RSA encryption scheme works. Anyway I think that if you try your first approach with a shorter fixed string you should observe that the first approach is probably working (unless you implemented things wrong, as you explained are theoretically correct but is hard to tell without seeing some code). Antonio
answers question: http://stackoverflow.com/q/23628518
score: 0
type: Answer

http://stackoverflow.com/q/23740655
accepted answer: http://stackoverflow.com/a/23740784
has body: CheckBox checkBox = (CheckBox) findViewById(R.id.chkAutosave); checkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (((CheckBox) v).isChecked()) DisplayToast("CheckBox is checked"); else DisplayToast("CheckBox is unchecked"); } }); What java rule does "((CheckBox) v)" use? Is it shortening? how to deconstruct it? Are there some useful shortening except this one?
has comment: http://stackoverflow.com/comment/36495699
has comment: http://stackoverflow.com/comment/36495933
favorite count: 0
has comment: http://stackoverflow.com/comment/36495706
has comment: http://stackoverflow.com/comment/36495670
has comment: http://stackoverflow.com/comment/36495721
tagged with: android
has title: What java rule "((CheckBox) v).isChecked())" use?
has answer: http://stackoverflow.com/a/23740944
upvote count: 1
has answer: http://stackoverflow.com/a/23740784
possible better answer: http://stackoverflow.com/a/23740944
downvote count: 6
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/36495654
tagged with: java
has comment: http://stackoverflow.com/comment/36495834
type: Question
answer count: 2

http://stackoverflow.com/comment/39323305
type: Comment
score: 0
type: AnswerComment
has text: Oh, I see, `PickResult` provides the intersected face (I'm not so familiar with JavaFX (yet), sorry...)
comment on: http://stackoverflow.com/a/25237633

http://stackoverflow.com/q/23778015
has comment: http://stackoverflow.com/comment/36610056
has title: IntelliJ 13 Ult. Changes encoding randomly
tagged with: java
has comment: http://stackoverflow.com/comment/36655472
has comment: http://stackoverflow.com/comment/36581007
has comment: http://stackoverflow.com/comment/36770390
type: Question
score: 5
tagged with: intellij-idea
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/36895056
answer count: 1
has comment: http://stackoverflow.com/comment/36624645
favorite count: 0
has body: So I have many modules that have different encodings (UTF-8 and ISO-8859-7) And I set their respective encodings in the File encoding section of settings and my maven builds state the encoding of each project as well. I also have these files in git and I am not alone in these project ie other people commit in them as well. What happens for the last month is this: Randomly on some files the encoding changes to UTF-8 and when I try to change it back to ISO-8859-7 it doesnt change when I select the option "Reload" it does nothing. The encoding does not change. What I have to do is the following steps: Select ISO-8859-7 as encoding Press Convert in the options then when the file is marked as changed in git I revert it only then does the encoding go back to normal My IntelliJ version: My question is this: Is this a bug or am I doing something wrong/missing something that I should have configured? UPDATE: I want to add some more info I have found useful The problem appears every time I open IntelliJ and on files that I have fixed their encoding the day before. (I dont know if this is related but it happens as well) When I convert the file to the ISO encoding the encoding and then revert the file so that I can see the text, the git branch becomes detached Also I am the only one working on this project so noone else changes the files commited in git
has answer: http://stackoverflow.com/a/23827218
type: UnansweredQuestion

http://stackoverflow.com/comment/36426407
has text: I don't think it does. Maybe a mod had a cleanup.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23699207

http://stackoverflow.com/comment/36427899
has text: it mean the textview2 is saying "dont work"
comment on: http://stackoverflow.com/a/23704865
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36275287
type: QuestionComment
comment on: http://stackoverflow.com/q/23625764
score: 1
has text: See URLClassLodaer API http://docs.oracle.com/javase/7/docs/api/java/net/URLClassLoader.html, simply create new instance of loader to unload jar (class garbage collection should be enabled too to avoid memory leaks )
type: Comment

http://stackoverflow.com/a/23756595
type: Answer
has body: If it's an RCP App, I would go with a scalable solution. Create an ImageCache object, which you instantiate at the beginning of the app lifecycle (preferably in the Activator class of the app). This ImageCache can get images (and cache them, of course) from a path relative to the plugin (e.g. plugin has a folder icons; then, when you need an icon, you just call Activator.getDefault().getImage("icons/random.png"); - where getDefault() is the Activator singleton instance). Have two of these in the ImageCache: public ImageDescriptor getImageDescriptor(final String path) { ImageDescriptor imgD = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); if (imgD == null) { return null; // OR a "missing icon", e.g. a red flag } } and public Image getImage(final String path) { Image image = imageCacheMap.get(path); if (image == null) { image = getImageDescripto(path).createImage(); imageCacheMap.put(path, image); } return image; } Since these images need to be disposed, have a method dispose() in the ImageCache which is called in the stop() method of the Activator. There are many approaches to this. In my opinion, this is the best one for RCP apps.
answers question: http://stackoverflow.com/q/23752432
score: 0

http://stackoverflow.com/a/23698416
has comment: http://stackoverflow.com/comment/36421992
answers question: http://stackoverflow.com/q/23698027
has comment: http://stackoverflow.com/comment/36479823
score: 0
has comment: http://stackoverflow.com/comment/36416234
has body: You should make sure that you have registered the ejb resource in the glassfish administration console localhost\4848 You can access the admin console on netbeans by selecting the services tab -- servers-- right click glassfish--choose start admin console. Check that the EJB is registered in the server. Also look up resource injection for further information on how to access resources from java applications. I hope this is helpful. Please post your code next time.
type: Answer
has comment: http://stackoverflow.com/comment/36416840

http://stackoverflow.com/comment/36292681
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23628819
type: Comment
has text: @user270349: you don’t need to. Just let the print method accept *only* `Supplier`s. Then you have to convert every non-`Supplier` into a `Supplier<String>` but that’s rather easy: `foo` → `foo::toString`.

http://stackoverflow.com/q/23717749
answer count: 3
has comment: http://stackoverflow.com/comment/36452153
has answer: http://stackoverflow.com/a/23717764
has body: I hope I'm posting in the right place. I'm pretty new to Java (meaning this is only my third program besides 'hello world'). I have a tip calculator I'm working on for an assignment. I'm not getting an 'error' as such, but the method for splitting the bill always seems to think each customer pays 'infinity'. I have my program set up in two classes: tipCalc1 and tipCalc2 (no points for originality of course). The program appears to run without issue besides the 'infinity' issue. Here's what I have so far. Any assistance appreciated, thanks. ***TipCalc1 Class:*** import java.util.Scanner; public class Tipcalc1 { public static void main(String[] args) { System.out.println("Welcome to Tip Calculator! "); TipCalc2 Calculator = new TipCalc2(); System.out.println("Please enter the bill amount: "); TipCalc2.calBill(); System.out.println("What percentage would you like to tip?: "); Calculator.percTip(); } } ***And the tipCalc2 class which does the dirty work:*** import java.util.Scanner; public class TipCalc2 { static double bill; double tip; double total; double split; double splitPrompt; double Y; double N; double billPerPerson; static Scanner scan = new Scanner(System.in); public static void calBill() { bill = scan.nextDouble(); } public void percTip() { tip = scan.nextDouble(); if(tip&lt;1) { total = bill * tip; } else total = bill * (tip/100); System.out.println("Your total is: " + total); Split(); } public void Split() { System.out.println("Would you like to split the bill? "); System.out.println("Enter 1 for YES or 0 for NO: "); splitPrompt = scan.nextDouble(); if(splitPrompt == 0) { System.out.println("Your total is: " + total); System.out.println("Thankyou. Goodbye."); System.out.println("End Program"); } if(splitPrompt == 1) { System.out.println("How many ways would you like to split the bill? "); splitPrompt = scan.nextDouble(); billPerPerson = total / split; System.out.println("Each person pays: " + billPerPerson); System.out.println("Thankyou. Goodbye."); System…
has answer: http://stackoverflow.com/a/53329832
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36452194
type: Question
has title: Java Tip Calculator for newbie
has answer: http://stackoverflow.com/a/23717766
score: 0

http://stackoverflow.com/a/23636107
type: Answer
score: 3
has body: Your issue is in: for(Runnable listener : listeners){ Platform.runLater(listener); this.removeListener(listener); } You need to use an iterator if you want to remove from a collection while iterating.
upvote count: 3
answers question: http://stackoverflow.com/q/23636050
downvote count: 0
has comment: http://stackoverflow.com/comment/36295347

dijkstra
tags question: http://stackoverflow.com/q/23618135
type: Tag
tag name: dijkstra

text
tags question: http://stackoverflow.com/q/23717378
tags question: http://stackoverflow.com/q/23622425
type: Tag
tags question: http://stackoverflow.com/q/23710710
tags question: http://stackoverflow.com/q/23715057
tags question: http://stackoverflow.com/q/23721691
tags question: http://stackoverflow.com/q/23687949
tags question: http://stackoverflow.com/q/23753274
tag name: text

http://stackoverflow.com/comment/36340473
type: Comment
has text: Of the game UI? Will do :) Your edited answer is more of a help.
comment on: http://stackoverflow.com/a/23658886
score: 0
type: AnswerComment

http://stackoverflow.com/q/23757048
has title: How to rename maven pom artifactId using IntelliJ refactoring?
tagged with: intellij-idea
downvote count: 0
has body: I am using IntelliJ 13 and have a Java project setup with its modules based on maven projects. There is a maven project that I must rename, so I will have to change it's artifactId property value in the pom file. If I do this manually, I will then have to find all its occurrences and modify those manually as well (ex: where it is included as a module and where it is used as a dependency). Since IntelliJ provides many refactoring techniques, I thought refactor->rename on the pom artifactId property would be supported, however it does not seem to be. I could try and do a find/replace .. but that still makes me do all the work logic (error-prone). IMO, IntelliJ should be able to detect where the pom is included as a module and which other modules use it as a dependency - anyone know of an automatic way to do this - or am I missing something here?
possible better answer: http://stackoverflow.com/a/79345391
upvote count: 24
favorite count: 0
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79345391
tagged with: java
score: 24
has answer: http://stackoverflow.com/a/23757247
accepted answer: http://stackoverflow.com/a/23757247
type: Question
answer count: 2

http://stackoverflow.com/comment/36510031
comment on: http://stackoverflow.com/q/23747982
type: Comment
type: QuestionComment
has text: That string may well be a valid pdf file in binary but you have to know what encoding it was made in. Java uses UTF-16 by default but not all encodings will be the same value.
score: 1

http://stackoverflow.com/a/23691073
type: Answer
has comment: http://stackoverflow.com/comment/36403356
score: 0
has comment: http://stackoverflow.com/comment/36403159
has body: If you don't know how to catch exceptions it is far too soon for you to be using Reflection. You don't need it here in any case. You should just use Color.YELLOW. This is the code that I would like to use. Field field = Color.class.getField("chosenColor"); Color chosen = (Color)field.get(null); This code is complete nonsense.
answers question: http://stackoverflow.com/q/23691001

http://stackoverflow.com/q/23690466
possible better answer: http://stackoverflow.com/a/23690499
tagged with: android
has title: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo java.lang.NullPointerException
has answer: http://stackoverflow.com/a/23693769
accepted answer: http://stackoverflow.com/a/23693769
has comment: http://stackoverflow.com/comment/36419053
linked to: http://stackoverflow.com/q/23653778
score: 0
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/36419667
has answer: http://stackoverflow.com/a/23690504
has comment: http://stackoverflow.com/comment/36427778
has body: I am just taking baby steps in learning Android programming..I am following some tutorials for that and while studying how to implement onKeyListener I am getting an error 'java.lang.RuntimeException: Unable to instantiate activity ComponentInfo java.lang.NullPointerException'. This error is leading to another error 'adt unfortunately app has stopped' while trying to run the app on my phone. Here is the logcat: 05-15 15:55:22.087: D/AndroidRuntime(20672): Shutting down VM 05-15 15:55:22.087: W/dalvikvm(20672): threadid=1: thread exiting with uncaught exception (group=0x41ea1ba8) 05-15 15:55:22.087: E/AndroidRuntime(20672): FATAL EXCEPTION: main 05-15 15:55:22.087: E/AndroidRuntime(20672): Process: com.example.keyboardlistener, PID: 20672 05-15 15:55:22.087: E/AndroidRuntime(20672): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.keyboardlistener/com.example.keyboardlistener.MainActivity}: java.lang.NullPointerException Thanks all for the replies..Here is my current code: Activity_Main.xml: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.keyboardlistener.MainActivity" tools:ignore="MergeRootFrame" /&gt; Fragment_Main.xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.keyboardlistener.MainActivity$PlaceholderFragment" &gt; &lt;TextView android:id="@+id/TextResults" android:layout_width="wrap_content" android:layout_height="wrap_content" and…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23690499
has comment: http://stackoverflow.com/comment/36427772
has comment: http://stackoverflow.com/comment/36427738
type: Question

http://stackoverflow.com/comment/36307864
has text: If it's already the right type, you don't need to cast, right?
comment on: http://stackoverflow.com/q/23642248
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/112268735
type: AnswerComment
score: 0
type: Comment
has text: This is where you would add the `--enable-preview` jvm argument to run an app compiled with jdk preview features. E.g. the preview features of JDK-14.
comment on: http://stackoverflow.com/a/23655608

http://stackoverflow.com/comment/36532238
comment on: http://stackoverflow.com/a/23759576
has text: Yes, right, I forgot that <: is reflexive. Could you perhaps help clarify the situation by giving an example of what would cause a compile-time error according to the quoted criteria?
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/23731773
type: Answer
has body: The glOrthof is used to create your screen coordinate system, since its input parameters are left, right, top and bottom I can not understand where the confusion lies. If you wish your top left corner is the (0,0) point then just set the top and left parameters to zero and bottom and right to some positive values so that positive X is to the right and positive Y is downwards. Some very common cases of usage of glOrthof are: View coordinate system where you insert (0,0) as top-left and (screenHeight , screenWidth) as bottom-right. In quite a few cases the bottom-left is at (0,0) though. Graph like coordinate system where screen centre is at (0,0) and then top-left is at (1,-1) and bottom-right at (-1,1) Normalized view system which has the screen centre at (0,0) but height is relative to width depending on the screen ratio. So top-left is at (-1,-(screenHeight/screenWidth)) and bottom-right at (1, screenHeight/screenWidth). You should note that only in 1st and 3rd cases your square will always be drawn as a square and not as a rectangle (where a/b = screenWidth/screenHeight). So choose which suits your application best. You should know that glOrthof is also very useful for panning and zooming. Instead of doing some strange translations and scales you can simply change glOrthof parameters so that you display a certain part of your scene.
answers question: http://stackoverflow.com/q/23705063
score: 0

cargo-maven2-plugin
tag name: cargo-maven2-plugin
tags question: http://stackoverflow.com/q/23642618
type: Tag

http://stackoverflow.com/a/23620933
answers question: http://stackoverflow.com/q/23620919
upvote count: 9
score: 9
downvote count: 0
has body: Your compound expression is equivalent to if(it&gt;4 || (++at&gt;10 &amp;&amp; it&gt;0)) due to Java operator precedence rules. The operands of || are evaluated left to right, so it&gt;4 is evaluated first, which is true, so the rest of it (the entire &amp;&amp; subexpression) doesn't need to be evaluated at all (and so at does not change).
type: Answer

http://stackoverflow.com/q/23760631
tagged with: jaws-screen-reader
has comment: http://stackoverflow.com/comment/36620866
type: Question
has comment: http://stackoverflow.com/comment/36534284
downvote count: 0
tagged with: accessibility
has comment: http://stackoverflow.com/comment/36534458
has body: I have an accessible JComboBox whose items frequently change (I perform a jComboBox.removeAllItems();, and then add the new items via jComboBox.addItem(item)). When the items change, and the user goes to select a new item I receive the following NPE: NOTE This only occurs when running JAWS java.lang.NullPointerException at javax.swing.JList$AccessibleJList$AccessibleJListChild.getAccessibleSelection(JList.java:3392) at java.awt.Component.getAccessibleStateSet(Component.java:9624) at java.awt.Component$AccessibleAWTComponent.getAccessibleStateSet(Component.java:9156) at javax.swing.JComponent$AccessibleJComponent.getAccessibleStateSet(JComponent.java:3919) at javax.swing.JList$AccessibleJList$AccessibleJListChild.getAccessibleStateSet(JList.java:3301) at com.sun.java.accessibility.AccessBridge.getAccessibleStatesStringFromContext(AccessBridge.java:1331) at com.sun.java.accessibility.AccessBridge.run(Native Method) at java.lang.Thread.run(Thread.java:724) I'm assuming this is due to the number of items in the combobox changing, but I'm not sure what's necessary to propagate the changes to the accessible context. I have the following ActionListener on the JComboBox jComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String selectedItem = (String) jComboBox.getSelectedItem(); selectedItem = selectedItem == null ? " " : selectedItem; jComboBox.getAccessibleContext().setAccessibleDescription(selectedItem); } });
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/36534376
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
has title: Java Swing JAWS accessible JComboBox throwing NPE when items change
tagged with: java

http://stackoverflow.com/q/23623487
possible better answer: http://stackoverflow.com/a/23623999
has answer: http://stackoverflow.com/a/42727646
tagged with: jasper-reports
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23653033
tagged with: java
type: Question
tagged with: jsp
has answer: http://stackoverflow.com/a/40815253
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/58302010
favorite count: 0
linked to: http://stackoverflow.com/q/16232916
has body: I have a web application in which I am creating PDF reports using JasperReport. I have hosted my website. <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*" %> <%@page import="net.sf.jasperreports.engine.JasperExportManager"%> <%@page import="net.sf.jasperreports.engine.JasperExportManager"%> <%@page import="net.sf.jasperreports.view.JasperViewer"%> <%@page import="net.sf.jasperreports.engine.JasperPrint"%> <%@page import="net.sf.jasperreports.engine.JasperReport"%> <%@page import="net.sf.jasperreports.engine.JasperFillManager"%> <%@page import="net.sf.jasperreports.engine.JRResultSetDataSource"%> <%@page import="net.sf.jasperreports.engine.JasperCompileManager"%> <%@page import="net.sf.jasperreports.*"%> JSP Page <% String invno=request.getParameter("invno"); try { String absolutePath = getServletContext().getRealPath("clDS_Close.jrxml"); JasperReport jasperReport=JasperCompileManager.compileReport(absolutePath); Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/t_fleet","root","aadi"); Statement stmt = null; ResultSet rset = null; Statement st2=conn.createStatement(); String queryString = "select tbl_invoice.*,tbl_package.package_name,tbl_package.basic_hr,tbl_package.basic_km,tbl_package.amount from tbl_invoice inner join tbl_package on tbl_invoice.package_id=tbl_package.package_id where tbl_invoice.invoice_no="+invno+""; stmt = conn.createStatement(); rset = stmt.executeQuery(queryString); JRResultSetDataSource jasperReports = new JRResultSetDataSource(rset); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,null, jasperReports); String filename=null; filename="CL"+invno+".pdf"; //Report saved in specified path JasperExportManager.exportReportToPdfFile(jasperPrint,filename); //Report open in Runtime String createdFile = getServletContext().getRealPath(filename); out.println(createdFile); Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler…
has answer: http://stackoverflow.com/a/23623999
linked to: http://stackoverflow.com/q/1979889
has answer: http://stackoverflow.com/a/23623625
linked to: http://stackoverflow.com/q/7386233
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/36271019
upvote count: 4
has comment: http://stackoverflow.com/comment/36270851
downvote count: 0
accepted answer: http://stackoverflow.com/a/23653033
has title: How to open PDF file in JSP

http://stackoverflow.com/comment/36393127
has text: @user1553248 Seeing that, you should probably throw a custom exception.
type: AnswerComment
comment on: http://stackoverflow.com/a/23643903
score: 0
type: Comment

http://stackoverflow.com/q/23707342
tagged with: vbo
type: UnansweredQuestion
downvote count: 1
tagged with: opengl
tagged with: java
tagged with: lwjgl
score: -1
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/36432657
upvote count: 0
answer count: 1
has body: I have a 2D game set up using Vertex Buffer Objects, and each 'item' in the game has its own buffer created in a for loop before the game launches. I find that the first two 'Coin' items (they vaguely look like coins...) are created successfully, displaying their textures without fail, but the other two are just blank cubes... This leads me to believe that I am binding the vertices properly because it is displaying a quad, but the texture is not being buffered properly. Here is my generating code: public void generateWorldLegacy() { for(Item item : world.items) { item.load(); //This makes the item class load its image for(int i = 0; i &lt; item.textureId.length; i++) { item.vboBuffer[i] = BufferUtils.createFloatBuffer(amountOfVertices * vertexSize); item.vboBuffer[i].rewind(); item.vboBuffer[i].put( new float[] { - item.width/2, - item.height/2, + item.width/2, - item.height/2, + item.width/2, + item.height/2, - item.width/2, + item.height/2 }); item.vboBuffer[i].flip(); //TODO I have to make these public, put all the floatbuffers into arrays so I can dispose of them when the process is terminated item.textureBuffer[i] = BufferUtils.createFloatBuffer(amountOfVertices * textureSize); item.textureBuffer[i].rewind(); item.textureBuffer[i].put(new float[] { 0, 1, 1, 1, 1, 0, 0, 0 }); item.textureBuffer[i].flip(); item.vboId[i] = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, item.vboId[i]); glBufferData(GL_ARRAY_BUFFER, item.vboBuffer[i], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); item.textureId[i] = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, item.textureId[i]); glBufferData(GL_ARRAY_BUFFER, item.textureBuffer[i], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); System.out.println(item.textureId[i] + "\n"); } } } Here is my rendering code (for the items): public void renderWorld() { glTranslatef(-player.position.x, -player.position.y, 0); for(Item i : world.items) { glTranslatef(i.position.x, i.position.y, 0); if(i.position.y - horizon &lt; player.position.y…
has title: VBO's are not created properly in LWJGL
has answer: http://stackoverflow.com/a/23707517
favorite count: 0
has comment: http://stackoverflow.com/comment/36432442

http://stackoverflow.com/q/23625085
tagged with: error-handling
has answer: http://stackoverflow.com/a/23625174
type: AnsweredQuestion
tagged with: java
has body: I am trying to find the regex of the following link http://anythingbutrbitrary.blogspot.in/search?updated-max=2014-02-10T11:58:00-08:00&amp;max-results=1. My code with regex http://anythingbutrbitrary.blogspot.in/search?updated-max=\\d{4}-\\d{2}-d{2}T\\d{2}:\\d{2}:\\d{2}-\\d{2}-\\d{2}&amp;max-results=\\d{1} returning false. What is wrong with the regex? My java code is as follows: String regex= "http://anythingbutrbitrary.blogspot.in/search?updated-max=\\d{4}-\\d{2}-d{2}T\\d{2}:\\d{2}:\\d{2}-\\d{2}-\\d{2}&amp;max-results=\\d{1}"; Pattern p=Pattern.compile(Pattern.quote(regex)); Matcher m = p.matcher("http://anythingbutrbitrary.blogspot.in/search?updated-max=2014-02-10T11:58:00-08:00&amp;max-results=1"); System.out.println(m.lookingAt()); Please help. Thanks
type: Question
upvote count: 2
has title: java regex matcher error
possible better answer: http://stackoverflow.com/a/23625174
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23625319
tagged with: regex
score: 2
has answer: http://stackoverflow.com/a/23625130
downvote count: 0
accepted answer: http://stackoverflow.com/a/23625130

http://stackoverflow.com/q/23709883
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36437104
has comment: http://stackoverflow.com/comment/36437131
tagged with: jdbc
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/36437176
has answer: http://stackoverflow.com/a/23710010
accepted answer: http://stackoverflow.com/a/23710010
type: AnsweredQuestion
has title: Is it possible to get JDBC Connection object from SQLException object?
tagged with: java
possible better answer: http://stackoverflow.com/a/23709939
has answer: http://stackoverflow.com/a/23709939
type: Question
has answer: http://stackoverflow.com/a/23714725
tagged with: jersey
has body: This is what I want to do: I'm writing a Restful application using JAX-RS. I have written a exception mapper to map SQLException to HTTP status code 500. @Provider public class SQLExceptionMapper implements ExceptionMapper&lt;SQLException&gt; { @Override public Response toResponse(SQLException exception) { Logger.error(exception); return Response.serverError().build(); } } I have lots of these situations in code: try { conn.setAutoCommit(false); /* do some stuff */ conn.commit(); } catch (SQLException ex) { conn.rollback(); /* re-throw SQLException again so exception mapper converts it to HTTP status 500 */ throw ex; } finally { conn.setAutoCommit(true); conn.close(); } Actually I don't like conn.rollback(); throw ex;. What I really want is to get JDBC Connection object from SQLException object so I can rollback connection inside exception mapper. Is this possible? Another question that is not related to this question is: I do some extensive math processing between database calls. I close connection after I finish each phase and open it at the beginning of next phase. So inside one request I do multiple open/close. Is this bad pattern?

http://stackoverflow.com/a/23742385
has comment: http://stackoverflow.com/comment/36524305
has comment: http://stackoverflow.com/comment/36516040
upvote count: 1
has body: Liferay wraps portlet content that get displayed inside a div tag having unique portlet instance id. In portlet header, Look and Feel -> Advanced Styling, it displays that portlet id for example Portlet ID: #p_p_id_73_INSTANCE_xZVK6VFSqAzJ_ This ID may be used to hash tag in anchor to move focus to that portlet section. Note: If the portlets on the page are instanceable, then removing an instance and adding instance again get new instance id. So, previous hash tag link doesn't work.
type: Answer
has comment: http://stackoverflow.com/comment/36524193
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23734231

http://stackoverflow.com/comment/36430033
score: 0
has text: The basic rule is: if you have a `Scanner` that reads from `System.in` - better not to close it at all. The problem here is that you'll be closing not just your Scanner but a stream behind it as well. You will not be able to reopen the stream.
comment on: http://stackoverflow.com/q/23705953
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36370405
comment on: http://stackoverflow.com/a/23653497
score: 0
type: Comment
has text: Can u please ask someone on stack overflow to answer possible reasons? Since I'm new to stack overflow I cannot do it.
type: AnswerComment

vector
tags question: http://stackoverflow.com/q/23759219
type: Tag
tags question: http://stackoverflow.com/q/23687065
tag name: vector
tags question: http://stackoverflow.com/q/23622400
tags question: http://stackoverflow.com/q/23627862
tags question: http://stackoverflow.com/q/23736576
tags question: http://stackoverflow.com/q/23765562

http://stackoverflow.com/a/23778449
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23698636
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I have found the solution to my problem. I created my own Validators. Which Handles two things. Ignoring the validation when clicked on the "Back" button Managing multiple series of forms with same action by providing the Wizard Index(Static) and Page Index(Set by Page). Sample Code : /** Class is used to check the mandatory string. This class can be used in flow of pages talking to the same Action class */ public class MandatoryStringFieldValidator extends FieldValidatorSupport { // Holds the Current Page Index, value picked from JSP(Front End) private String pageIndex = "0"; // Holds the Wizard Page which is set in the xxx-validation.xml private String wizardPage = "0"; // Holds a Value by which I can identify if the action is back button click //If true validation is ignored. This is also taken from the JSP(Front End) private String backClicked; public String getBackClicked() { return backClicked; } public void setBackClicked(String backClicked) { this.backClicked = backClicked; } public String getPageIndex() { return pageIndex; } public void setPageIndex(String pageIndex) { this.pageIndex = pageIndex; } public String getWizardPage() { return wizardPage; } public void setWizardPage(String wizardPage) { this.wizardPage = wizardPage; } @Override public void validate(Object object) throws ValidationException { final String fieldName = getFieldName(); final Object value = getFieldValue(fieldName, object); if(!"0".equals(pageIndex)){ Integer pageIndexValue = (Integer) getFieldValue(pageIndex, object); if (pageIndexValue != null) { backClicked = (String) getFieldValue(backClicked, object); if(StringUtils.isNotBlank(backClicked) && Boolean.valueOf(backClicked)){ pageIndexValue = pageIndexValue - 1; } pageIndex = String.valueOf(pageIndexValue); } } if(wizardPage.equals(pageIndex)) { if (!(value instanceof String)) { addFieldError(fieldName, object); return; } String strValue = (String) value; if (StringUtils.isBlank(strValue)) { addFieldError(fieldName, object); } } } } …
answers question: http://stackoverflow.com/q/23698636

http://stackoverflow.com/comment/36545728
comment on: http://stackoverflow.com/a/23763889
type: AnswerComment
has text: No problem :) please make note of @ridgerunner's comment (which I wasn't aware of previously), that `\b` is a *zero width assertion* that doesn't match any characters. That is why I said it matches "something along the lines of" (since I always wondered why it didn't actually match anything). This means you should be able to do `\b(dept)\b\.`.
score: 0
type: Comment

http://stackoverflow.com/q/23694038
type: UnansweredQuestion
has title: Permanently retrieving a HttpStatusException with status 500 using Jsoup
has body: I want to use Jsoup to access some data of a website located on a network server. Everytime I try to connect via a valid URL I'm retrieving a HttpStatusException with the following error: Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=500, URL=http://sv.thisismydomain.de/path/xyz.jsp (I've changed the URL) This is my attempt: System.out.println(Jsoup.connect(urlBase + urlLoginForm).userAgent(userAgent).timeout(10000).get().html()); I'm sure that this is the correct URL. The URL works fine if I copy it out of the StackTrace into my browser - so this can't be the problem. This is the user agent I'm using: String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/30.0.1599.101 Safari/537.36"; Do you have any ideas? This drives me crazy!
has comment: http://stackoverflow.com/comment/36411170
tagged with: java
has answer: http://stackoverflow.com/a/23702148
tagged with: web-crawler
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/36483628
score: 0
answer count: 1

http://stackoverflow.com/q/23697129
tagged with: casting
type: UnansweredQuestion
has title: casting object array to another array having class instance
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36412373
has comment: http://stackoverflow.com/comment/36419016
type: Question
has body: Class&lt;?&gt; class = ... Object[] objects = ... Is there any nice and fast way to cast array of Objects to destination type having only class instance representing destination array objects type. There is class.cast(Object ob) function but that way I have to create new array and iterate over each object
score: 0

http://stackoverflow.com/comment/36536326
type: AnswerComment
score: 0
type: Comment
has text: I do not want to use winstone, that is my question. Can I simply copy all the files into the web directory of my server without using winstone? How do I do that? I tried unzipping the war file, copy all the files, but I am getting some errors.
comment on: http://stackoverflow.com/a/23747814

http://stackoverflow.com/a/23754443
has comment: http://stackoverflow.com/comment/36522404
has comment: http://stackoverflow.com/comment/36522455
has comment: http://stackoverflow.com/comment/36522323
score: 0
has body: To begin, what makes you say that you "can see that the issue is I am trying to give a value to a position that doesn't exist"? What symptoms are you seeing that makes you believe this? On the face of it, your code looks fine, however (and this is a big however) you have omitted the most important bits of code, viz the declaration of your 2D array, and the part inside the loop body where you assign the value to the array member. If you add these then I, or somebody else, may be able to help further.
has comment: http://stackoverflow.com/comment/36522770
type: Answer
answers question: http://stackoverflow.com/q/23754325

http://stackoverflow.com/q/23648552
has comment: http://stackoverflow.com/comment/36327353
downvote count: 5
has body: I have a HashMap and a class named Plugin that contains all the variables that needs to be mapped from the map I mentioned. I just want to cast the value of the key (in the Map) according to the type of variable declared in the class for that key. Let say, --> Map entries : . . result : "SUCCESS" . . --> Variable in Plugin class private String result; Now I want to cast the value of the key "result" to the type of variable result in Plugin class. I tried using this.result = this.result.getClass().cast(map.get("result")); and this also this.result = (this.result.getClass())map.get("result"); Thanks
has title: Cast to a type dynamically according to the variable type in java
has answer: http://stackoverflow.com/a/23648636
linked to: http://stackoverflow.com/q/21244993
has answer: http://stackoverflow.com/a/23648823
favorite count: 0
linked to: http://stackoverflow.com/q/2127318
type: UnansweredQuestion
upvote count: 0
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/36327424
type: Question
answer count: 2
tagged with: casting

http://stackoverflow.com/q/23652707
has answer: http://stackoverflow.com/a/23652788
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/23652818
accepted answer: http://stackoverflow.com/a/23652912
has answer: http://stackoverflow.com/a/23652791
score: 0
has body: i am tring to convert json data from string variable like this example : String in = "{'employees': [{'firstName':'John' , 'lastName':'Doe' }," + "{ 'firstName' : 'Anna' , 'lastName' :'Smith' }," + "{ 'firstName' : 'Peter' , 'lastName' : 'Jones' }]}"; try { String country = ""; JSONArray Array = new JSONArray(in); for (int i = 0; i &lt; Array.length(); i++) { JSONObject sys = Array.getJSONObject(i); country += " " + sys.getString("firstName"); } Toast.makeText(this, country, Toast.LENGTH_LONG).show(); } catch (JSONException e) { // TODO Auto-generated catch block Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); }; when i try this code i get this error : Error parsing data org.json.JSONException: Value 0 of type java.lang.Integer cannot be converted to JSONObject
has title: how to convert json data from string variable to data to display
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/23652862
has answer: http://stackoverflow.com/a/23652912
possible better answer: http://stackoverflow.com/a/23652788
type: AnsweredQuestion

http://stackoverflow.com/q/23706294
has body: After searching Google for more than 3 hours, I'm giving up on this. I have this web.xml: contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation ar.com.dera.simor.config *.jsp <trim-directive-whitespaces>true</trim-directive-whitespaces> 404 /not_found OK, I did it work just with the servlet, and Spring Security. But also, I want to configure (in Java) the jsp-config and the error-page. How can I do this? This is my WebInitializer class: @Configuration public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebConfig.class); rootContext.scan("ar.com.dera.simor.config"); ServletRegistration.Dynamic appServlet = servletContext.addServlet( "appServlet", new DispatcherServlet(rootContext)); appServlet.setLoadOnStartup(1); appServlet.addMapping("/"); servletContext.addListener(new ContextLoaderListener(rootContext)); servletContext.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")) .addMappingForUrlPatterns(null, false, "/*"); } @Override protected Class<?>[] getRootConfigClasses() { return new Class[] { SecurityConfig.class }; } @Override protected Class<?>[] getServletConfigClasses() { return new Class<?>[] { WebConfig.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override protected Filter[] getServletFilters() { CharacterEncodingFilter utf8Filter = new CharacterEncodingFilter(); utf8Filter.setEncoding("UTF-8"); utf8Filter.setForceEncoding(true); return new Filter[] { utf8Filter }; } }
has answer: http://stackoverflow.com/a/23706390
accepted answer: http://stackoverflow.com/a/23706390
tagged with: spring-mvc
has title: Completely replace web.xml with java config (Spring MVC 4 - Tomcat 7/8)
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
downvote count: 0
tagged with: servlet-3.0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36353740
type: Comment
type: QuestionComment
score: 1
has text: I think that you need to add ActionListeners to JMenuItems, not to JMenus.
comment on: http://stackoverflow.com/q/23665889

http://stackoverflow.com/a/23799849
has body: Good morning, I suggest to use groups discrimination in test annotation. For example you cans see this thread: Is it possible to put a condition to TestNG to run the test if that is member of two groups? thanks for your attention.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23700805

http://stackoverflow.com/q/23752171
has comment: http://stackoverflow.com/comment/36546760
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 4
tagged with: ocr
has comment: http://stackoverflow.com/comment/36527342
answer count: 0
has body: I am trying to build an app in Android using Tesseract for character recognition. The app detects the words correctly but does not detect any of the punctuation marks. For example, if I take a picture of a the sentence "The , Little Boy ", the output I get is " The Little Boy " (the "" are not part of the input nor the output). How can I make Tesseract see the punctuation marks?
tagged with: java
type: Question
tagged with: tesseract
has title: Why doesn't Tesseract detect punctuation in English?
score: 4
has comment: http://stackoverflow.com/comment/36566715
downvote count: 0

http://stackoverflow.com/a/23720945
has comment: http://stackoverflow.com/comment/36458286
score: 1
answers question: http://stackoverflow.com/q/23720570
upvote count: 1
has comment: http://stackoverflow.com/comment/36459001
has body: When a cell is updated, the TableModel#setValueAt method is called. When this occurs for the first column, you should then load the values for the row based on the value passed to the this method
downvote count: 0
has comment: http://stackoverflow.com/comment/36458501
type: Answer

http://stackoverflow.com/comment/36385684
comment on: http://stackoverflow.com/a/23682478
score: 1
type: AnswerComment
type: Comment
has text: No problem. Please provide better examples the first time to avoid the "format", "non compilable" comments. So you will get a better and faster feedback.

http://stackoverflow.com/comment/36324778
comment on: http://stackoverflow.com/a/23650670
score: 0
type: Comment
has text: can you disable automatic prompting for file download and check: http://hdc.tamu.edu/Systems_Software/Web_Browsers/Windows_Internet_Explorer/Change_IE_Security_Settings_to_Enable_File_Downloads.php
type: AnswerComment

http://stackoverflow.com/comment/36428229
has text: If it crashes it means that you got a stacktrace. Please post it with your question, don't let us guess what could the error be.
score: 3
comment on: http://stackoverflow.com/q/23705106
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23621899
type: Question
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/23622368
tagged with: unicode
tagged with: console
linked to: http://stackoverflow.com/q/4133195
favorite count: 0
has answer: http://stackoverflow.com/a/23623242
has comment: http://stackoverflow.com/comment/36280159
type: UnansweredQuestion
has body: I was wondering if I can print out a string with Japanese characters. I stopped a mini-project that was, at first, out of my league. But as my skills and curiosity of high-level languages improved, I stumbled across my old project. But even with breaks from coding, I still wondered if it was possible. This isn't my project by any stretch (in fact, if the example given is non-applicable to programming, I'll feel stupid for the mere attempt.) public static void main(String[] args) { // TODO code application logic here //Example: System.out.println("Input English String Here... "); Scanner english = new Scanner(System.in); String English = english.next(); System.out.println("今、漢字に入ります。 "); Scanner japanese = new Scanner(System.in); String Japanese = japanese.next(); System.out.println("Did it work...? "); System.out.println(English); System.out.println(Japanese); } run: Input English String Here... Good 今、漢字に入ります。 いい Did it work...? Good ?? I expect to see いい on the last line of output.
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23621964
has title: Japanese Characters and strings read from Scanner/console

http://stackoverflow.com/comment/36480619
type: Comment
has text: What does it print? Or are you saying it doesn't print anything at all? Try with a much smaller number first - as @Absurd-Mind says it may be taking a long time.
score: 0
comment on: http://stackoverflow.com/q/23732444
type: QuestionComment

http://stackoverflow.com/comment/36535422
type: AnswerComment
score: 0
type: Comment
has text: Reason I used print is just to print to console if stuff was correct. It prints when item is selected using Enter key but not when it is clicked with mouse. itemSelect should work with both no?
comment on: http://stackoverflow.com/a/23759397

http://stackoverflow.com/q/23711664
tagged with: java
has comment: http://stackoverflow.com/comment/36442873
accepted answer: http://stackoverflow.com/a/23714193
linked to: http://stackoverflow.com/q/4386446
tagged with: image
has comment: http://stackoverflow.com/comment/36443757
type: Question
upvote count: 4
downvote count: 4
has body: I am trying to read images from external directory and for that I am using bufferedImage image=ImageIO.read(new File(imagefile)); jlabel.seticon(new imageicon(image)); and getting a drastic change in colors. I tried many other things like: bufferedImage image=ImageIO.read(new File(imagefile)); bufferedImage img=new bufferedImage(image.getWidth(),image.getHeight(),bufferedImage.TYPE_INT_RGB); and I tried: img.setData(image.getData(); jlabel.seticon(new imageicon(image)); and I tried: Iterator readers = ImageIO.getImageReadersByFormatName("JPEG"); ImageReader reader = null; while(readers.hasNext()) { reader = (ImageReader)readers.next(); if(reader.canReadRaster()) { break; } } ImageInputStream input = ImageIO.createImageInputStream(f); reader.setInput(input); Raster raster = reader.readRaster(0, null); BufferedImage bi = new BufferedImage(raster.getWidth(), raster.getHeight(), BufferedImage.TYPE_4BYTE_ABGR); bi.getRaster().setRect(raster); but result are still same https://i.sstatic.net/jNVm0.jpg Here is an example of the issue: The minimal code for viewing is: bufferedImage image=ImageIO.read(new File(imagefile)); jlabel.seticon(new imageicon(image)); lbitem.setIcon(im); and for storing File f = new File(s); long size=f.length(); FileInputStream fis1=new FileInputStream(f); FileOutputStream fos2=new FileOutputStream("src/image/"+tfpn.getText()+".jpg"); byte b[]=new byte[1000]; int r=0; long count=0; while(true) { r=fis1.read(b,0,1000); fos2.write(b,0,1000); count = count+r; if(count==size) break; System.out.println(count); } What could be causing the bad colors?
has comment: http://stackoverflow.com/comment/36442607
answer count: 1
has title: Change in color while using ImageIO.read()
linked to: http://stackoverflow.com/q/8118712
has comment: http://stackoverflow.com/comment/36443476
score: 0
has comment: http://stackoverflow.com/comment/36442389
has comment: http://stackoverflow.com/comment/36442624
linked to: http://stackoverflow.com/q/2408613
has answer: http://stackoverflow.com/a/23714193
favorite count: 0
has comment: http://stackoverflow.com/comment/36443415
has comment: http://stackoverflow.com/comment/36443661
has comment: http://stackoverflow.com/comment/36440836
has comment: http://stackoverflow.com/comment/36441388
tagged with: swing
tagged with: javax.imageio
has comment: http://stackoverflow.com/comment/36443556
has comment: http://stackoverflow.com/comment/36441567
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36442963
has comment: http://stackoverflow.com/comment/36443381

http://stackoverflow.com/a/23683702
type: Answer
answers question: http://stackoverflow.com/q/23683281
has comment: http://stackoverflow.com/comment/36409092
accepted answer of: http://stackoverflow.com/q/23683281
score: 6
has comment: http://stackoverflow.com/comment/65264563
downvote count: 1
has comment: http://stackoverflow.com/comment/36388514
has comment: http://stackoverflow.com/comment/36398536
has comment: http://stackoverflow.com/comment/36398390
has comment: http://stackoverflow.com/comment/58195258
type: AcceptedAnswer
has body: Hopefully you cannot do this. You can only store primitives in bundle. As Marcin Orlowski mentioned "storing" the whole object is achieveable through implementing Parcelable interface. By "storing" I meant storing object state. Implementing this interface helps you persisting your object state in different code sections without putting its all attributes to Bundle object over and over again. When activity goes to pause state sooner or later all objects used by your activity will be removed by garbage collector, so storing references to them would be silly.
upvote count: 7

http://stackoverflow.com/q/23632775
answer count: 1
has title: Has JavaFX a similar mechanism like SWT's setRedraw()?
type: UnansweredQuestion
tagged with: java
tagged with: javafx
tagged with: swt
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/23635563
has body: Is there an equivalent to SWT's Control.setRedraw(false) in JavaFX? I would like to disable UI paint events dispatching for a specific scene node (in SWT this can be done with Control.setRedraw(false)) modify/add "lots of" DOM nodes (using the WebView) instruct JavaFX to flush all pending paint events for that scene node Thanks!
score: 0

http://stackoverflow.com/a/31684966
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23713672
type: Answer
has body: You can update the role of a given user by creating a new UserDetails object from their existing one, then calling UserDetailsManager.updateUser() method as follows: UserDetails oldDetails = userDetailsManager.loadUserByUsername(user); UserDetails newDetails = new User(user, oldDetails.getPassword(), newRole); userDetailsManager.updateUser(newDetails);

http://stackoverflow.com/q/23760613
upvote count: 5
has comment: http://stackoverflow.com/comment/36538987
linked to: http://stackoverflow.com/q/13578322
downvote count: 0
favorite count: 0
has title: Get next word (or POS) suggestion for a given sentence. Autocomplete a sentence
type: UnansweredQuestion
tagged with: opennlp
has comment: http://stackoverflow.com/comment/36538710
has comment: http://stackoverflow.com/comment/36561554
tagged with: uima
answer count: 0
tagged with: java
tagged with: gate
type: Question
score: 5
has body: I have to implement auto-suggestion feature in my desktop based java application. The requirement is as follow: A user will give a sentence as input and i have to return the next possible Part-Of-Speech as suggestion. Eg: 1. UserInput: Mike wants to Suggestions: [read, play, have fun, study, code, .., etc] 2. UserInput: Mike have Suggestions: [to read, Naboo N-1 starfighter, horse, .., etc] It's a duplicate of this question, but this one is for Android. Can this be done by using some NLP libraries like Stanford-NLP or OpenNLP etc? Do let me know, if you require some more detail. Thanks!
tagged with: stanford-nlp

http://stackoverflow.com/q/23766423
has answer: http://stackoverflow.com/a/23766543
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/23766482
has comment: http://stackoverflow.com/comment/36546524
has comment: http://stackoverflow.com/comment/36546491
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36546456
has title: Avoid comparison from conditional statements
tagged with: java
score: -1
tagged with: servlets
answer count: 2
has comment: http://stackoverflow.com/comment/36547010
tagged with: sql
upvote count: 0
has body: Hi I'm trying to filter records on the basis of Brand,Flavor,Price,Size,Type. i am using a single form to handle this so if user filter only by brand then rest of options like price,flavor will be unchecked so i am checking if Brand or flavor or price is null.I got the solution but i have make lot of comparisons for all cases. i need a solution by which i have make less comparisons.I am using following code public List&lt;Products&gt; Filter_Items(String[] Brand, String[] Flavour,Float Price,String Size,String Type) { ResultSet rs; List&lt;Products&gt; data = null; PreparedStatement stmt; try { StringBuilder param = new StringBuilder(); if (Brand != null) { for (String str : Brand) { param.append("'").append(str).append("', "); } } StringBuilder param1 = new StringBuilder(); if (Flavour != null) { for (String str : Flavour) { param1.append("'").append(str).append("', "); } } String prm = param.toString().length() &gt; 2 ? param.toString() .substring(0, param.toString().length() - 2) : null; String prm1 = param1.toString().length() &gt; 2 ? param1.toString() .substring(0, param1.toString().length() - 2) : null; String query = "select * from products where "; if (prm != null &amp;&amp; prm1 != null) { query += "Brand in (" + prm + ") and Flavour in (" + prm1 + ")"; } else if (prm != null &amp;&amp; prm1 == null) { query += "Brand in (" + prm + ")"; } else if (prm1 != null &amp;&amp; prm == null) { query += "Flavour in (" + prm1 + ")"; } stmt = DataBaseConnection.DBConn.getConnection().prepareStatement(query); rs = stmt.executeQuery(); if (rs != null) { data = new ArrayList&lt;Products&gt;(); while (rs.next()) { Products p = new Products(); p.setTitle(rs.getString("Ttile")); p.setCategory(rs.getString("Category")); p.setSubCategory(rs.getString("SubCategory")); p.setSubCategoryTwo(rs.getString("SubCategorytwo")); p.setPrice(rs.getInt("Price")); p.setFlavour(rs.getString("Flavour")); p.setSize(rs.getString("Size")); p.setImage(rs.getString("image")); p.setBrand(rs.getSt…
tagged with: jsp
favorite count: 0

gson
tags question: http://stackoverflow.com/q/23695649
tags question: http://stackoverflow.com/q/23660334
tags question: http://stackoverflow.com/q/23770591
tags question: http://stackoverflow.com/q/23745356
tags question: http://stackoverflow.com/q/23749161
tags question: http://stackoverflow.com/q/23704415
tags question: http://stackoverflow.com/q/23710037
tags question: http://stackoverflow.com/q/23718739
tag name: gson
tags question: http://stackoverflow.com/q/23750966
tags question: http://stackoverflow.com/q/23707796
tags question: http://stackoverflow.com/q/23737297
tags question: http://stackoverflow.com/q/23620716
tags question: http://stackoverflow.com/q/23772122
tags question: http://stackoverflow.com/q/23650982
tags question: http://stackoverflow.com/q/23718183
tags question: http://stackoverflow.com/q/23685338
tags question: http://stackoverflow.com/q/23758252
type: Tag
tags question: http://stackoverflow.com/q/23752780
tags question: http://stackoverflow.com/q/23633522

http://stackoverflow.com/comment/36363481
score: 0
type: AnswerComment
type: Comment
has text: Possibly but not necessarily - the measure process won't always give you exactly the specific size requested via layout params.
comment on: http://stackoverflow.com/a/23651468

servlet-3.0
tags question: http://stackoverflow.com/q/23723299
tags question: http://stackoverflow.com/q/23706294
tag name: servlet-3.0
tags question: http://stackoverflow.com/q/23768987
tags question: http://stackoverflow.com/q/23711409
tags question: http://stackoverflow.com/q/23724716
tags question: http://stackoverflow.com/q/23737261
type: Tag

http://stackoverflow.com/q/23776573
has comment: http://stackoverflow.com/comment/36566175
has comment: http://stackoverflow.com/comment/36564884
type: Question
has comment: http://stackoverflow.com/comment/36564681
has body: I am having trouble understanding how to deal with this off by one. Because if I decrease by one before the call I get a negative, which ruins everything. Static tail is not allowed, so do I need to create a previous Node each time? public void recInsert(Object o, int index){ //No invalid inputs if(index &lt; 0){ throw new RuntimeException("Clearly out of bounds"); } if(isEmpty() &amp;&amp; index != 0){ throw new RuntimeException("Can't insert there on empty list"); } recInsertHelper(index, o, head); } private void recInsertHelper(int index, Object o, Node current){ if(current == null){ throw new RuntimeException("too big"); } if(index == 0){ current.next = new Node(o, current.next); } else { recInsertHelper(index-1, o, current.next); } } I even tried changing base case to the answer @ Recursively add a node at a certain index on Linked List acer + R, 0 = aRcer Should be Racer Updated Code: public void recInsert(Object o, int index){ //No invalid inputs if(index &lt; 0){ throw new RuntimeException("Clearly out of bounds"); } if(isEmpty() &amp;&amp; index != 0){ throw new RuntimeException("Can't insert there on empty list"); } if(!isEmpty() &amp;&amp; index == 0){ head = new Node(o, head); } else { recInsertHelper(index - 1, o, head); } } private void recInsertHelper(int index, Object o, Node current){ if(current == null){ throw new RuntimeException("too big"); } if(index == 0){ current.next = new Node(o, current.next); } else { recInsertHelper(index - 1, o, current.next); } }
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/23777583
has comment: http://stackoverflow.com/comment/36566226
linked to: http://stackoverflow.com/q/17261687
has comment: http://stackoverflow.com/comment/36565208
has comment: http://stackoverflow.com/comment/36566005
has comment: http://stackoverflow.com/comment/36564526
tagged with: head
has comment: http://stackoverflow.com/comment/36565948
answer count: 1
has comment: http://stackoverflow.com/comment/36564536
has answer: http://stackoverflow.com/a/23777583
favorite count: 0
has comment: http://stackoverflow.com/comment/36564585
has title: Off by one linked list recursive insert with index
has comment: http://stackoverflow.com/comment/36565075
downvote count: 2
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36565619
has comment: http://stackoverflow.com/comment/36565293
tagged with: java
has comment: http://stackoverflow.com/comment/36564848
has comment: http://stackoverflow.com/comment/36564807

http://stackoverflow.com/comment/36554096
has text: What is `c` in your code? It's confusing.
type: QuestionComment
comment on: http://stackoverflow.com/q/23770590
score: 0
type: Comment

http://stackoverflow.com/comment/36745255
type: QuestionComment
comment on: http://stackoverflow.com/q/23728688
has text: Is your code creating timers anywhere?
score: 0
type: Comment

http://stackoverflow.com/q/23622239
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/23622377
tagged with: apache-commons-codec
upvote count: 1
has body: I am currently developping a java program coupled with a mysql database using the Dao pattern. I have some user info to be stored in a table and I am storing a Sha1 hashed version of the original password string. I am using apache.commons.codec.digest.DigestUtils to do that. The string displayed in php-mysql is perfect, but when I am trying to display the same string in a java test program I have a completely different result. Here is my constructor for the user object : public User(int id, String name, String firstName, String email, String login, String password) { super(id, name, firstName); this.email = email; this.login = login; //Convert the password to SHA1 before storing it in the object //using Apache commons-codec-1.9 lib this.hashedPassword = DigestUtils.sha1Hex(password); } So for example when creating a User with "aff" as the password, by User user1 = new User(1, "Durand", "Jack", "jack.durand@mymail.com", "jack", "aff"); I get "0c05aa56405c447e6678b7f3127febde5c3a9238" in mysql which looks correct, and the same as the output of online sha1 hashers. But when reading the data back into an object and displaying it by a Sysout(User.getPassword()) in java I get "c14b77e8930a8bfd884c8917f2b7335501a39dde" which obviously isn't the same. Any idea of what's causing this? I have read some previous posts about a Byte[] issue, but the DigestUtils.sha1Hex(password) method is said to return a plain String. So what am I missing?
type: AnsweredQuestion
tagged with: sha1
accepted answer: http://stackoverflow.com/a/23622377
score: 1
tagged with: java
tagged with: mysql
type: Question
has title: Sha1 hashed string correctly encoded in mysql but displayed differently as a Java string
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36308736
score: 2
has text: Pixel perfect layouts are an illusion in modern GUI design. You don't control factors like fonts and font metrics, dpi and/or differences in rendering pipelines that will change the individual requirements of components. Swing has been designed to operate with layout managers, removing them can not only result in inflexible but may not longer update correctly through various API calls you are typically use to. Null layouts may seem like a good idea when you start, but as your UI becomes more complex, they require much more attention that can reduce your time on actual developing the solution
type: QuestionComment
comment on: http://stackoverflow.com/q/23642449
type: Comment

http://stackoverflow.com/a/23686550
score: 1
upvote count: 1
type: Answer
has body: You can use Redemption (I am its author) and its RDOSession.GetMessageFromMsgFile method.
answers question: http://stackoverflow.com/q/23675528
downvote count: 0

http://stackoverflow.com/a/23973250
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23766959
type: Answer
has body: It looks like this feature has been added to the new instance menu on the console as of 5/29/2014. There is now a "character_set_server" flag that can be set to either utf8 or utf8mb4. This does not allow setting the server character set to any arbitrary character set, but it does solve my problem and should suffice for most people.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23766959

http://stackoverflow.com/a/23977282
accepted answer of: http://stackoverflow.com/q/23665675
type: AcceptedAnswer
has body: The legacy code had two identical methods that were named slightly differently. I came to realize this when Rogerio noted that my recorded expectation was different from what I was testing. My JMockit usage was otherwise correct.
type: Answer
answers question: http://stackoverflow.com/q/23665675
score: 0

http://stackoverflow.com/q/23715324
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
type: Question
has title: Using an InputStream for random access
tagged with: java
tagged with: inputstream
tagged with: httprequest
has body: I have a project where I want to download separate byte arrays from one big file. At the moment, every time I do this I create a new HttpRequest and use the setHeader() method for the Range. HttpGet request = new HttpGet(url.toString()); HttpClient client = HttpClientBuilder.create().build(); request.setHeader("Range", "bytes=0-1024"); HttpResponse response = client.execute(request); response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Content-Range", "bytes 10-20/1024"); InputStream is = response.getEntity().getContent();` Ideally, I would: Start streaming from the 10th byte Read 10 bytes. Get from byte an integer n Read n bytes somewhere in the middle of the 1024 byte file all without creating a new HttpRequest every time. Because this content-range doesn't work like I expect it to work, the InputStream always starts at the beginning of the file. Also, inputstream.skip() will not work for this because I do not want to download all of the bytes.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23726259

http://stackoverflow.com/a/23706545
score: 5
has comment: http://stackoverflow.com/comment/36431192
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36431051
has comment: http://stackoverflow.com/comment/36431215
has comment: http://stackoverflow.com/comment/36431045
has comment: http://stackoverflow.com/comment/36431019
upvote count: 5
has comment: http://stackoverflow.com/comment/36432214
type: Answer
has body: The general solution would be to write a utility method that loops through the list and checks if each element is within a certain a threshold of the target value. We can do slightly better in Java 8, though, using Stream#anyMatch(): list.stream().anyMatch(d -&gt; (Math.abs(d/d1 - 1) &lt; threshold)) Note that I am using the equality test suggested here. If you're not using Java 8, I would write a simple utility method along the lines of this: public static boolean contains(Collection&lt;Double&gt; collection, double key) { for (double d : collection) { if (Math.abs(d/key - 1) &lt; threshold) return true; } return false; } Note that you might need to add a special case to both of these approaches to check if the list contains 0 (or use the abs(x - y) &lt; eps approach). That would just consist of adding || (abs(x) &lt; eps &amp;&amp; abs(y) &lt; eps) to the end of the equality conditions.
downvote count: 0
has comment: http://stackoverflow.com/comment/36431016
has comment: http://stackoverflow.com/comment/36431120
has comment: http://stackoverflow.com/comment/36432144
has comment: http://stackoverflow.com/comment/36432261
accepted answer of: http://stackoverflow.com/q/23706358
has comment: http://stackoverflow.com/comment/36431284
answers question: http://stackoverflow.com/q/23706358

http://stackoverflow.com/a/23774820
answers question: http://stackoverflow.com/q/23774631
has comment: http://stackoverflow.com/comment/36573595
has comment: http://stackoverflow.com/comment/36574513
score: 0
has body: If all you are doing is trying to find out the number of characters that exist in every string in an array, then you are doing a lot of unnecessary steps such as deleting characters. Consider using a nested for loop: public static int solve (String[] strings, char target) { int count = 0; for (String s : strings) { for (int i = 0; i &lt; s.length(); i++) { if (target == s.charAt(i)) { count++; } } } return count; }
has comment: http://stackoverflow.com/comment/36594080
type: Answer

http://stackoverflow.com/q/23686259
answer count: 1
downvote count: 0
tagged with: keytool
favorite count: 0
has answer: http://stackoverflow.com/a/23686443
has body: I have already created a keystore (server.jks in the image) having imported the relevant key-pair. keytool -importkeystore -srckeystore server.p12 -destkeystore server.jks -srcstoretype pkcs12 I need to append intermediate certificates to it using the java keytool. Using KeyStore explorer tool on windows, I can append certificates following the right click context menu, just like in the attached image. After adding the primary/intermediate certificates following the Append Certificate option, I can see it on the KeyStore explorer like a tree. ---primary intermediate certificate |---secondary intermediate certificate |---my server certificate I am very much interested in knowing how this can be done, using the 'Java KeyTool' on the (LINUX) command line. Thank you in advance.
linked to: http://stackoverflow.com/q/9299133
has comment: http://stackoverflow.com/comment/36412858
has comment: http://stackoverflow.com/comment/36410827
has comment: http://stackoverflow.com/comment/36430812
tagged with: append
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36397054
has title: Java keyTool - append primary/secondary intermediate certificates to key store
has comment: http://stackoverflow.com/comment/36429407
tagged with: java
tagged with: certificate
has comment: http://stackoverflow.com/comment/36410496
accepted answer: http://stackoverflow.com/a/23686443
type: Question
score: 5
upvote count: 5
tagged with: ssl
has comment: http://stackoverflow.com/comment/36410056

http://stackoverflow.com/comment/36364073
type: QuestionComment
comment on: http://stackoverflow.com/q/23656365
has text: You are correct, variable directory can sometimes be null. Thank you for the answer. Somehow I presumed that it cannot be null, and that problem is in parsing date when there is no tag. I feel so stupid now.
score: 0
type: Comment

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/23637417
type: Tag

http://stackoverflow.com/a/23731640
answers question: http://stackoverflow.com/q/23731574
has body: FileDialog has two constructors of interest for this problem: public FileDialog(Frame parent, String title, int mode) public FileDialog(Dialog parent, String title, int mode) If you call your constructor with a null first argument, how does the compiler know which constructor you want to call? A better way to handle this would be to declare a variable of the right type, set it to null, and use that as the first argument instead. The static type of that variable allows the compiler to figure out which constructor you want. For example, if you want the Frame constructor: Frame unusedFrame = null; FileDialog fileOutputDialog = new FileDialog(unusedFrame, "Output File", FileDialog.SAVE);
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36335432
comment on: http://stackoverflow.com/q/23655959
type: Comment
type: QuestionComment
has text: no problem with that .. this is because at compile time eclipse does not know the type of class object this raw Object holding. It shall run without any issues
score: 0

http://stackoverflow.com/comment/36302681
has text: I've updated the question. Just due to some reasons I can't post the code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23632587

http://stackoverflow.com/comment/36298081
comment on: http://stackoverflow.com/a/23637627
type: Comment
has text: yes, I understand (though my phrasing was absolutely wrong). Thing is ... where do I put the `onShake` method ? That is the part that I'm WILDLY confused about. Should `mShakeListener.setOnShakeListener(new OnShakeListener() {` be in my `onCreate` method ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23708070
type: Answer
has body: try changing android:name=".Menu" to android:name="{package name}.Menu"
answers question: http://stackoverflow.com/q/23708026
score: 0
has comment: http://stackoverflow.com/comment/36433710
has comment: http://stackoverflow.com/comment/36433822
has comment: http://stackoverflow.com/comment/36433734

http://stackoverflow.com/q/23735778
tagged with: gps
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23735862
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23735862
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has body: Null Pointer Exception in fragment. i tried to get coordinates and put it to TextView. The GPS works correctly. But cant set text. What problem can be here? May be i must use adapter? What can i do? tv.setText(g); // error (is null) public class TwoFragment extends Fragment { LocationService ls; double s; TextView tv; String g; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Creating view correspoding to the fragment View v = inflater.inflate(R.layout.two_fragment, container, false); // Updating the action bar title getActivity().getActionBar(); Log.w("MY_TAG", "One fragment"); return v; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ls = new LocationService(getActivity()); s = ls.getLocation().getLatitude(); tv = (TextView) getView().findViewById(R.id.tv_two_fragment); g = Double.toString(s); tv.setText(g); } } ErrorLog 05-19 10:36:01.052 2418-2418/com.example.projectx E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.fotoman.prox.app.MainFragments.TwoFragment.onCreate(TwoFragment.java:48) at android.app.Fragment.performCreate(Fragment.java:1673) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:854) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) at android.app.BackStackRecord.run(BackStackRecord.java:682) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435) at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.Zygo…
favorite count: 0
has title: Null Pointer Exception in fragment
tagged with: android

http://stackoverflow.com/q/23627343
tagged with: java
has comment: http://stackoverflow.com/comment/36278075
has comment: http://stackoverflow.com/comment/36278066
has body: I want to write a code like this public int recursiveMethod() { for (int i = 0; i &lt; 10; i++) { if (someBool) { return recursiveMethod(); } else { return -1; } } } but this gives compile error missing return statement. Is there other way I can achieve this. UPDATE : actual code public static File searchFile(File currentFile) { File[] results = null; if (currentFile.isDirectory()) { for (File file : currentFile.listFiles()) { if (file.isDirectory()) { return searchFile(file); } else { results = file.getParentFile().listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".sh"); } }); if (results.length &gt; 0) { return results[0]; } else { return null; } } } } else { results = currentFile.getParentFile().listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".sh"); } }); if (results.length &gt; 0) { return results[0]; } else { return null; } } }
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36278172
has comment: http://stackoverflow.com/comment/36278823
has comment: http://stackoverflow.com/comment/36278295
has comment: http://stackoverflow.com/comment/36278161
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36278719
has comment: http://stackoverflow.com/comment/36278495
has answer: http://stackoverflow.com/a/23627566
accepted answer: http://stackoverflow.com/a/23627929
has comment: http://stackoverflow.com/comment/36278235
has comment: http://stackoverflow.com/comment/36278751
tagged with: return
has answer: http://stackoverflow.com/a/23627929
type: AnsweredQuestion
tagged with: recursion
has title: recursive method inside loop
possible better answer: http://stackoverflow.com/a/23627566

http://stackoverflow.com/a/23632537
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23632094
has body: We use such implementation when we have a set of method that is typical for a set of objects. So that we focus not on a particular choice of representation but on the shared operations and properties. For example, stack uses this pattern, the operations typically available on a stack are the following: push, remove, determine whether the stack is empty, etc.. and instead of Dog it uses Object; so you can stack any object. Now you can add object other than Dog, and they will share the same methods.

http://stackoverflow.com/comment/36288584
type: Comment
type: QuestionComment
has text: but I included generated SQL query in the question
score: 0
comment on: http://stackoverflow.com/q/23629760

http://stackoverflow.com/comment/36358122
has text: hmm well, I edited the code as you can see and seems like I didn't do everything. I'll take a look at your code again.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23667743

http://stackoverflow.com/a/23622881
has comment: http://stackoverflow.com/comment/36285784
type: Answer
accepted answer of: http://stackoverflow.com/q/23622686
answers question: http://stackoverflow.com/q/23622686
has comment: http://stackoverflow.com/comment/36312215
score: 0
type: AcceptedAnswer
has body: Based on the JSON you pasted in, I agree that the generated classes don't look correct. For example, morn does not seem to appear in the JSON at all. Did you paste in the entire JSON content that was used to generate the classes? What are you using to serialize/deserialize the JSON? Jackson is a common framework with which to do that. You would need to define mappers from the beans that store the deserialized JSON to the POJO beans. I've not used it myself (I use Jackson and create the JSON and POJO beans myself), but based on the json gen doc, it appears that it's intended to generate the JSON-bean side of things. So you would still need to (at least potentially) define your POJO beans (unless they happened to map 100%, which seems unlikely for a variety of reasons, from different JSON property names versus POJO field names, etc.).

http://stackoverflow.com/q/23696157
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36410969
has title: JMock - expecting oneOf() one method while allowing() all other methods
has comment: http://stackoverflow.com/comment/36410781
linked to: http://stackoverflow.com/q/5370438
tagged with: jmock
score: 0
has comment: http://stackoverflow.com/comment/36411006
duplicate of: http://stackoverflow.com/q/5370438
has body: In jMock, is it possible to expect oneOf() some method while allowing() all other methods. When I try to do this, the allowing() seems to override the oneOf() expectation and my test passes whether or not the method was called. I only want the test to pass if the oneOf() method was called. I don't want to have to explicitly say allowing() on each method that I don't want to be called because that will clutter up the test. UPDATE: I tried to write a little example to capture the essence of the problem and it worked, so it looks like I must have done something else wrong. public class ExampleTest { @Rule public JUnitRuleMockery context = new JUnitRuleMockery(); interface Callback { void method1(); void method2(); } @Test public void x() { final Callback callback = context.mock(Callback.class); context.checking(new Expectations(){{ oneOf(callback).method1(); allowing(callback); }}); // callback.method1(); callback.method2(); } }

http://stackoverflow.com/q/23709733
type: AnsweredQuestion
tagged with: keep-alive
has body: I am using netty for developing my server. I am also implementing the Idle state handling in netty. I got it working but an issue I recently found out. I can't access the channel context attributes inside the userEventTriggered method. here is my code and can anybody tell me why it is not possible. I am setting it like public static final AttributeKey&lt;Agent&gt; CLIENT_MAPPING = AttributeKey.valueOf("clientMapping"); ... ctx.attr(CLIENT_MAPPING).set(agent); and inside handler, I am getting the value like (this is working perfectly) Agent agent = ctx.attr(CLIENT_MAPPING).get(); But inside userEventTriggered it is returning null. (I am sure that it is set before this function is being called.) public class Server { ... public void run() throws Exception { ... ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup). channel(NioServerSocketChannel.class). childHandler(new SslServerInitializer()); ... } } class SslServerInitializer extends ChannelInitializer&lt;SocketChannel&gt; { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); .... pipeline.addLast("idleStateHandler", new IdleStateHandler(0, 0, Integer.parseInt(Main.configurations.get("netty.idleTimeKeepAlive.ms")))); pipeline.addLast("idleTimeHandler", new ShelloidIdleTimeHandler()); } } class ShelloidIdleTimeHandler extends ChannelDuplexHandler { @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { try { // This I am getting null, but I confirmed that I set the attribute from my handler and is accessible inside handler. Agent agt = ctx.attr(WebSocketSslServerHandler.CLIENT_MAPPING).get(); ctx.channel().writeAndFlush(new TextWebSocketFrame("{\"type\":\"PING\", \"userId\": \"" + agt.getUserId() + "\"}")); } catch (Exception ex) { ctx.disconnect(); ex.printStackTrace(); } } } }
accepted answer: http://stackoverflow.com/a/23714515
type: Question
tagged with: java
score: 0
answer count: 1
has title: ChannelHandlerContext.attr is not accessible from inside userEventTriggered
has answer: http://stackoverflow.com/a/23714515
tagged with: netty

http://stackoverflow.com/a/23640111
has comment: http://stackoverflow.com/comment/36345160
score: 1
has comment: http://stackoverflow.com/comment/36304620
upvote count: 1
has comment: http://stackoverflow.com/comment/36345217
accepted answer of: http://stackoverflow.com/q/23639802
has body: As pointed out by @Hunter-mcmillen: you are confused about java operators. public void mouseMoved(MouseEvent e) { double distance1 = Math.pow((e.getX() - x1),2); double distance2 = Math.pow((e.getY() - y1),2); // Math.pow(a,b) == a^b (in a calculator) setdistance(Math.sqrt(distance1 + distance2)); System.out.println(getdistance()); } I really recommend that you read more carefully the Java operators before assuming how they work on the language. EDIT 2: I recommend also that you create a JPanel or JLabel for this picture, and then load such picture inside this new Jpanel or Label or other component. public class Paint extends JPanel implements ActionListener { Mouse swim = new Mouse(); Timer tm = new Timer(7, this); public void paintComponent(Graphics g) { // Try this: ImageIcon swimminghold = new ImageIcon(render.class.getResource("resources/Swimmingpoolns.png")); swimmingpool = swimminghold.getImage(); JLabel label = new JLabel(); label.setIcon(swimminghold); label.addMouseMotionListener(swim); addMouseMotionListener(swim); label.addMouseMotionListener(swim); addMouseMotionListener(swim); //Do something /* ...*/ }
has comment: http://stackoverflow.com/comment/36345249
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36345336
has comment: http://stackoverflow.com/comment/36303379
answers question: http://stackoverflow.com/q/23639802
type: Answer

http://stackoverflow.com/comment/36282896
comment on: http://stackoverflow.com/q/23629031
score: 0
type: Comment
has text: Shouldn't you use jdoubleArray instead of jintArray?
type: QuestionComment

http://stackoverflow.com/a/23758716
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23758611
has body: If you don't require uniform distribution, you could start with 100,000,000 and add an increment randomly chosen between [1 and 89,999]. Repeat 10,000 times. This will give you a non-repeating sequence of numbers that are somewhat randomly generated. But they will not be uniformly distributed (it is very unlikely to get numbers in the high ranges, like 999,xxx,xxx), and they will be strictly ascending, so you have a good chance to guess the next one if you know the previous one ("good" = 1/89999).
type: Answer

http://stackoverflow.com/comment/36547534
score: 0
type: Comment
type: QuestionComment
has text: That the whole other story... Don't you think you should include that kind of information into your question. Anyway you can write conditional validation based on that index in xml or in `validate` method in action class.
comment on: http://stackoverflow.com/q/23698636

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/23629801
tags question: http://stackoverflow.com/q/23704915
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/39929217
score: 0
answers question: http://stackoverflow.com/q/23651788
type: Answer
has comment: http://stackoverflow.com/comment/67176832
has body: I had the same things you showed up, but Drew is right that's not the error, in my case was the my connection could not be established because in the beginning I had no password to access my connection, but then I placed a password and I forgot to place it on the config as well. I did it in configuration files, double clicking the one named glassfish-resources.xml, seek the property with the name Password and the password goes there (value="It should be empty for you").

http://stackoverflow.com/comment/36315518
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23646526
has text: `public void paintComponent(Graphics g) { if(errors == 1)..` should be `public void paintComponent(Graphics g) { super.paintComponent(g); if(errors == 1)..`
score: 0

http://stackoverflow.com/a/23771297
type: AcceptedAnswer
type: Answer
has body: In order to use Wicket to create HTML emails, we need to fake the request/response cycle. I wrote this convenient method that renders a bookmarkable page (pageclass + pageparameters) to a string: http://www.danwalmsley.com/render_a_wicket_page_to_a_string_for_html_email protected String renderPage(Class extends Page> pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new WebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.request(); log.warn("Response after request: "+webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23764791
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23764791

http://stackoverflow.com/q/23766959
favorite count: 0
accepted answer: http://stackoverflow.com/a/23973250
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: mysql
type: Question
has title: Set Google Cloud SQL character-set-server
has comment: http://stackoverflow.com/comment/36635417
has answer: http://stackoverflow.com/a/23973250
has comment: http://stackoverflow.com/comment/36676313
has body: I'd like to use Google Cloud SQL for my app, but I require that utf8mb4 be set as the server character set in order to correctly process 4 byte utf8 characters (emoji). It is not enough to simply set the table or database character set because the driver connection (mysql-connector-java) is negotiated based on the server character set. Is it possible to set the server character set with Cloud SQL? If not, is there another workaround that could allow me to force the driver connection to utf8mb4? Here is a copy of my connection string: jdbc:mysql://&lt;host&gt;/&lt;db_name&gt;?useUnicode=true&amp;characterEncoding=utf-8 Note that setting the characterEncoding variable in the driver connection string to utf-8mb4 or utf8mb4 is illegal. My best information say that it has to be set to utf-8 and then it will upgrade to utf8mb4 if the server is using that character set.
answer count: 1
downvote count: 0
tagged with: google-cloud-sql

http://stackoverflow.com/a/23766495
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36546118
type: Answer
has comment: http://stackoverflow.com/comment/36564698
downvote count: 0
has comment: http://stackoverflow.com/comment/36574374
score: 3
accepted answer of: http://stackoverflow.com/q/23766462
answers question: http://stackoverflow.com/q/23766462
upvote count: 3
has body: To achieve that, you can use outer software, such as SQLDeveloper or SQLAdministrator. IntelliJ in Ultimate edition also supports exporting table data. UPDATE: If you want to export it using only sql you can use sqlite3 db .dump See also this info if you want to export only selected tables.

http://stackoverflow.com/comment/36617409
type: AnswerComment
comment on: http://stackoverflow.com/a/23744669
score: 0
type: Comment
has text: @AndreaF See my update added to the end of my answer.

http://stackoverflow.com/a/23735928
answers question: http://stackoverflow.com/q/23735872
score: 0
type: Answer
has body: You shouldn't compare Strings by == operator, use equals method instead.

http://stackoverflow.com/q/23704548
tagged with: java
has comment: http://stackoverflow.com/comment/36427406
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23733593
has title: restTemplate java.lang.IllegalArgumentException: "None" does not contain '/'
has comment: http://stackoverflow.com/comment/36429167
type: UnansweredQuestion
has body: Ok first of all code (its mega simple): @Controller @RequestMapping("/") public class HelloController { private final static Logger logger = Logger.getLogger(HelloController.class); @RequestMapping(method = RequestMethod.GET) public String printWelcome(ModelMap model) { logger.info("ELO ELO"); model.addAttribute("message", "Hello world!"); RestTemplate restTemplate = new RestTemplate(); String url = "http://192.168.0.200:8000/GPIO/11/function/in"; //String url = "http://192.168.0.200:8000/GPIO/11/function"; //restTemplate.getForObject(url, String.class); String test = ""; restTemplate.postForObject(url, null, String.class); logger.info(test); return "hello"; } Next example that I'm not a crazy man here is response from postman (chrome): And at the end full error log: type Exception report message Request processing failed; nested exception is java.lang.IllegalArgumentException: "None" does not contain '/' description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: "None" does not contain '/' org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:927) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811) javax.servlet.http.HttpServlet.service(HttpServlet.java:618) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.IllegalArgumentException: "None" does not contain '/' org.springframework.http.MediaType.parseMediaType(MediaType.java:697) org.springframework.http.HttpHeaders.getContentType(HttpHeaders.java:305) org.springframework.web.client.HttpMessageConverterExtractor.getContentType(HttpMessageConverterExtractor.java:113) org.springframework.w…
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23728776
has comment: http://stackoverflow.com/comment/36427826
tagged with: resttemplate
type: Question
has comment: http://stackoverflow.com/comment/36427858

http://stackoverflow.com/comment/36300366
has text: @Humdinger - yes, I've restarted the server and echoed $JAVA_HOME. It echoed as desired, but it still doesn't like it.
comment on: http://stackoverflow.com/q/23619545
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36294853
comment on: http://stackoverflow.com/q/23635720
has text: @ IsabelHM , yeaaaaaaaahhhhhhhhhhhhhhh !!!!!!!!!!!!!!! that works .... thanks browwwwww.....
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36306882
type: Comment
has text: Please post the output of 'java -version'.
type: QuestionComment
comment on: http://stackoverflow.com/q/23624558
score: 0

http://stackoverflow.com/comment/36261539
score: 0
type: Comment
has text: Well thanks but this approach has few drawbacks: 1) If I have few ctors I will need to manage it somehow; 2) If I use \@PostConstruct I will not see clear definitions of my arrays and may forget to add some new bean in that array. Any other suggestions?
comment on: http://stackoverflow.com/a/23618568
type: AnswerComment

http://stackoverflow.com/comment/36338619
has text: @ Kevin Workman: Sorry if it wasn't clear. My question is just how to make the search results appear in the same page where the user types the string to search. Any clue how it should be done ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23658162
type: Comment

http://stackoverflow.com/q/23642787
type: AnsweredQuestion
has title: Find count of a repeated value in a sorted array
tagged with: java
has answer: http://stackoverflow.com/a/23642874
has comment: http://stackoverflow.com/comment/36337166
type: Question
has comment: http://stackoverflow.com/comment/36345109
tagged with: algorithm
has body: I am just wondering if this code can be further improved. This is a simple class which takes in a sorted array and a value as parameters and tries to find the number of times this value occurs in the array. As far as I know the complexity of the code is O(log n + k) [assuming k is the subset of n]. Can this code be improved furter? public class SearchSortedArray { // Find number count in an array. Total Complexity = O(log n + k) [assuming k is the subset of n] public static int findNumberCountInAnArray(List&lt;Integer&gt; array, Integer findValue) { //Search Index Integer searchIndex = findIndex(array, findValue, 0); //Find Count return countArray(array, searchIndex); } // Search Index. Complexity = O(log n) private static Integer findIndex(List&lt;Integer&gt; array, Integer findValue, int offset) { if(array.size() == 0) { return null; } if(findValue &lt; array.get(array.size()/2)) { return findIndex(array.subList(0, array.size()/2), findValue, 0); } else if(findValue &gt; array.get(array.size()/2)) { offset = offset + array.size()/2; return findIndex(array.subList(array.size()/2, array.size()), findValue, offset); } return array.size()/2+offset; } // Find count. Complexity = O(k) [assuming k is the subset of n] private static int countArray(List&lt;Integer&gt; array, Integer searchIndex) { if(null == searchIndex) { return 0; } Integer searchValue = array.get(searchIndex); Integer searchIndexStore = searchIndex; int count = 0; while(searchIndex &lt; array.size() &amp;&amp; searchValue == array.get(searchIndex)) { count++; searchIndex++; } searchIndex = searchIndexStore; while(searchIndex &gt; 0 &amp;&amp; searchValue == array.get(searchIndex-1)) { count++; searchIndex--; } return count; } } Here is the main class // Test main class. public class TestMain { public static void main(String[] args) { Integer[] sample1 = {1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 5, 5}; ArrayList&lt;Integer&gt; arraySample1 = new ArrayList&lt;Integer&gt;(Arrays.asList(sample1)); // Find the number o…
tagged with: arrays
linked to: http://stackoverflow.com/q/22124483
has comment: http://stackoverflow.com/comment/36308852
tagged with: binary-search
score: 0
answer count: 1
tagged with: big-o
has comment: http://stackoverflow.com/comment/36312824
accepted answer: http://stackoverflow.com/a/23642874

http://stackoverflow.com/q/23747856
type: UnansweredQuestion
has title: Trying to update service access policies in CloudSearch with the java sdk
tagged with: amazon-cloudsearch
has answer: http://stackoverflow.com/a/23748139
tagged with: java
type: Question
score: 0
answer count: 1
has body: I'm trying to update access policies for an Amazon CloudSearch domain in java code, and it appears to be possible but the API for it seems to be lacking. My code so far is: cloudSearchClient.updateServiceAccessPolicies( new UpdateServiceAccessPoliciesRequest() .withDomainName("test-eme1") .withAccessPolicies("???")); The UpdateServiceAccessPoliciesRequest only takes in two parameters: The CloudSearch domain (a String) and the Access Policies (another String). The online documentation and javadoc for 'withAccessPolicy' both have this to say: "The access rules you want to configure. These rules replace existing rules." The mere fact that you're supposed to define multiple access rules here with a single String means that the UpdateServiceAccessPoliciesRequest class is a poly designed container for an http request, and I can live with that, but does anyone know what an "Access Policies" update String looks like in this context? I'm using the AWS Java SDK version 1.7.9, which I'm almost positive uses the CloudSearch REST API version 2013-01-01.

http://stackoverflow.com/comment/36390478
score: 0
type: QuestionComment
type: Comment
has text: @LuiggiMendoza why is timings different now? these kind of things makes me sometimes hate programming :(
comment on: http://stackoverflow.com/q/23685054

http://stackoverflow.com/a/23689544
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23689451
has body: Your array currently store [0] -&gt; 90000,5,4 [1] -&gt; 90000 [2] -&gt; 5 That is why you are seeing as output [90000,5,4,90000,5]. It is because group(0) represents entire match so it returns 90000,5,4. What you need is match from groups 1, 2 and 3. (\\d+),(\\d+),(\\d+) 1 2 3 So change rtn[i] = matcher.group(i); to rtn[i] = matcher.group(i+1);
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23689451

http://stackoverflow.com/q/23624188
type: Question
score: -2
has title: Match two strings on the basis of words only neglecting some special characters
has comment: http://stackoverflow.com/comment/36272078
has comment: http://stackoverflow.com/comment/36272192
upvote count: 0
answer count: 1
has body: I am trying to match the two strings which contains different special characters like (-,:;) but the words are same. Eg. String 1 --> Hi, How are you? String 2 --> Hi- How are you. in the above example strings the words are same but only difference is in (,?-.). So I want to know how I match these strings so that i get the answer "Strings are equal".
tagged with: string
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36272216
tagged with: regex
has answer: http://stackoverflow.com/a/23624335
tagged with: java
has comment: http://stackoverflow.com/comment/36272204
has comment: http://stackoverflow.com/comment/36272073

http://stackoverflow.com/q/23643146
downvote count: 0
has comment: http://stackoverflow.com/comment/36354721
has body: I have a problem with the JFileChooser class. I am using the following class (that I did write) to load several files one after the other, and it usually works for 2 or 3 files (sometimes 1, sometimes 6, looks random even though it must not be) and at a point, it freezes at showOpenDialog(null), no exception is thrown, nothing returned either. I really don't know where it's coming from. Here's my class: public class CustomFileChooser extends JFileChooser { public File chooseFile(String windowTitle, String description, String extension, boolean mustExist) { setDialogTitle(windowTitle); resetChoosableFileFilters(); setAcceptAllFileFilterUsed(false); addChoosableFileFilter(new CustomFileFilter(description, new String[] {extension})); setSelectedFile(new File("")); if (mustExist) { setApproveButtonText("Open"); } else { setApproveButtonText("Save"); } File file = null; while (file == null) { if (showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { file = getSelectedFile(); if (mustExist) { if (!file.canRead()) { file = null; JOptionPane.showMessageDialog(null, "Cannot read from the specified file!", "Error while opening the file", JOptionPane.ERROR_MESSAGE); } } else { if (!file.getName().toLowerCase().endsWith(extension.toLowerCase())) { file = new File(file.getAbsolutePath().concat(extension)); } if (file.exists()) { if (file.canWrite()) { if (JOptionPane.showConfirmDialog(null, "Do you really want to overwrite this file?", "Erasing file", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) { file = null; } } else { file = null; JOptionPane.showMessageDialog(null, "Cannot write to the specified file!", "Error while opening the file", JOptionPane.ERROR_MESSAGE); } } } } else { return null; } } return file; } private static final long serialVersionUID = 1L; } EDIT: I tryed running my program on windows and everything works fine. Do you have knowledge of a platforme related problem concerning this class/method ?
tagged with: java
tagged with: jfilechooser
type: Question
has answer: http://stackoverflow.com/a/61100123
has title: JFileChooser.showOpenDialog() freezing my program
upvote count: 3
tagged with: file-io
linked to: http://stackoverflow.com/q/18642158
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36389208
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36354673
score: 3
has comment: http://stackoverflow.com/comment/94342684

http://stackoverflow.com/comment/36512477
score: 0
type: Comment
has text: I don't see any info there that will tell Gson that it needs to create BGRectangles. I'm guessing it gets lost looking for somewhere to put width and height.
type: QuestionComment
comment on: http://stackoverflow.com/q/23749161

http://stackoverflow.com/a/23627446
score: 3
answers question: http://stackoverflow.com/q/23627341
has body: You must add HOME to your classpath: On Windows: java -classpath .;HOME lol On everything else: java -classpath .:HOME lol
accepted answer of: http://stackoverflow.com/q/23627341
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36372517
type: QuestionComment
comment on: http://stackoverflow.com/q/23675798
score: 0
has text: We won't be able to help you without taking a look over a mapping. Please post `User` class.
type: Comment

http://stackoverflow.com/comment/36264839
comment on: http://stackoverflow.com/a/23616087
has text: I wrote another class including what @harsh is saying: cod, message, city,cnt and list. But I am getting a new error: Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of weather.data.list1 out of START_ARRAY token
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23720596
has title: Getting values passed to new Activity
type: Question
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/36457637
score: 0
tagged with: java
tagged with: android-intent
answer count: 1
has body: I am following the android programming tutorial here: http://developer.android.com/training/basics/firstapp/starting-activity.html It details how to start a new activity and send some data to it. I have these activities now: SplashActivity, LoginActivity, RegisterActivity, and MainActivity. SplashActivity does a quick preference read to see if you are logged in. If you are, it passes a user ID to MainActivity thus: Intent intent = new Intent(this, MainActivity.class); intent.putExtra(EXTRA_USERID, userID); Where userID is a user ID number as String. Both Login and Register Activity does its thing, which returns a valid user ID from network. They pass it to main activity using the same code snippet above. This is defined in all three activity classes: public final static String EXTRA_USERID= "com.example.myfirstapp.USERID";. Following the tutorial, I have this code in the onCreate method of MainActivity: Intent intent = getIntent(); String userID = intent.getStringExtra([LoginActivity].EXTRA_USERID); Notice the square bracketed peice of code [LoginActivity]. I don't know what to put here. I don't know which activity starts the MainActivity. Putting LoginActivity seems to only work when the login activity starts the main activity. When people register or the user ID is read from preferences in SplashActivity, the return value is an empty string. What is the method for determining which activity started MainActivity? Or is there a way to simply get the value passed to the activity without specifying from which Activity it is created? Any help would be appreciated.
has answer: http://stackoverflow.com/a/23720666
type: UnansweredQuestion

http://stackoverflow.com/q/23717406
upvote count: 15
downvote count: 0
tagged with: java
has title: Groovy - Main method placement
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/23717529
score: 15
tagged with: class
tagged with: groovy
answer count: 1
favorite count: 0
has body: Here is my code: class cat {} class dog { static void main(String[] args) {} } When compiled groovy says I do not have a main method. But when I get rid of the cat class: class dog { static void main(String[] args) {} } Its valid. I thought, as long as I had the main method in any class the code was valid, but I am wrong. Can someone explain why I can not have more than one class when the main method resides in one of the classes?
type: UnansweredQuestion

http://stackoverflow.com/q/23616037
type: Question
answer count: 2
upvote count: 0
has body: I'm trying to get an image to use in a JButton, with the code: ImageIcon imageIcon = new ImageIcon(MineSweeper.class.getResource("C:\\Users\\___\\Documents\\GitHub\\____\\myImage.png")); buttons[x][y].setIcon(imageIcon); I know the file exists there, however every time I run it I get the error, Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(ImageIcon.java:205) Which after looking around says that is the response for not being able to find the file, I'm confused as to what I'm doing wrong here. I get this error if I try to use absolute or relative paths, can someone point out what's wrong? I must be over looking something really simple here. EDIT: As Alan suggested to move the file, I put it into the src folder and it worked fine. Apparently having it else where won't work.
score: -2
tagged with: user-interface
has answer: http://stackoverflow.com/a/23616132
tagged with: nullpointerexception
tagged with: imageicon
has title: Unable to get resources using getResource()
favorite count: 0
accepted answer: http://stackoverflow.com/a/23616132
downvote count: 2
possible better answer: http://stackoverflow.com/a/23616218
tagged with: swing
has answer: http://stackoverflow.com/a/23616218
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/270197
tagged with: java
duplicate of: http://stackoverflow.com/q/270197

http://stackoverflow.com/a/23711556
upvote count: 3
has body: The Problem is that you'er blocking the UI-Thread with your sleep method. Try using a Handler (link to doc) and its method postDelayed (here).
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23711379
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23711379
type: Answer
score: 3

http://stackoverflow.com/comment/36259180
comment on: http://stackoverflow.com/a/23616907
score: 0
type: Comment
has text: Sorry, Content-type=image/jpeg not text/jpeg.....and one more thing if it's not working take ServletOutStream object and write the response bytes on this stream...
type: AnswerComment

http://stackoverflow.com/comment/36266205
type: Comment
comment on: http://stackoverflow.com/q/23620281
has text: Yess, did it also manually. But no success.
type: QuestionComment
score: 0

http://stackoverflow.com/q/23718679
type: AnsweredQuestion
tagged with: java
has title: Why can't I define these two constructors in Java for a single class?
score: 4
has answer: http://stackoverflow.com/a/23718691
has body: I am defining a constructor for a class, and I have these two definitions: MyClass(Set&lt;ClassA&gt; setOfA) { ... } MyClass(Set&lt;ClassB&gt; setOfB) { ... } I get the following error: MyClass(java.util.Set&lt;ClassA&gt;) is already defined in MyClass MyClass(Set&lt;ClassB&gt; setOfB) If I specifically made one of them a HashSet instead of a Set, the code compiles. Why?
has comment: http://stackoverflow.com/comment/36454307
accepted answer: http://stackoverflow.com/a/23718699
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36454180
has comment: http://stackoverflow.com/comment/36454018
has comment: http://stackoverflow.com/comment/36454413
has comment: http://stackoverflow.com/comment/36454265
downvote count: 0
possible better answer: http://stackoverflow.com/a/23718691
favorite count: 0
answer count: 3
tagged with: type-erasure
has answer: http://stackoverflow.com/a/23718700
has comment: http://stackoverflow.com/comment/36454426
tagged with: constructor
has answer: http://stackoverflow.com/a/23718699
has comment: http://stackoverflow.com/comment/36454043
has comment: http://stackoverflow.com/comment/36454112
has comment: http://stackoverflow.com/comment/36454244
has comment: http://stackoverflow.com/comment/36453971
has comment: http://stackoverflow.com/comment/36454119

http://stackoverflow.com/comment/36456973
has text: @guido that's it! Thanks guido, if you post an answer i will gladly accept :-)))
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23720241
type: Comment

http://stackoverflow.com/q/23657327
has answer: http://stackoverflow.com/a/23657441
downvote count: 0
score: 1
has title: Converting a number to binary java code
favorite count: 0
has body: I am writing a code to convert a number to binary representation.Here's my code.It doesn't give the correct answer but I can't figure out where I am making the mistake.If someone could point out where my mistake and how to correct it I would be grateful. public class ConvertBinary{ public static String convertBinary(int n){ String s=""; while(n&gt;0){ s+=(n%2); n=n/2; } int len=s.length(); String[] binary=s.split(""); String[] binaryCopy=new String[s.length()]; for(int i=0;i&lt;len;i++){ binaryCopy[i]=binary[len-i-1]; s+=binaryCopy[i]; } return s; } public static void main (String args[]){ System.out.println(convertBinary(19)); } }
possible better answer: http://stackoverflow.com/a/23657559
accepted answer: http://stackoverflow.com/a/23657716
linked to: http://stackoverflow.com/q/145509
tagged with: binary
has answer: http://stackoverflow.com/a/23657559
linked to: http://stackoverflow.com/q/10233210
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36336730
has comment: http://stackoverflow.com/comment/36336850
tagged with: java
has answer: http://stackoverflow.com/a/23657634
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23657716

http://stackoverflow.com/comment/36467390
comment on: http://stackoverflow.com/q/23724609
score: 0
type: Comment
type: QuestionComment
has text: Hi Aarowaim, thank you for your kind advice, I really appreciate it. And you're right I don't know too much. However it's not a homework assignment, it's actually a development project for my work placement. I want to show what I can do but it's not looking good. I've got A LOT to learn. But thank you :))

http://stackoverflow.com/comment/36405725
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23692194
has text: Is JAVA_HOME environment variable for JRE or JDK? because I have it set to:C:\Program Files\Java\jre7 I have the PATH variable sett to JDK path.

http://stackoverflow.com/q/23698027
tagged with: jakarta-ee
answer count: 2
tagged with: jndi
accepted answer: http://stackoverflow.com/a/23912897
tagged with: glassfish
has title: Glassfish JNDI InitialContext
has comment: http://stackoverflow.com/comment/36419396
has body: I'm working on a project where I'm trying to connect to Glassfish EJB but I have a problem. When doing the following: Properties props = new Properties(); this.url = "10.128.128.135"; props.setProperty("org.omg.CORBA.ORBInitialHost", this.url); props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); final Context context = new InitialContext(props); this.userEJB = (UserEJB) context.lookup("ejb/User#com.xxxx.xxxxx.ejb.UserEJB"); LoggerFactory.getLogger(this.getClass()).info("EJB client initialized with url: " + url); i get this exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.xxxxx.xxxx.gwt.server.delegate.UserDelegate.&lt;init&gt;(UserDelegate.java:47) at com.xxxxx.xxxx.gwt.server.rpc.LoginServiceImpl.&lt;clinit&gt;(LoginServiceImpl.java:36) 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 java.lang.Class.newInstance(Class.java:433) at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153) at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.xxxxx.xxxx.gwt.MyHeadersFilter.doFilter(MyHeadersFilter.java:28) at org.mortbay.jetty.ser…
has comment: http://stackoverflow.com/comment/36422005
score: 0
has answer: http://stackoverflow.com/a/23912897
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23698416
has answer: http://stackoverflow.com/a/23698416
tagged with: java
has comment: http://stackoverflow.com/comment/36414424
type: Question

http://stackoverflow.com/comment/36509777
type: Comment
type: QuestionComment
has text: Moreover, there is no generated stub. It does not generate anything, for any project (new or old).
comment on: http://stackoverflow.com/q/23746551
score: 0

http://stackoverflow.com/comment/36429447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23705372
score: 1
has text: There is no [SplitPane](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/SplitPane.html) added.

http://stackoverflow.com/q/23721943
tagged with: android
answer count: 1
tagged with: bitmap
has title: Best way to store and display images in Android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23723393
downvote count: 0
score: 1
tagged with: java
has body: I am developing an application which can edit images. At the start of my program the user sees a list of folders that contain images. Instead of showing default folder icon i am showing an image from folder. I have database where i store path to images and information about which image is displaying in the list near the folder name. Every time when my application starts it takes a lot of time to load a scaled down image into memory and then display it, especially when there are a lot of folders with images and for each i need to load its icon. I have read this article http://developer.android.com/training/displaying-bitmaps/index.html and every time when my app starts i am scaling down every image. May be the best way in this situation is to resize (not scale down) every image and then store it in the database? But i have read that this is not good. So i want to ask an advice of how to do in this case? And i also need an advice of how to optimize displaying images in the Android Galllery widget to make it scrolling more faster. Thank you very much!
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/23723393
upvote count: 1
favorite count: 0

http://stackoverflow.com/a/38621650
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/86753747
answers question: http://stackoverflow.com/q/23747982
downvote count: 0
has comment: http://stackoverflow.com/comment/113573864
has body: [JDK 8] Imports: import java.io.*; import java.util.Base64; Code: // Get bytes, most important part byte[] bytes = Base64.getDecoder().decode("JVBERi0xLjQKMyAwIG9iago8P..."); // Write to file DataOutputStream os = new DataOutputStream(new FileOutputStream("output.pdf")); os.write(bytes); os.close();
score: 3

http://stackoverflow.com/q/23679868
tagged with: autotools
tagged with: soapui
tagged with: web-services
type: AnsweredQuestion
has title: SoapUI client side
has answer: http://stackoverflow.com/a/23681393
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23681393
score: 0
tagged with: groovy
has body: I have a wsdl to connect I set all the attribute sufficently.(SoapUI) In SoapUI project runs very well. In this stage how can I export the dynamic client for this? Is there any script or any tools for this? For example I want to send external request data to SoapUI and get response also put any folder to this response for me.

http://stackoverflow.com/q/23636628
has body: Below is my code so far. I know there is something really really trivial that I am missing. I am a beginner C++ programmer as well but still do not have much experience in that language either. I just want this to print out if I have made the mark or not. Next I will ask for an input from the command prompt and respond accordingly. Right now the command prompt opens when I click run and that is it... No lines printed! Also there are no errors... public class CheckPassFail { public static void main(CheckPassFail[] args){ int mark=88; System.out.println("The mark is " + mark); if(mark &gt;= 50){ System.out.println("You Passed!"); } else{ System.out.println("You Failed!"); } } }
linked to: http://stackoverflow.com/q/1938389
type: UnansweredQuestion
has title: Beginning Java Programming in Eclipse
has comment: http://stackoverflow.com/comment/36296205
tagged with: java
has comment: http://stackoverflow.com/comment/36296190
type: Question
has answer: http://stackoverflow.com/a/23636686
tagged with: eclipse
linked to: http://stackoverflow.com/q/18194793
score: 0
has answer: http://stackoverflow.com/a/23636689
answer count: 2

http://stackoverflow.com/comment/36999469
type: Comment
comment on: http://stackoverflow.com/a/23723556
has text: 3.0.3 is now available with this fix.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23753388
has comment: http://stackoverflow.com/comment/36522218
score: 0
answers question: http://stackoverflow.com/q/23753042
has comment: http://stackoverflow.com/comment/36521424
type: Answer
has comment: http://stackoverflow.com/comment/36521671
has comment: http://stackoverflow.com/comment/36522375
has body: It works only change is required as per under. private void GUIWindowOpened(java.awt.event.WindowEvent evt) { // TODO add your handling code here: setExtendedState(JFrame.MAXIMIZED_BOTH); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setResizable(false); setSize(screenSize); }
has comment: http://stackoverflow.com/comment/36522908

http://stackoverflow.com/a/23625277
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23622189
upvote count: 2
has body: You mapped /* (every request to your app) to your servlet called 'app'. The InternalResourceViewResolver than looks (internally) for '/person' inside '/WEB-INF/jsp/person.jsp'. This way you can access your views, while the scripts are secured inside WEB-INF, which is not accessible from the url (public).

http://stackoverflow.com/q/23744298
favorite count: 0
has body: In C++ if i declare map STL like this way map&lt; int ,vector &lt; int &gt; &gt; m; i could use this in m[u].push_back(v); in this manner. But how can I do this in Java ?
tagged with: dictionary
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23744351
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23744347
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23744347
type: Question
has title: How to do map[u].push_back(v) (c++) in java?
tagged with: stl
accepted answer: http://stackoverflow.com/a/23744351
answer count: 2
has comment: http://stackoverflow.com/comment/36502720
tagged with: generics

http://stackoverflow.com/q/23700794
tagged with: api
answer count: 1
has title: URL request of 20 most recent blog posts (Java)
type: UnansweredQuestion
tagged with: android
has body: I want to request a list of the 20 most recent blog posts from any particular blog. For this example I want to request it from http://bleacherreport.com/los-angeles-lakers In my code I have URL blogFeedUrl = new URL(); How do I call the URL correctly that I listed above? I've tried googling for Bleacher Reports API or documentation for developers but nothing comes up. I'm writing this in JAVA by the way. Thanks
has answer: http://stackoverflow.com/a/23701230
tagged with: java
tagged with: http
type: Question
score: 0

http://stackoverflow.com/a/34421774
upvote count: 2
has body: You are trying to access UI elements in the onCreate() but , it is too early to access them , since in fragment views can be created in onCreateView() method. And onActivityCreated() method is reliable to handle any actions on them, since activity is fully loaded in this state.
answers question: http://stackoverflow.com/q/23653778
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/23676140
score: 2
has body: I have following solution for you. You need to registrate a listener to monitor all window events. Use Toolkit.getDefaultToolkit().addAWTEventListener(). If you get a window opened event, try to check whether the window is a JDialog and whether the dialog's contentPane contains an instance of JOptionPane. If yes you need traverse the component tree, find the first button and click it.
has comment: http://stackoverflow.com/comment/36374634
answers question: http://stackoverflow.com/q/23675209
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/36399745
has text: Problem is that I need the substring between the and tags to generate the string to replace it with
comment on: http://stackoverflow.com/a/23689630
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23754350
has answer: http://stackoverflow.com/a/24011004
type: UnansweredQuestion
tagged with: python
score: 1
tagged with: java
upvote count: 1
has body: Good day, I'm trying to start Marathon tests (http://marathontesting.com/) from Cygwin in Windows 7, and get same error each time: Error: Could not find or load main class net.sourceforge.marathon.Main From Windows CMD tests are working with no problem using this command: marathon -batch C:\Users\asus\Desktop\my_tests\ But from Cygwin they don't work using command: marathon -batch /cygdrive/c/Users/asus/Desktop/my_tests/ I'm tryed lot of things like this: java -cp "cygpath path_to_marathon.jar" and such like, but no success. Additional info: Tests are writen on Jython and contained in the folder '..\my_tests\test.py All patches to marathon, java, microemulator (using in the tests), jython, python and etc. are added to classpath/patch in Windows.
type: Question
tagged with: cygwin
downvote count: 0
answer count: 1
tagged with: cmd
favorite count: 0
has title: Can not start Marathon tests in Cygwin under Win 7

int
tags question: http://stackoverflow.com/q/23642675
tags question: http://stackoverflow.com/q/23704628
tags question: http://stackoverflow.com/q/23671141
type: Tag
tags question: http://stackoverflow.com/q/23654172
tag name: int
tags question: http://stackoverflow.com/q/23696611
tags question: http://stackoverflow.com/q/23736772

http://stackoverflow.com/a/23763038
has body: You are using this for synchronization, which is an instance of an object. Synchronization always works on some particular instance of object and only one thread at any given time can acquire lock of (synchronize on) a single instance used for synchronization and. Both threads can access the methods only if they use separate instances of the object containing those methods.
score: 3
type: Answer
answers question: http://stackoverflow.com/q/23762876
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/23734604
tagged with: java
has title: To post data to a link from ajax returning a seperate view
type: Question
has answer: http://stackoverflow.com/a/23734907
has comment: http://stackoverflow.com/comment/36485399
score: 0
answer count: 1
tagged with: web
tagged with: jquery
tagged with: ajax
has body: I am in a situation to post some data to another link and carry on the rest of the process in that controller.But when i do it in ajax i dont get the controllers view.I get only error from the ajax call.My ajax code is : $.ajax({ url : "/xxx/yyy" method : "POST", data : JSON.stringify(response.data), headers : { 'Content-Type' : 'application/json' }, success : function() { alert("Success"); }, error : function(e) { alert("Error in page"); } }); And my controller returns ModelAndView . I also tried returning String .But i get only the error messages (ie.Error in page) from the ajax call..Can anyone help me with it.?
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/23725226
has title: How to set default application for specific file format?
linked to: http://stackoverflow.com/q/62289
tagged with: java
tagged with: file
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36466678
has answer: http://stackoverflow.com/a/23725398
answer count: 1
score: 1
tagged with: default
favorite count: 0
has body: I am writing application, that create .mg files. These files contain just text about level as normal .txt files. I just want to know, how can I set to run these .mg files with my application as default. Is there any way to do it in java?
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36466661

http://stackoverflow.com/comment/36481294
has text: you're making it way to hard for yourself. just use the iterator to iterate over the original list, and add for each instance you encounter something like: if ( !list2.contains(iterationElement)){ list2.add(iterationElement); }
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23732842

http://stackoverflow.com/q/23645291
type: UnansweredQuestion
has title: How can I use generics to use variable return values for my method?
has answer: http://stackoverflow.com/a/23645353
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23645328
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36313427
has body: I have an anonymous class XMLHandler with a "parseXML" method. This method is responsible for parsing an XML. The XML is source for questions for a quiz. I have different types of XMLs for different quizzes. The parseXML() provides an ArrayList which contains the particular questions. The questions are objects with a String for the question, answer,...etc. I have several classes for the questions since the quizzes are different. What I want is to use this parseXML for each XML. What you can see below is my current state. But at the line currentQuestion = new ... I need something like: currentQuestion = new T; But that doesn't work. So, what can I do? XMLHandler xmlHandler = new XMLHandler(activity.getApplicationContext(), "source_quiz.xml"){ @Override public &lt;T&gt; ArrayList&lt;T&gt; parseXML() throws XmlPullParserException, IOException { ArrayList&lt;T&gt; questions = null; int eventType = parser.getEventType(); T currentQuestion = null; while(eventType != XmlPullParser.END_DOCUMENT){ String name = null; switch (eventType){ case XmlPullParser.START_DOCUMENT: questions = new ArrayList&lt;T&gt;(); break; case XmlPullParser.START_TAG: name = parser.getName(); if(name.equals("question")){ currentQuestion = new ...// new QuizQuestion(); } else if(currentQuestion != null){ if(name.equals("q")) { currentQuestion.setQuestion(parser.nextText()); } else if(name.equals("a")){ currentQuestion.addAnswer(parser.nextText()); } else if(name.equals("c")){ currentQuestion.setCategory(parser.nextText()); } else if(name.equals("p")){ currentQuestion.setPage(parser.nextText()); } else if(name.equals("u")){ currentQuestion.setUnit(parser.nextText()); } } break; case XmlPullParser.END_TAG: name = parser.getName(); if(name.equalsIgnoreCase("question") &amp;&amp; currentQuestion != null){ questions.add(currentQuestion); } break; } eventType = parser.next(); } return questions; } };
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36313541
tagged with: class
answer count: 2
downvote count: 0
tagged with: generics
favorite count: 0

http://stackoverflow.com/q/23770197
score: 1
tagged with: java
tagged with: hibernate
tagged with: database
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23776126
tagged with: hibernate-mapping
has title: Saving a property of an Hibernate entity with the value from a database function
favorite count: 0
tagged with: orm
upvote count: 1
has answer: http://stackoverflow.com/a/23776126
type: Question
type: AnsweredQuestion
has body: I have an Hibernate entity which has a java.util.Date property. Instead of setting the property value to new Date() on my entity and then saving with Hibernate, I would like to make the database set the date through a SYSDATE() function. I want this because I can't rely on the date set by the client, because it is a swing app. I can only trust on the time taken from the database. I have thought of some options, but both seem quite poor: Ask the database for the current time, set it on my object and then save. (expensive) Create an Hibernate insert statement and pass the parameters manually. (subverts the purpose of Hibernate)

http://stackoverflow.com/comment/36284430
type: AnswerComment
score: 0
has text: So if an exception is thrown which is not handled in subsequent catch blocks , first the finally block gets executed and then only the the program searches up the call stack if the exception is handled anywhere or not?
type: Comment
comment on: http://stackoverflow.com/a/23630560

model-view-controller
tags question: http://stackoverflow.com/q/23669523
tag name: model-view-controller
tags question: http://stackoverflow.com/q/23698433
tags question: http://stackoverflow.com/q/23633991
tags question: http://stackoverflow.com/q/23696308
type: Tag
tags question: http://stackoverflow.com/q/23637894
tags question: http://stackoverflow.com/q/23669358
tags question: http://stackoverflow.com/q/23725554
tags question: http://stackoverflow.com/q/23643898
tags question: http://stackoverflow.com/q/23722043

http://stackoverflow.com/comment/36462751
has text: @DSquare i know how to change it but only using the properties option in netbeans.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23723070

http://stackoverflow.com/a/23768512
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23768355
has body: The default executor for AsyncTask, starting from Honeycomb, is AsyncTask.SERIAL_EXECUTOR, which means that only one task is executing at a given time. If you need parallelism, just use AsyncTask.THREAD_POOL_EXECUTOR, i.e. task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); instead of just task.execute(params); See the Order of Execution section in the documentation for AsyncTask.
answers question: http://stackoverflow.com/q/23768355
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/36384005
has text: Again your object is not null the method getNomFichier() is returning null
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23681590

http://stackoverflow.com/a/23722803
score: 2
has body: Looking at the method <T> void method(T element,Collection<T> list) When using a generic method an appropriate T is found. If no such T exists then a compile time exception is thrown. method("A",new List<String>) First argument "A" T can be anything between Object and String Second argument T can be anything between String and String since the generic argument is explicitly defined by List<String> T is String method("A",new List<Object>) First argument "A" T can be anything between Object and String Second argument T can be anything between Object and Object since the generic argument is explicitly defined by List<Object> T is Object method(new Object(),new List<String>) First argument new Object() T can be anything between Object and Object Second argument T can be anything between String and String since the generic argument is explicitly defined by List<String> No T exists that simultaneously satisfies both
answers question: http://stackoverflow.com/q/23722251
accepted answer of: http://stackoverflow.com/q/23722251
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/36392918
has text: Yes, It's NetBeans feature.
type: QuestionComment
comment on: http://stackoverflow.com/q/23685903
score: 0
type: Comment

http://stackoverflow.com/comment/36350174
type: QuestionComment
has text: Does this help? http://wiki.apache.org/solr/FAQ#Why_don.27t_International_Characters_Work.3F
comment on: http://stackoverflow.com/q/23663946
score: 0
type: Comment

http://stackoverflow.com/comment/36294750
score: 0
comment on: http://stackoverflow.com/q/23628400
type: Comment
type: QuestionComment
has text: Please do, if you still have problems tomorrow - edit the question with where you got and what you're stuck with

http://stackoverflow.com/q/23753311
has answer: http://stackoverflow.com/a/23753367
accepted answer: http://stackoverflow.com/a/23753367
has title: Get value of Generated TextView from TableRow
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: Everyone; I'm just learned to program Android with Eclipse, and here I have the simple program where I can enter the value from EditText element and print it in to the table, which is programmatically generated with the code below. When the user clicks the Edit Button, I want to retrieve the value in Col1Txt(TextView) of the same row, and pass it to a variable. I read a lot of samples in the online, but still not clear for me how to do this. Can anyone help me to complete this program? Thanks. public void Table_AddItem(Context srcpage,final TableLayout TargetTable, String StrCol1) { // Creation row final TableRow tableRow = new TableRow(srcpage); tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT)); // Creation textView final TextView Col1Txt = new TextView(srcpage); Col1Txt.setText(StrCol1); Col1Txt.setBackgroundResource(R.drawable.cellborder); Col1Txt.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); // Edit button final Button EditCmd = new Button(srcpage); EditCmd.setText("Edit"); EditCmd.setBackgroundResource(R.drawable.cellborder); EditCmd.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); EditCmd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Add the Code Here } }); tableRow.addView(Col1Txt); tableRow.addView(EditCmd); TargetTable.addView(tableRow); }
score: 0
answer count: 1

http://stackoverflow.com/comment/36280888
score: 1
comment on: http://stackoverflow.com/q/23628746
type: Comment
type: QuestionComment
has text: sorry Andrew Thompson im new for SO

http://stackoverflow.com/q/23662029
has comment: http://stackoverflow.com/comment/36346363
tagged with: java
has comment: http://stackoverflow.com/comment/36346254
has comment: http://stackoverflow.com/comment/36346994
has comment: http://stackoverflow.com/comment/36346406
type: Question
has title: Jar not finding resources
type: AnsweredQuestion
has body: I'm working on a project and compiling and running through my IDE works fine. All resources are found and it works properly. However, when I build my .jar it's able to find some resources but not all. My project structure looks like so: src res image.png image1.png about.html tmp somefilehere.txt myFile.java When I run my jar file it's able to find the images and use them, however when I try to access the html file it won't open. Here's what the project structure for the jar; I haven't messed around with jar files before so this may seem very obvious mistake I am making. Any help is appreciated thanks! EDIT: Code that accesses the file which isn't being found, private void openURL(String url) { try { Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); } ...catch exceptions... } EDIT: Structure of the jar file looks like, META-INF res image.png image1.png about.html tmp somefile.txt myclass.class
score: 0
has answer: http://stackoverflow.com/a/23662604
has comment: http://stackoverflow.com/comment/36346389
answer count: 1
tagged with: jar
accepted answer: http://stackoverflow.com/a/23662604

http://stackoverflow.com/comment/36571205
comment on: http://stackoverflow.com/a/23761971
score: 0
type: AnswerComment
type: Comment
has text: Adam, I've edited my answer and provided a [fiddle](http://jsfiddle.net/6wKSG/), which demonstrate the behaviour as described above.

http://stackoverflow.com/q/23753012
has title: Recording derivations of previously asserted triples in Jena's rule reasoners?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23787332
score: 0
has body: I created a Jena Rule Reasoner as in the documentation final String rules = "[rule1: (?a urn:eg:p ?b) (?b urn:eg:p ?c) -&gt; (?a urn:eg:p ?c)]"; final Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules)); reasoner.setDerivationLogging(true); final InfModel inf = ModelFactory.createInfModel(reasoner, rawData); Everything works fine, and I can check the derivation of triples in the inferred model, but the triples which already exist in rawData are not re-inferred by the reasoner, even if they could be, which means that there will be no record of the derivation of such triples. Is there a way to force the reasoner to re-infer and record derivations of triples that already exist in the raw data?
answer count: 1
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/36568242
tagged with: jena-rules
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36535676
tagged with: jena

http://stackoverflow.com/comment/36333729
type: AnswerComment
has text: I've applied the edit you suggested (the previous syntax was the one to use [when the libraries are in the EAR and the WAR is skinny](http://stackoverflow.com/q/19380836/1654265)). About the raw jQuery vs jQuery plugin, I've not suggested one over the other in my linked answer; the plugin is highly maintained, and since it saves you a huge coding work, it may be the best choice. If you instead are changing framework frequently, jumping eg. from Struts2 to Spring MVC to JSF 2, and want to learn to do it once, using raw jQuery would be smarter.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23654623

http://stackoverflow.com/q/23689810
downvote count: 1
type: Question
upvote count: 4
has body: I have been experimenting with guava lately and I have not come across a way to copy all of the files from one directory to another. If anyone can point me in the right direction on how to do this that would be great.
has comment: http://stackoverflow.com/comment/36400139
has comment: http://stackoverflow.com/comment/36400217
answer count: 1
has comment: http://stackoverflow.com/comment/36400311
favorite count: 0
has comment: http://stackoverflow.com/comment/36400083
type: UnansweredQuestion
tagged with: io
has answer: http://stackoverflow.com/a/30479986
has comment: http://stackoverflow.com/comment/36400196
has title: Guava how to copy all files from one directory to another
score: 3
tagged with: guava
tagged with: java

http://stackoverflow.com/q/23621920
has body: sorry for the question being ambiguous, but I found it hard to word the title right. I have a super class with a method called calculateTotal() and a method called toString(). I also have a sub class that overrides both method. The problem I'm having is, when I call toString() from subclass, super.toString() portion returns a string with the value returned from calculateTotal() from subclass. Therefore I'm getting same value for Total: and Grand Total:, both being the value of handlingFee added. To illustrate the problem, here is an example output. Expected Output: Total: 20, Plus a handling charge of $4, Grand Total: $24 Current Output: Total: 24, Plus a handling charge of $4, Grand Total: $24 Any help or suggestion would be appreciated! Thank you, Codes: Super Class: public class SuperClass { private double unitPrice; private int quantityOrdered; public double calculateTotal() { return unitPrice * quantityOrdered; } public String toString() { return String.format("\nUnit Price: %.2f\nQuantity Ordered: %d\nTotal: %.2f", unitPrice, quantityOrdered, calculateTotal()); } } Sub Class: public class SubClass extends SuperClass { private double handlingFee; public double calculateTotal() { return unitPrice * quantityOrdered + handlingFee; } public String toString() { return String.format("%s\nPlus a $%.2f handling charge\nGrand Total: $%.2f", super.toString(), handlingFee, calculateTotal()); } }
has title: Super class method using subclass method
tagged with: superclass
accepted answer: http://stackoverflow.com/a/23621954
type: AnsweredQuestion
tagged with: super
tagged with: java
possible better answer: http://stackoverflow.com/a/23622395
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23622395
tagged with: overriding
has comment: http://stackoverflow.com/comment/36268100
score: 0
has answer: http://stackoverflow.com/a/23621954
has comment: http://stackoverflow.com/comment/36268086
has comment: http://stackoverflow.com/comment/36268268
has comment: http://stackoverflow.com/comment/36268080
tagged with: subclass

http://stackoverflow.com/comment/36387252
comment on: http://stackoverflow.com/q/23683230
type: Comment
type: QuestionComment
has text: Also you can add the elements to a temp List and then add it to the original list after the loop.
score: 0

http://stackoverflow.com/comment/37255728
score: 0
type: Comment
type: QuestionComment
has text: Update: A simple project for connection when run through eclipse, actually works with same jar and same com4j. But on Server its not able to connect to QC. Need directions on this.
comment on: http://stackoverflow.com/q/23660921

http://stackoverflow.com/comment/36522772
type: Comment
comment on: http://stackoverflow.com/a/23735552
has text: @WillV Don't give up yet. This was only a guess about your intention, and there may be a "nice" solution that is more similar to the structure of your original code. (With "nice" I mean: Type-safe, and possibly without constructs like `CommandMessage<T extends CommandMessage<T>> extends Message<CommandMessage<T>>`). There'll probably be further answers. The answer of WilliamPrice is already one step, sometimes known as "getThis" trick. Also have a look at http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206 - some valuable information on this site, maybe helps
score: 0
type: AnswerComment

http://stackoverflow.com/q/23701595
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: bit
has comment: http://stackoverflow.com/comment/36421038
has comment: http://stackoverflow.com/comment/36421331
linked to: http://stackoverflow.com/q/4211095
has comment: http://stackoverflow.com/comment/36421492
tagged with: java
tagged with: bit-manipulation
has title: How can I efficiently zero out the last 32 bits of a double in java?
type: Question
has comment: http://stackoverflow.com/comment/36421395
score: -2
has answer: http://stackoverflow.com/a/23701767
has body: How can I zero out the last 32 bits of a double, in java, as efficiently as possible?
has comment: http://stackoverflow.com/comment/36421085
has answer: http://stackoverflow.com/a/23701769
answer count: 2
upvote count: 0

http://stackoverflow.com/q/23715048
favorite count: 0
type: Question
upvote count: 2
tagged with: fonts
tagged with: java
tagged with: jtextpane
accepted answer: http://stackoverflow.com/a/23782090
answer count: 1
has body: I am having trouble displaying ANSI art in a JTextPane. I thought simply chosing a fixed-width or monospace font and removing line-spacing of the JTextPane's StyledDocument via a SimpleAttributeSet would be enough to correctly display some different pieces of ANSI art, but after trying different fonts and settings I realized it has to be more than that. I've been using DAMN NFO Viewer to compare my JTextPane with in order to see if my code is displaying the piece of digital art correctly. I set the JTextPane font to the same font DAMN NFO Viewer is using (according to its settings Courier New, 8, by default) via artTextPane.setFont(new java.awt.Font("Courier New", 0, 8)). However, even if I apply line-spacing settings via StyledDocument.setParagraphAttributes(int, int, AttributeSet, boolean) my JTextPane does not display the art correctly. Here is two screenshots to show the differences: DAMN NFO Viewer (Courier New, 8): My JTextPane (Courier New 8): What is really strange is that when I am setting my JTextPane's font-size to 9 the alignment seems to be correct but a bit unsharp. Zooming onto the characters that form the g in the art piece shows blueish pixels to the right that make it look unsharp: My JTextPane (Courier New 9): Also I noticed that opening the art.txt in notepad displays it just like DAMN NFO Viewer does. Also the JTextPane seems to be displaying it smaller, like, the 'casket' in which a character is drawn appears smaller. First I thought DAMN NFO Viewer is using a different version of the font Courier New, so I dug through its directories and found the following registry file: [HKEY_CURRENT_USER\Software\DAMN\DAMN NFO Viewer\NFO] "FontName"="[built-in] Courier New" "FontData"=hex:91,00,03,01 "Window"=dword:00000023 "BackgroundColor"=hex:ff,ff,ff,00 "TextColor"=hex:00,00,00,00 "HyperLinkColor"=hex:bf,cd,db,00 "HyperLinkHoverColor"=hex:99,b4,d1,00 "Text"=dword:00000400 Which makes me think it may use a derived version of Courier New with the settings…
has title: Java - How to correctly display ANSI art in a JTextPane
type: AnsweredQuestion
score: 2
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/23782090

java-me
tags question: http://stackoverflow.com/q/23654788
type: Tag
tag name: java-me
tags question: http://stackoverflow.com/q/23697004
tags question: http://stackoverflow.com/q/23732876

http://stackoverflow.com/a/23767004
has comment: http://stackoverflow.com/comment/36624998
has comment: http://stackoverflow.com/comment/36628171
upvote count: 3
has comment: http://stackoverflow.com/comment/36626146
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36625556
score: 3
type: Answer
has body: Basically I don't think JExpression supports Lists. It does have a JArray but still you'll have to iterate over the headersList. Up to codemode-2.6 there is no method in JExpr or JExpression that iterates over a list. So you cant get away with the iteration part. So with that the standard practice would be iterate over the headersList and add initialization statements. Say for example you have a Namevalue pair like public class BasicNameValuePair { private String name; private String value; public BasicNameValuePair(String name, String value) { this.name = name; this.value = value; } //getters &amp; setters } and initialized like List&lt;BasicNameValuePair&gt; headerList = new ArrayList&lt;BasicNameValuePair&gt;(); headerList.add(new BasicNameValuePair("1", "1")); headerList.add(new BasicNameValuePair("2", "2")); headerList.add(new BasicNameValuePair("3", "3")); headerList.add(new BasicNameValuePair("4", "4")); Then you could generate you method body as private JMethod makeHeadersWrapper( String endPointName, List&lt;BasicNameValuePair&gt; headersList ) { JClass headerClass = codeModel.ref( headersList.getClass() ).narrow( BasicNameValuePair.class ); JMethod wrapperMethod = definedClass.method( JMod.PUBLIC | JMod.STATIC, headerClass, ( "make" + endPointName + "Header") ); JVar headersListVar = wrapperMethod.body().decl( wrapperMethod.type(), "headersList", JExpr._new(headerClass) ); for(BasicNameValuePair nameValuePair : headersList) { wrapperMethod.body().add(headersListVar.invoke("add").arg(JExpr._new(nameValuePairClass).arg(nameValuePair.getName()).arg(nameValuePair.getValue()))); } wrapperMethod.body()._return( headersListVar ); return wrapperMethod; } This will generate the code public static ArrayList&lt;BasicNameValuePair&gt; makeTestHeader() { ArrayList&lt;BasicNameValuePair&gt; headersList = new ArrayList&lt;BasicNameValuePair&gt;(); headersList.add(new BasicNameValuePair("1", "1")); headersList.add(new BasicNameValuePair("2", "2")); headersList.add(new Bas…
accepted answer of: http://stackoverflow.com/q/23680137
has comment: http://stackoverflow.com/comment/36626653
answers question: http://stackoverflow.com/q/23680137

http://stackoverflow.com/q/23690878
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23692569
has body: I would like to have a way to achieve marking the levels as Para, Sub-Para and Clause, given below is the input and output format of the text Input Text: (A) Preparations (1) Required ingredients to prepare... (a) 100ml of coconut oil (b) 2 table spoon of lemon mixed.. (B) Process steps (i) Mix well the ... (ii) Apply in all parts of ... (iii) Gently give a massage.. Output Text: &lt;Level type="Para" id="(A)"&gt; (A) Preparations &lt;Level type="Sub-Para" id="(A)(1)"&gt; (1) Required ingredients to prepare... &lt;Level type="Clause" id="(A)(1)(a)"&gt; (a) 100ml of coconut oil &lt;Level type="Clause" id="(A)(1)(b)"&gt; (b) 2 table spoon of lemon mixed.. &lt;Level type="Para" id="(B)"&gt; (B) Process steps &lt;Level type="Sub-Para" id="(B)(i)"&gt; (i) Mix well the ... &lt;Level type="Sub-Para" id="(B)(ii)"&gt; (ii) Apply in all parts of ... &lt;Level type="Sub-Para" id="(B)(iii)"&gt; (iii) Gently give a massage.. Please assist how this can be achieved using Java. I will try on my own. The text alignment is shown just for better understanding the levels. If I'm not clear in explaining the question please let me know, I will modify the question. Thanks.
answer count: 1
has answer: http://stackoverflow.com/a/23692569
has title: Inserting levels for paragraph and sub paragraph using Java
type: AnsweredQuestion

http://stackoverflow.com/comment/36304871
has text: Please show the *exact* exception, including the stack trace.
type: Comment
score: 5
type: QuestionComment
comment on: http://stackoverflow.com/q/23640931

http://stackoverflow.com/comment/36562336
has text: I don’t understand, if i can see this file in java - version, how come it doesn't exists?
comment on: http://stackoverflow.com/q/23774811
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23716084
has title: Receiving null Error in mysql code
has comment: http://stackoverflow.com/comment/36448869
score: -1
upvote count: 2
answer count: 2
downvote count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23716130
accepted answer: http://stackoverflow.com/a/23716130
has answer: http://stackoverflow.com/a/23716133
has body: Can any one help me? Why am I receiving this error when I have no null in parameters? 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 'null' at line 1 The input is OK, code receives them, the only thing I really suspect is that the "VALUES" method at the end of code is returning null. A little help plz? String theuser = (String) sInput.readObject(); display(theuser); String thepass = (String) sInput.readObject(); display(thepass); String thename = (String) sInput.readObject(); display(thename); String thephone = (String) sInput.readObject(); display(thephone); String themail = (String) sInput.readObject(); display(themail); try{ //STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //STEP 3: Open a connection System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); // create output first sOutput = new ObjectOutputStream(socket.getOutputStream()); sInput = new ObjectInputStream(socket.getInputStream()); // read the username String theuser = (String) sInput.readObject(); display(theuser); String thepass = (String) sInput.readObject(); display(thepass); String thename = (String) sInput.readObject(); display(thename); String thephone = (String) sInput.readObject(); display(thephone); String themail = (String) sInput.readObject(); display(themail); try{ //STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //STEP 3: Open a connection System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); //STEP 4: Execute a query System.out.println("Inserting records into the table..."); stmt = conn.createStatement(); String sql = "INSERT INTO ofuser " + VALUES (theuser,thepass,encrypted,thename,themail,4234,23432,thephone); stmt.executeU…
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/23716133

regex
tags question: http://stackoverflow.com/q/23763911
tags question: http://stackoverflow.com/q/23677364
tags question: http://stackoverflow.com/q/23730507
tags question: http://stackoverflow.com/q/23772291
tags question: http://stackoverflow.com/q/23667773
tags question: http://stackoverflow.com/q/23739711
tags question: http://stackoverflow.com/q/23710720
tags question: http://stackoverflow.com/q/23671842
tags question: http://stackoverflow.com/q/23634829
tags question: http://stackoverflow.com/q/23657575
tags question: http://stackoverflow.com/q/23690437
tags question: http://stackoverflow.com/q/23626396
tag name: regex
tags question: http://stackoverflow.com/q/23760958
tags question: http://stackoverflow.com/q/23620746
tags question: http://stackoverflow.com/q/23708628
tags question: http://stackoverflow.com/q/23674074
tags question: http://stackoverflow.com/q/23689770
tags question: http://stackoverflow.com/q/23630851
tags question: http://stackoverflow.com/q/23666477
tags question: http://stackoverflow.com/q/23616436
tags question: http://stackoverflow.com/q/23742932
tags question: http://stackoverflow.com/q/23706717
tags question: http://stackoverflow.com/q/23723331
tags question: http://stackoverflow.com/q/23695785
tags question: http://stackoverflow.com/q/23651376
tags question: http://stackoverflow.com/q/23712352
tags question: http://stackoverflow.com/q/23699343
tags question: http://stackoverflow.com/q/23631930
tags question: http://stackoverflow.com/q/23724703
tags question: http://stackoverflow.com/q/23649180
tags question: http://stackoverflow.com/q/23679990
tags question: http://stackoverflow.com/q/23747866
tags question: http://stackoverflow.com/q/23639064
tags question: http://stackoverflow.com/q/23625085
tags question: http://stackoverflow.com/q/23645151
tags question: http://stackoverflow.com/q/23631612
tags question: http://stackoverflow.com/q/23630051
tags question: http://stackoverflow.com/q/23687439
tags question: http://stackoverflow.com/q/23689670
tags question: http://stackoverflow.com/q/23671745
tags question: http://stackoverflow.com/q/23623651
tags question: http://stackoverflow.com/q/23705179
tags question: http://stackoverflow.com/q/23688394
tags question: http://stackoverflow.com/q/23724661
tags question: http://stackoverflow.com/q/23642322
tags question: http://stackoverflow.com/q/23713442
tags question: http://stackoverflow.com/q/23662527
tags question: http://stackoverflow.com/q/23659388
tags question: http://stackoverflow.com/q/23678656
tags question: http://stackoverflow.com/q/23667905
tags question: http://stackoverflow.com/q/23632274
tags question: http://stackoverflow.com/q/23675909
tags question: http://stackoverflow.com/q/23651404
tags question: http://stackoverflow.com/q/23752897
tags question: http://stackoverflow.com/q/23700264
tags question: http://stackoverflow.com/q/23715490
tags question: http://stackoverflow.com/q/23632185
tags question: http://stackoverflow.com/q/23689451
tags question: http://stackoverflow.com/q/23738906
tags question: http://stackoverflow.com/q/23673992
tags question: http://stackoverflow.com/q/23763779
tags question: http://stackoverflow.com/q/23661336
tags question: http://stackoverflow.com/q/23720546
tags question: http://stackoverflow.com/q/23720217
tags question: http://stackoverflow.com/q/23729735
tags question: http://stackoverflow.com/q/23683313
tags question: http://stackoverflow.com/q/23688839
tags question: http://stackoverflow.com/q/23707566
tags question: http://stackoverflow.com/q/23718882
tags question: http://stackoverflow.com/q/23620359
tags question: http://stackoverflow.com/q/23643920
tags question: http://stackoverflow.com/q/23713756
tags question: http://stackoverflow.com/q/23684473
tags question: http://stackoverflow.com/q/23728121
tags question: http://stackoverflow.com/q/23744675
tags question: http://stackoverflow.com/q/23747369
tags question: http://stackoverflow.com/q/23727095
tags question: http://stackoverflow.com/q/23768838
tags question: http://stackoverflow.com/q/23649303

http://stackoverflow.com/comment/42703633
type: AnswerComment
has text: Yes, that's why the length needs to be taken after encoding it as UTF-8.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23723403

http://stackoverflow.com/a/23688388
has body: transform is probably not going to do what you want. You mentioned that cancelling futureToListen will cancel future, and that's true. The problem is that the same is true of the reserve: When future is cancelled, so too will futureToListen be. That will mean that it never computes its result. To solve this problem, you have a couple options: If you don't care about being able to cancel future, then change futureToListen to a SettableFuture. Then have whoever cancels future also call futureToListen.set(file). If you do care about being able to cancel future, then change futureToListen to an AbstractFuture that (a) exposes set() (so that you can do what I recommend in (1)) and (b) implements interruptTask() to call future.cancel(). There are other possible clever solutions that involve triggering the work whenever future completes unsuccessfully, but I'm not sure I recommend then. I personally feel a little nervous about using "Future was cancelled" as a signal for "work is successfully done." That's because the Future could also be cancelled by an executor shutdown, for example. (Another reason: You'd need to be careful to distinguish between "threw an exception during execution" and "was cancelled.") For this reason, my suggested solutions are set up to call set() directly rather than to trigger off any cancellation of the future.
has comment: http://stackoverflow.com/comment/36416134
accepted answer of: http://stackoverflow.com/q/23686704
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23686704
type: Answer

http://stackoverflow.com/comment/36549186
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23768116
has text: On the other hand, what if you _don't_ stop it? What if you make the consumer a daemon thread. Then the JVM will kill it when the last non-daemon thread dies.

http://stackoverflow.com/a/23775146
score: 0
has body: There's javac, of course, and for a minimalist debugger, you could try jdb. I haven't used it in years, personally, but my recollection is that it did what I needed at the time.
answers question: http://stackoverflow.com/q/23775020
type: Answer

http://stackoverflow.com/comment/36344153
has text: @user3198603 The checkstyle homepage tells all about all the modules. http://checkstyle.sourceforge.net/index.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23660339
type: Comment

http://stackoverflow.com/q/23620359
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36265098
has comment: http://stackoverflow.com/comment/36265722
has body: I need a regex that allows only alphabet letters (both small and capital) and letter ñ, also small and capital. (n and Ñ) in Java. Can someone help me? UPDATE: Per correction from the people commenting, I put here some of the expressions I used previously for testing. "\\P{L}+", "[a-zA-Z\u00f1\u00d1]*" and "[a-zA-ZñÑ]*". The reason for this not working if as the comments follow.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36265042
downvote count: 4
score: -2
has comment: http://stackoverflow.com/comment/36340064
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36265118
has title: regex - Only alphabet letters and ñ
tagged with: regex
has answer: http://stackoverflow.com/a/23620410

http://stackoverflow.com/q/23650463
tagged with: jbutton
has comment: http://stackoverflow.com/comment/36323233
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23650744
type: Question
tagged with: arrays
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36323337
accepted answer: http://stackoverflow.com/a/23650744
has comment: http://stackoverflow.com/comment/36323308
score: 1
has title: How to create JButton array?
has comment: http://stackoverflow.com/comment/36323374
has body: I have used below code but did not work properly. I have list of JButton objects on the panel but could not click on each button individually. for(int i=0; i&lt;udataArr.length(); i++) { userBtn = new JButton(); userLb = new JLabel(); cur1 = userBtn.getCursor(); userBtn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); Image imgUO = ImageIO.read(getClass().getResource("/resources/img-std.png")); userBtn.setIcon(new ImageIcon(imgUO)); userBtn.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder)); userLb.setText((String) udataArr.getJSONObject(i).get("user_name")); //button[i].setText((String) udataArr.getJSONObject(i).get("user_name")); panelLeft.add(userBtn); panelLeft.add(userLb); panelLeft.add(Box.createVerticalStrut(15)); }
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/36323461

http://stackoverflow.com/q/23768270
has comment: http://stackoverflow.com/comment/36549648
tagged with: performance
has comment: http://stackoverflow.com/comment/36549386
has comment: http://stackoverflow.com/comment/36557434
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/36549703
has comment: http://stackoverflow.com/comment/36549588
has comment: http://stackoverflow.com/comment/36549472
has comment: http://stackoverflow.com/comment/36550654
type: Question
has comment: http://stackoverflow.com/comment/36549549
has comment: http://stackoverflow.com/comment/36549234
has comment: http://stackoverflow.com/comment/36549611
has comment: http://stackoverflow.com/comment/36549111
has comment: http://stackoverflow.com/comment/36549443
has comment: http://stackoverflow.com/comment/44529005
has comment: http://stackoverflow.com/comment/36549584
downvote count: 0
has comment: http://stackoverflow.com/comment/36549702
has comment: http://stackoverflow.com/comment/36549450
favorite count: 0
has comment: http://stackoverflow.com/comment/36557361
has comment: http://stackoverflow.com/comment/36549306
has comment: http://stackoverflow.com/comment/36549571
linked to: http://stackoverflow.com/q/2407912
has comment: http://stackoverflow.com/comment/36549995
has comment: http://stackoverflow.com/comment/36549797
has comment: http://stackoverflow.com/comment/36549484
has comment: http://stackoverflow.com/comment/36549395
has body: I was at a programming competition last weekend (a qualifier round for the ICPC) and I was trying to do a problem that involved (among other things) factoring integers in the range 0 &lt;= i &lt;= 1,000,000 into primes. My first thought was "Oh no, factoring integers is in NP, we need to find a way to avoid spending time on it." We were working in Java. Being primarily a C programmer, my first instinct was to precompute all of the primes up to 1,000,000 with a script, format it as a Java array, and attempt to insert it into my code. My reasoning was that it save us the time of running something like a Sieve of Eratosthenes during the timed section, cut down the time complexity by something like a factor of n, and breeze through it. I was then hit with the "code too large" error and my few-hundred-thousand int array was rejected by the compiler. Because of the rules of the competition, it was not possible to read it in to a file, or store it anywhere except the .java file containing the class that had a main method. I tried breaking it up into something like 100,000 int chunks but that didn't work because it was still too large (we had nothing to consult except for the Java 7 documentation and I wasn't able to find anything about the "code too large" error message in it). We eventually gave up, tried another method, and got it working, but it ended up costing us something like 1/4 of our total time on the competition and harmed our score significantly. So, my question is: was there any sane way to solve this problem with a lookup table? Is it just impossible to get a huge pre-compiled lookup table into a Java program? I'm also curious about the reasoning behind this restriction of the language... is it a security thing, somehow? Why would a compiler limit the bytecode size of methods?
has comment: http://stackoverflow.com/comment/36554045
has comment: http://stackoverflow.com/comment/36549169
duplicate of: http://stackoverflow.com/q/2407912
answer count: 0
has comment: http://stackoverflow.com/comment/36549408
score: 9
has comment: http://stackoverflow.com/comment/36549952
has comment: http://stackoverflow.com/comment/36549491
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36549528
has title: "Code too large" -- How can I make a huge, compiled lookup table?
has comment: http://stackoverflow.com/comment/36552777
has comment: http://stackoverflow.com/comment/36549520
has comment: http://stackoverflow.com/comment/36549590

http://stackoverflow.com/q/23646561
has title: How to use another classes' functions in Java
tagged with: class
answer count: 3
has comment: http://stackoverflow.com/comment/36315646
has answer: http://stackoverflow.com/a/23657020
has comment: http://stackoverflow.com/comment/36315677
has answer: http://stackoverflow.com/a/23646704
tagged with: swing
possible better answer: http://stackoverflow.com/a/23646655
has body: First time using the stackoverflow. So, please don't be too harsh :) I have a little Java project. We are learning how to built GUI with swing. I am stuck with methodology. I have a JFrame for GUI and I am creating 4 JPanels for: Menu (Menu Class) Buttons (Buttons Class) ActionArea (ActionArea Class) Statusbar (StatusBar Class) I have been asked to have same options in the Menu and Buttons. i.e. New File or Open File options will be available in the Menu and Buttons sections. I don't want to duplicate the code and copy into Menu Class and Buttons Class. I believe there is a way to use only one function from both classes. Could somebody help me to achieve this? Here is main code: import java.awt.BorderLayout; import javax.swing.JFrame; public class GUI extends JFrame { private Menu menu; private Buttons buttons; private ActionArea actionArea; private StatusBar statusBar; public GUI() { super("New GUI"); this.setSize(800, 600); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLayout (new BorderLayout()); this.menu = new Menu(); this.buttons = new Buttons(); this.actionArea = new ActionArea(); this.statusBar = new StatusBar(); this.setJMenuBar(this.menu); add(this.toolbar, BorderLayout.NORTH); add(this.actionArea, BorderLayout.CENTER); add(this.statusBar, BorderLayout.SOUTH); } } lets say the function name is newFile(); I don't want to write this function one for menu class and one for buttons class. Thanks in advance to all EDIT: this.menu = new Menu(); creates menuitems with required actions in Menu class this.buttons = new Buttons(); creates jbuttons with required actions in Buttons class actions are exactly same. Code is doubled. This is the problem.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36316057
has answer: http://stackoverflow.com/a/23646655
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23657020
type: Question

http://stackoverflow.com/comment/36426944
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23704355
has text: You can have macros in Java (#define). It's not nice but you can define a Predicate that at the same time also creates a String of the very same content. I wouldn't do it though.
score: 0

http://stackoverflow.com/q/23751345
favorite count: 0
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: file
upvote count: 1
downvote count: 1
type: Question
has body: i have to fectch 500 txt files hosted here: https://drive.google.com/folderview?id=0B_R7SeoAotsmUUtYendIX04zRjA&amp;usp=sharing so i can index them and make a "search engine" the thing is i dont know how to get those files, i read how to read a specific file from a URL but i cant find what i need. I saw something about google drive sdk but i was wondering if is there another way Thanks in advance!! PD: im working with java.
has comment: http://stackoverflow.com/comment/36517321
tagged with: java
has comment: http://stackoverflow.com/comment/36517773
linked to: http://stackoverflow.com/q/20665881
has title: Processing files from URL
tagged with: url

http://stackoverflow.com/a/23656639
type: Answer
has body: The documentation below states that you can specify a customerContextLoader or customContextInitializer for the @ContextConfiguration annotation. http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/testing.html#integration-testing-annotations One suggestion would then be to create a custom ContextLoader. For annotation based config looks like you might want to override 1 or more methods in the following: http://docs.spring.io/spring/docs/3.2.8.RELEASE/javadoc-api/org/springframework/test/context/support/AnnotationConfigContextLoader.html
score: 0
answers question: http://stackoverflow.com/q/23656063

http://stackoverflow.com/comment/36520232
type: Comment
comment on: http://stackoverflow.com/a/23742235
has text: I changed the scope to "provided" for the slf4j-log4j12 package. Might this combined package be a problem? I edited my post to include the list of jars in my lib folder.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36346098
type: QuestionComment
score: 8
has text: I don't understand. You set iMyOwn temp = null, and on the next line you try to call it? Obviously it is null
comment on: http://stackoverflow.com/q/23661963
type: Comment

http://stackoverflow.com/q/23697621
has comment: http://stackoverflow.com/comment/36413602
tagged with: java
tagged with: eclipse
type: Question
score: 5
has comment: http://stackoverflow.com/comment/36414461
upvote count: 5
has body: In the new Gradle build system, we can package Android projects in very convenient .AAR format. Unfortunately the ADT Eclipse plugin, v22 , does not support this file format. Please can it do so.
has comment: http://stackoverflow.com/comment/36413436
has answer: http://stackoverflow.com/a/29813898
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has title: How to support AARs in Eclipse?
type: UnansweredQuestion
tagged with: android
tagged with: gradle-eclipse

http://stackoverflow.com/a/23757604
score: 0
type: Answer
has body: Take a look at Jersey framework. If I understand you correctly, you should find this section of the documentation useful.
answers question: http://stackoverflow.com/q/23757228

http://stackoverflow.com/comment/72198419
type: AnswerComment
has text: Unbelievable it works like a charm. Thanks in advance!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23656701

http://stackoverflow.com/a/23745024
upvote count: 2
has comment: http://stackoverflow.com/comment/125394188
downvote count: 0
type: Answer
score: 2
has body: I tested it like so, static class Category { public Category(String name) { this.name = name; } private String name; public String getName() { return name; } @Override public boolean equals(Object o) { if (o != null &amp;&amp; o instanceof Category) { return this.getName().equals(((Category) o).getName()); } return false; } } public static void main(String[] args) { List&lt;Category&gt; al = new ArrayList&lt;&gt;(); al.add(new Category("test")); System.out.println(al.contains(new Category("test"))); } Output is true
answers question: http://stackoverflow.com/q/23744865

http://stackoverflow.com/q/23660913
score: -1
type: Question
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23660943
has title: Java recursion error
possible better answer: http://stackoverflow.com/a/23660958
has body: I'm attempting to add all the multiples of 3 or 5 under 1000 using a recursive method. Here's my code public static void main(String args[]){ //TODO: Find all the multiples of 3 or 5 below 1000 //Functional System.out.println(addMultiples(1, 0)); /* //Imperative solution int num = 0; for(int i = 1; i &lt; 1000; i++){ if(i % 3 == 0 || i % 5 == 0){ System.out.println(i + " is a multiple of 3 or 5."); num += i; } } System.out.printf("The sum of all the multiples of 3 or 5 below 1000 is %d", num); */ } public static int addMultiples(int num, int base){ //Exit case if (num &gt;= 1000) return base; else if (num % 3 == 0 || num % 5 == 0) base += num; addMultiples(++num, base); //I was forced to return a -1. Compiler said. :( return -1; } Why is this code returning a -1? It's clear that if num &gt;= 1000, the recursion would stop. I tried putting a System.out.println(base) inside my exit condition and it was printing out the number that I wanted. Also, why did the compiler tell me to return a -1?
has answer: http://stackoverflow.com/a/23660958
accepted answer: http://stackoverflow.com/a/23660943
has comment: http://stackoverflow.com/comment/36343899
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/36343852
downvote count: 1
type: AnsweredQuestion
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/36343819

http://stackoverflow.com/a/23652843
upvote count: 11
downvote count: 1
answers question: http://stackoverflow.com/q/23652527
has comment: http://stackoverflow.com/comment/100150890
type: Answer
has body: It should be very easy: @RequestMapping(value = "/someTest?birthDate={birthDate}") public Object sendWishes(@Valid @Pattern(regexp = "you-pattern-here") @RequestParam("birthDate") String birthDate) { // i need birthDate to be a valid date format in YYYYMMDD format // if its not valid it should not hit this method }
score: 10

http://stackoverflow.com/comment/36455397
has text: ok , but i m still unclear y it took the size of arrylistModel variable even if i add new Model()
type: Comment
comment on: http://stackoverflow.com/a/23719368
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36576946
type: AnswerComment
score: 0
type: Comment
has text: @Pawan: I haven't gone looking for them. General tools-building details are at http://tools.android.com/build
comment on: http://stackoverflow.com/a/23769203

http://stackoverflow.com/comment/36552203
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23769423
has text: Thanks Austin, mind if I kindly ask for a sample code on how to properly do it. It's basically the Log In button I use when receiving user and password from my login frame. So enter user and password then press enter :)
score: 0

http://stackoverflow.com/q/23675907
type: Question
has answer: http://stackoverflow.com/a/23677142
accepted answer: http://stackoverflow.com/a/23677142
score: 0
answer count: 1
has body: In my wsdl file I have following part <s:element maxOccurs="1" minOccurs="0" name="Request"> <s:complexType> <s:sequence> <s:any/> </s:sequence> </s:complexType> </s:element> So, I generated axis2 stub to this wsdl and it created to element Request this class Request_type0 rqType0 = new Request_type0(); which has only method rqType0.setExtraElement(OMElement); I need to send request like this, <web:Request> <t>1</t> <t>2</t> </web:Request> please help me!!!
tagged with: web-services
type: AnsweredQuestion
has title: Axis2 create OMElement without OMNamespace
tagged with: java
tagged with: apache-axis

http://stackoverflow.com/comment/36490511
comment on: http://stackoverflow.com/a/23737782
has text: Using HTTP headers is probably the way to go. Their name should start with "X-", as they are nonstandard.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23663955
tagged with: visual-editor
has answer: http://stackoverflow.com/a/24830709
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25309363
has answer: http://stackoverflow.com/a/23665195
tagged with: windowbuilder
possible better answer: http://stackoverflow.com/a/23665195
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25309363
has title: Is there a way to convert from Visual Editor created GUI to WindowBuilder GUI in Eclipse?
tagged with: eclipse
type: Question
has body: Since Visual Editor is no longer supported in newer versions of eclipse, I am trying to make the switch to WindowBuilder. It seems that I should just be able to open a panel created in Visual Editor in WindowBuilder and all components should display, but this does not seem to be the case. All components sizes seem to come in as 0px x 0px and even after changing this, the components still do not show up in the preview window. All components are custom that extend the standard JComponent (such as JLabel). I am not sure if the problem is some sort of incompatibility, the fact that I am using custom components and containers, or a problem with my WindowBuilder installation (or something else!). Does anyone have any insight? I would be much appreciated! :)

http://stackoverflow.com/a/24704803
score: 0
type: AcceptedAnswer
has body: I created a folder named classes and added it in classpath before respective jar file. Added .class file in classes folder according to its package structure and restarted server. Because class loader loads class file in the sequence we provide in classpath , my class from classes folder gets loaded and my changes are reflected at runtime. Like if my java file is com.vipin.test.Test.java , I i placed Test.class in classes/com/vipin/test folder.
accepted answer of: http://stackoverflow.com/q/23697196
type: Answer
answers question: http://stackoverflow.com/q/23697196

http://stackoverflow.com/comment/36380430
type: Comment
has text: The list in the second row or the code sample is the list for that index position. I don't exactly understand the question.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23678788

http://stackoverflow.com/a/23689527
type: Answer
accepted answer of: http://stackoverflow.com/q/23688094
has body: This usually means you have written to an connection that had already been closed by the peer. In other words, an application protocol error. Your code needs work. Don't use ready(): just block in read() until data arrives. At present you're smoking the CPU while ready() returns false. This is probably causing the error. isConnected() is always true after you connect the socket. It won't magically return false when the peer closes his end. You have to detected that via EOS or an exception. Looping on while (isConnnected()) isn't valid. Don't mix streams and readers and writers. You're using a BufferedInputStream: use a BufferedWriter at the other end.
answers question: http://stackoverflow.com/q/23688094
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/36405382

process
tags question: http://stackoverflow.com/q/23749624
tags question: http://stackoverflow.com/q/23665121
tags question: http://stackoverflow.com/q/23636593
tags question: http://stackoverflow.com/q/23670110
tags question: http://stackoverflow.com/q/23650220
type: Tag
tags question: http://stackoverflow.com/q/23718121
tags question: http://stackoverflow.com/q/23674650
tags question: http://stackoverflow.com/q/23739143
tags question: http://stackoverflow.com/q/23697398
tag name: process
tags question: http://stackoverflow.com/q/23696211

http://stackoverflow.com/comment/40106539
type: Comment
comment on: http://stackoverflow.com/a/23712812
has text: what is your filter mapping ??
score: 0
type: AnswerComment

http://stackoverflow.com/a/25798389
upvote count: 2
answers question: http://stackoverflow.com/q/23660062
type: Answer
score: 2
has body: I had a similar issue. I was using SetApplicationName() in the ShareDialogBuilder to set a name that was different to the facebook Display Name. They must match!
downvote count: 0
has comment: http://stackoverflow.com/comment/56527369

http://stackoverflow.com/a/33118540
has body: To work with FocusListener Interface and in order to listen’s the keyboards gaining or losing focus, the listener object created from class is need to registered with a component using the component’s addFocusListener() method. The two important method focusGained(FocusEvent e) and void focusLost(FocusEvent e) which helps to find which component is focused. Take a read through What is FocusListener Interface and How it Work and Validate Text Field Using FocusListener Interface in Java for more details with proper examples.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23693777

http://stackoverflow.com/comment/36495850
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23739834
has text: According to your configuration, you are trying to access localhost via the proxy.
score: 0

http://stackoverflow.com/comment/36562706
has text: @suninsky Yes, I am getting the fileName.
comment on: http://stackoverflow.com/q/23775503
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23621306
type: Answer
score: 1
downvote count: 0
has body: You're creating a completely new JList inside of your actionPerformed method and adding data to it, which will have no effect on the completely separate displayed JList. Suggestion: don't create a new JList object. Instead use the JList, or better its model, that you have. Better would be to create your own custom ListModel based on the AbstractListModel, and make your ArrayListClass&lt;T&gt; or the interface the nucleus of this model. Then make sure to make all data changes through this model class.
answers question: http://stackoverflow.com/q/23620985
upvote count: 1

http://stackoverflow.com/a/23665156
type: Answer
has body: The too-light result appears to be due to a conversion from linear colorspace (gamma=1) to sRGB (gamma=1/2.2). The original doesn't contain any gamma information, so ImageMagick is free to choose its own default. Recent versions of ImageMagick handle grayscale images differently, some assuming linear and others assuming sRGB. From the commandline you'd use the "-gamma 1" option to get the darker result with all versions. You need to do the equivalent in Java.
answers question: http://stackoverflow.com/q/23654987
score: 0

http://stackoverflow.com/comment/36357657
score: 1
comment on: http://stackoverflow.com/q/23667848
has text: It's calling it and checking if the result is true or false
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36437634
has text: @Tiny : Solved the problem :),but again 2 questions :( how I solved it: I did not changed anything in the code, instead of opening **login.jsp** I typed **login** and I don't know why but it is working!! First question, can you tell me why **login.jsp** is not working? Second question , in Web.xml I have defined Welcome-page but that is not working. After running the project I had to type every time /l
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23702496
type: QuestionComment

http://stackoverflow.com/a/26642803
has body: How do you test your servlet? You have to have Accept-Encoding:gzip in the header. If you test your web services in a browser, the chances are the browser unzips everything and shows it to you. Try this: curl -H Accept-Encoding:gzip -i -u user:pass http://your/web/service
answers question: http://stackoverflow.com/q/23618621
score: 0
type: Answer

http://stackoverflow.com/a/23738130
type: Answer
has body: there is no functionality for showing a list of supported APDUs. either you have: the source code and look through the process method a documentation of the applet or the applet supports a certain specification like pkcs11/15 or the iso commands
upvote count: 3
has comment: http://stackoverflow.com/comment/36505719
score: 3
answers question: http://stackoverflow.com/q/23737038
downvote count: 0

http://stackoverflow.com/comment/36476916
type: QuestionComment
score: 0
has text: Wait... The compiler is clear enough: `switch` expects an `int` but you're passing a `Class` object
comment on: http://stackoverflow.com/q/23730416
type: Comment

http://stackoverflow.com/q/23620163
type: Question
tagged with: startup
tagged with: weblogic
upvote count: 11
has comment: http://stackoverflow.com/comment/101314126
has answer: http://stackoverflow.com/a/26611149
tagged with: environment-variables
answer count: 1
has title: Best way to set environmental variables in WebLogic startup
has comment: http://stackoverflow.com/comment/101462080
has comment: http://stackoverflow.com/comment/36310685
favorite count: 0
has body: In Oracle WebLogic, what is the best way to set an environmental variable so that it can be accessed by your code? We have third-party apps running WebLogic that look for an environment variable. Note: We start our managed servers using Node Manager. I would prefer to be able to set it somewhere in the domain configuration, like in the Server Start tab in the Admin Console, but there seems no good place to do that. The only way I can see to do it would be Edit the bin/setDomainEnv.sh to export the environmental variable Modify nodemanager.properties to have StartScriptEnabled=true What this does is, forces NodeManager to use the &lt;ms_home&gt;/bin/startManagedWebLogic.sh, which sources setDomainEnv.sh and they will be picked up when NodeManager starts. But you also have to do this on every machine. Wondering if there is a cleaner way of doing this than mucking with Oracle's startup scripts.
type: UnansweredQuestion
score: 11
has comment: http://stackoverflow.com/comment/36358599
linked to: http://stackoverflow.com/q/12612723
downvote count: 0
tagged with: java

buttonclick
type: Tag
tag name: buttonclick
tags question: http://stackoverflow.com/q/23629459

http://stackoverflow.com/comment/36467813
has text: Wow, I had completely overlooked the `{packet, X}` option, thinking it was only for static lengths (which in my case wouldn't work). Huge thanks for the `{packet, line}` option, it's probably all that i need!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23724869
type: Comment

http://stackoverflow.com/q/23707808
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23708092
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/36433275
has comment: http://stackoverflow.com/comment/36433355
tagged with: java
has body: I have a java program in which I am using TTS (Text to speech), in there along with that I want an animated gif to come up on the screen. I am using Netbeans GUI builder, so I made up a new jpanel form and added the gif in a label in that form (java jpanel form), and after that I added this java as a jpanel to my main java file (by dragging and dropping). But the problem is that as soon as the TTS, starts to speak something it stops the animation of the gif. How to make it work together? Note: I am using freeTTS for converting text to speech Code: private static final String VOICENAME = "kevin16"; VoiceManager voiceManager = VoiceManager.getInstance(); ..... ........ Voice voice; voice = voiceManager.getVoice(VOICENAME); voice.allocate(); ....//Some code here t4.setText("" + ran); voice.speak(t4.getText()); listenanum.setText("" + d); listenanum.setVisible(false);
linked to: http://stackoverflow.com/q/5544447
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36433481
linked to: http://stackoverflow.com/q/19167154
has title: Multiple threads not working simultaneously
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36433282
has comment: http://stackoverflow.com/comment/36433544

http://stackoverflow.com/a/23702037
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23701688
accepted answer of: http://stackoverflow.com/q/23701688
type: AcceptedAnswer
downvote count: 0
has body: You describe your issue pretty vaguely. In principle, Swing isn't all that well suited for animation - speed isn't the principal problem - rather its the lack of a possibility to control when exactly the graphics are updated on screen. Swing does not synchronize rendering with screen refresh. While it does double buffer (by default), it can (and does) still happen that the graphics are refreshed while the screen is displayed, displaying (for example) in the top half of the component frame N, while frame N+1 in the lower half (because the frame update happened while the screen refresh was somewhere in the middle of the screen). The only solution I know of is switching to full screen mode (http://docs.oracle.com/javase/tutorial/extra/fullscreen/), where rendering may be beam synchronized. There is no solution for windowed display (to my knowledge).

http://stackoverflow.com/comment/50948798
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24419696
has text: Anyone found the solution to this problem? I'm struggling with this too
type: AnswerComment

http://stackoverflow.com/a/23643775
has body: This is not the best choice. new Thread() { public void run() { new DataTrak().runOnUiThread(new Runnable() { public void run() { Looper.prepare();//This is not the best choice. new DataTrak().updateTotal(totalAmount,transactionType); } }); } }.start(); I recommend use AsyncTask, like this. class SampleTask extends AsyncTask&lt;Boolean, Boolean, Boolean&gt; { private int totalAmount; private yourActivity activity; //passing parameters public void SampleTask(yourActivity activity){ this.activity = activity; } @Override protected Boolean doInBackground(Boolean... params) { while (totalAmount &lt; 10){ totalAmount++; } } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); // this is not the best choice // because you are creating two instances. new DataTrak().updateTotal(totalAmount,transactionType); //If you pass a parameter, this for me is the best option. activity.updateTotal(totalAmount,transactionType); } }
type: Answer
answers question: http://stackoverflow.com/q/23643604
score: 0
has comment: http://stackoverflow.com/comment/36310882
has comment: http://stackoverflow.com/comment/36310943

http://stackoverflow.com/q/23655348
has body: Im trying to do game in Java: Sudoku. I have some problems with layout. It's in main class. GroupLayout layout = new GroupLayout(getContentPane()); GroupLayout layout2 = new GroupLayout(getContentPane()); public void ustawLayout1() { this.getContentPane().setLayout(layout); this.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(etykieta) .addComponent(latwy) .addComponent(sredni) .addComponent(trudny) .addComponent(start,0,0,450) ) .addContainerGap(0, 0) ); layout.setVerticalGroup( layout.createSequentialGroup() .addComponent(etykieta) .addComponent(latwy) .addComponent(sredni) .addComponent(trudny) .addContainerGap(0,Short.MAX_VALUE) .addComponent(start) ); } public void ustawLayout2() { this.getContentPane().setLayout(layout2); layout2.setAutoCreateGaps(true); layout2.setAutoCreateContainerGaps(true); layout2.setHorizontalGroup( layout2.createSequentialGroup() .addComponent(etykieta2) .addComponent(zakoncz,0,0,450) .addContainerGap(0, 0) ); layout2.setVerticalGroup( layout2.createSequentialGroup() .addComponent(etykieta2) .addContainerGap(0,Short.MAX_VALUE) .addComponent(zakoncz) ); } It's not working and i don't know why. I would like to do that when i press button "start" layout is changing to layout2.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23655547
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36332719
tagged with: swing
has comment: http://stackoverflow.com/comment/36333296
tagged with: java
tagged with: grouplayout
type: Question
has title: Java Dynamic Layout
tagged with: layout

http://stackoverflow.com/comment/36474925
comment on: http://stackoverflow.com/a/23728248
score: 0
type: Comment
has text: Thanks Matiash, I updated the code above. There are no more errors but when I try to open the page the app crashes :( Any other ideas? Thanks for the help.
type: AnswerComment

java-web-start
tags question: http://stackoverflow.com/q/23750594
tags question: http://stackoverflow.com/q/23664552
type: Tag
tags question: http://stackoverflow.com/q/23669931
tags question: http://stackoverflow.com/q/23694052
tag name: java-web-start

http://stackoverflow.com/comment/36603272
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23624228
has text: @Tilman Seems like printred paper direction of rotation depends on printer determines.Thank for your help.
score: 0

http://stackoverflow.com/comment/38154852
type: Comment
type: QuestionComment
has text: @Giorgio I haven't found a solution unfortunately. There is a [jira issue](https://javafx-jira.kenai.com/browse/RT-18492) for this problem dating back to december 2011. Getting this to work would most likely involve changing or forking the core API for the tableview. I don't see this being implemented into the official jre anytime soon.
comment on: http://stackoverflow.com/q/23632884
score: 1

http://stackoverflow.com/q/23771719
has comment: http://stackoverflow.com/comment/36561343
has answer: http://stackoverflow.com/a/23783116
score: 0
favorite count: 0
has body: I have a webservice that fails for apparently no reason. Sometimes it executes and sometimes it provides this error which i can't seem to figure out since the query actually makes sense... java.lang.IllegalArgumentException: You have attempted to set a value of type class org.models.Employees for parameter currentEmployeeID with expected type of class org.models.Employees from query string SELECT b.carID FROM Cars b WHERE b.currentEmployeeID = :currentEmployeeID . at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:932) In the typed query, Employees emp = new Employees(1) TypedQuery&lt;Integer&gt; query = em.createQuery("SELECT b.carID FROM Cars b WHERE b.currentEmployeeID = :currentEmployeeID", Integer.class); query.setParameter("currentEmployeeID",emp); As i said sometimes it works. It fails continuously sometimes when i restart the service. If i said the currentEmployeeID as integer and not object employee it will provide a more clear error which i understand why..(something like, i am attempting to set value of type integer for parameter.......)
type: UnansweredQuestion
has title: JPA failing (java.lang.IllegalArgumentException)
upvote count: 1
has comment: http://stackoverflow.com/comment/36568581
has answer: http://stackoverflow.com/a/23783314
tagged with: java
has comment: http://stackoverflow.com/comment/36568022
downvote count: 1
type: Question
answer count: 2
tagged with: jpa

http://stackoverflow.com/comment/36261599
comment on: http://stackoverflow.com/q/23618298
score: 0
has text: @Luiggi Mendoza I forgot consider about rule of "Two methods have the same signature if they have the same name and argument types." Thanks
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23751016
tagged with: private-class
tagged with: methods
type: Question
has body: in a project i am trying to get two or more agents to communicate between each other to collect things in the environment. to do this i am using a mailbox containing messages that they would respond to depending on the messages sent ebtween each other. below is where i create the linked list mailbox = new LinkedList[numberOfAgents()]; for ( int i=0; i&lt; numberOfAgents(); i++ ){ mailbox[i] = new LinkedList&lt;Message&gt;(); mailbox[i].add(new Message(i, knownBloodBanks, knownDonors)); } and then the private message and intention classes private class Message { // instance variables private int senderId; private BoardComponentList donors; private BoardComponentList bloodBanks; private BoardComponent requestAssistanceAt; private Intention iIntendToAssistAt; public Message( int senderId, BoardComponentList d, BoardComponentList b ) { this.senderId = senderId; donors = d; bloodBanks = b; } // end constructor public void setIntentions( Intention intention ) { iIntendToAssistAt = intention; } public void setRequest( BoardComponent bC ) { requestAssistanceAt = bC; } public BoardComponentList getDonors() { return donors; } public BoardComponentList getBloodBanks() { return bloodBanks; } public Intention getIntentions() { return iIntendToAssistAt; } public BoardComponent getRequest() { return requestAssistanceAt; } public int getSenderId() { return senderId; } } // end Message class private class Intention { // instance variables private BoardComponent target; private double distanceTo; public Intention( BoardComponent bC, double distance ) { target = bC; distanceTo = distance; } // end constructor public BoardComponent getTarget() { return target; } public double getDistancetoTarget() { return distanceTo; } } i cant for the life of me figure out how to access the methods inside the private class so that i can set goals and see the messages between agents. any help or pointers in the right direction would be greatly appreciated, i hope i've included enough info if not pleas…
score: 0
has answer: http://stackoverflow.com/a/23751173
accepted answer: http://stackoverflow.com/a/23751173
answer count: 1
has title: accessing elements of a linked list that is made up of a private custom class
has comment: http://stackoverflow.com/comment/36515798
type: AnsweredQuestion
tagged with: linked-list
tagged with: java

http://stackoverflow.com/q/23750834
has comment: http://stackoverflow.com/comment/36515502
tagged with: java
has answer: http://stackoverflow.com/a/23750930
tagged with: mysql
type: Question
has body: My intention is to try out SQL Rollback with the program exit halfway without finishing.I had the following connection in my program. However data still written to the database even when I did not set any con.commit upon exiting halfway. I did a debug mode, it fall into the exception and execute the con.rollback(); but in which is did not rollback. Which made me quite confuse. con = DriverManager.getConnection(value); con.setAutoCommit(false); try{ pstmt = con.prepareStatement("CREATE TABLE IF NOT EXISTS Test (Number varchar(255))") pstmt.execute(); pstmt = con.prepareStatement("INSERT INTO `Test` (Number) values (?)"); pstmt.setString(1,"1"); pstmt.executeUpdate(); }catch(Exception){ con.rollback(); }
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/36515437
answer count: 1
has title: SQL JDBC java commits when auto-commit is off
has comment: http://stackoverflow.com/comment/36515404
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/q/23645088
has title: Handling many requests in the same time
tagged with: mysql
has answer: http://stackoverflow.com/a/23645148
type: Question
has comment: http://stackoverflow.com/comment/36313051
accepted answer: http://stackoverflow.com/a/23645148
answer count: 1
has comment: http://stackoverflow.com/comment/36315792
has comment: http://stackoverflow.com/comment/36320156
has body: I have a table Users in MySQL includes 3 fields : ID (int), Name (varchar) and UpdateTime (TimeStamp). I have a java web application and one function to get one record in table Users, after that, check if UpdateTime is before current time ---> update UpdateTime by current time plus 2 hours. And my problem is when having about 100 users access to my app and request to that function to get the same record in the same time, all of them will update UpdateTime. But I want only first user update UpdateTime, latecomers will only get data without update UpdateTime. How I can do it? I really have no idea. Thanks. P/s: Sorry about my English, it seems to be not good :(
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/36313867
tagged with: java

http://stackoverflow.com/q/23769915
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23770646
tagged with: android
has body: Let's say you're designing the threading architecture for a an app -> the primary purpose is that your app will have a lot of tasks that need something done on the background thread, and sometimes a result task on UI thread, or something not (though more times, the result needs to be run on UI thread). For simplicity, let's say the tasks will be stuff like: download a file and display a pop-up, log a user in and go to a different page, process an image and store the result in a database (popular tasks that a lot of apps do) I've researched a lot about the nuances, but would really like a deep-dive explanation/knowledge on what kind of architecture is better, and what are the considerations. here are the three models in consideration: AsyncTask model: each operation (like downloading a file and displaying a pop-up) is an AsyncTask, or some derivative of a parent class that abstracts out the common functionalities. Thread/handler model: i always create a new Handler(Looper.getMainLooper()); and each time i need to do a task, i use a thread factory to spin off the task, with the handler on UI thread (or whatever custom handler). Service/Thread model: i use a general Service class that is in charge of operations based on some operation code. there's a bunch of ServiceTask derivative objects that do certain things, but the Service class communicates with each ServiceTask when tasks are started/done. I'm slightly leaning towards going the whole service/threading model, just because i've read some really awkward nuances with AsyncTask/Threads: AsyncTask has a private static handler, and if the classloader calls it at the wrong time (such as including a library that uses it before your application does) then all of your onPostExecute will happen at the wrong time since your handler was not the main handler it's easy to forget to check a bunch of things in the onPostExecute such as if there was a config change, or your activity was destroyed, or application was backgrounded/…
answer count: 4
tagged with: service
tagged with: android-asynctask
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23770823
tagged with: multithreading
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25385139
has title: Android robust threading Architecture? Asynctask vs thread/handler vs service/thread
has answer: http://stackoverflow.com/a/23770541

http://stackoverflow.com/comment/36261553
score: 0
has text: I think that this mismatching is the cause of your problem
comment on: http://stackoverflow.com/q/23618232
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23701339
type: Question
answer count: 2
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23702710
tagged with: wav
has body: What I'm trying to do is generate 10 second snippets from audio files and convert them to WAV in the process. I'm using the javazoom vorbisspi and mp3spi libraries. It's working for mp3 and WAV files, but not for .ogg files. I tried listing the available target formats for the encoding I want (PCM signed) and weirdly, for mp3 files the list of available formats is empty (although it works) and the list for ogg files diplays the PCM encoding I want (although it doesn't work). Playing back .ogg files works, though. Here is my code: AudioInputStream in = null; AudioInputStream din = null; AudioFileFormat fileFormat = null; AudioFormat format = null; fileFormat = AudioSystem.getAudioFileFormat(input); in = AudioSystem.getAudioInputStream(input); format = in.getFormat(); float frameRate = 44100; int channels = format.getChannels(); AudioFormat targetFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, frameRate, 16, channels, channels*2, frameRate, false ); AudioFormat[] available = AudioSystem.getTargetFormats( AudioFormat.Encoding.PCM_SIGNED, format); System.out.println("------------------------------------"); System.out.println("Available for: " + format.toString()); for (AudioFormat e : available) { System.out.println(e.toString()); } if (AudioSystem.isConversionSupported(targetFormat, format)) { din = AudioSystem.getAudioInputStream(targetFormat, in); long frames = this.thumbNailLength * (long)frameRate; AudioInputStream shortenedStream = new AudioInputStream( din, targetFormat, frames); AudioSystem.write(shortenedStream, new AudioFileFormat.Type("WAVE", "wav"), outputFile); } else { throw new IllegalArgumentException( "Conversion to WAV from this format is not supported by the System."); } The output for an .ogg file: [java] Available for: VORBISENC 44100.0 Hz, unknown bits per sample, stereo, unknown frame size, unknown frame rate, [java] PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian [java] PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes…
tagged with: vorbis
tagged with: ogg
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/23702710
tagged with: audio
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23701818
has answer: http://stackoverflow.com/a/23701818
tagged with: java
has title: Converting ogg to wav doesn't work although listed as available format

http://stackoverflow.com/q/23633189
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23868275
tagged with: java
has comment: http://stackoverflow.com/comment/36735872
score: 4
type: Question
upvote count: 4
has body: While using Youtube API samples for Java for uploading a file to youtube, I get this: Error at line: Video returnedVideo = videoInsert.execute(); Error Stack com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error { "code" : 500, "message" : null } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.omp.util.YoutubeUtil.uploadVideo(YoutubeUtil.java:141) A related issue is already raised here: https://code.google.com/p/gdata-issues/issues/detail?id=6352
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36710692
has title: 500 Internal Server Error v3 Upload API: GoogleJsonResponseException
favorite count: 0
accepted answer: http://stackoverflow.com/a/23868275
tagged with: google-api
tagged with: youtube-api

http://stackoverflow.com/q/23639825
tagged with: equals
has comment: http://stackoverflow.com/comment/36302762
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36302553
answer count: 4
has answer: http://stackoverflow.com/a/23641175
tagged with: hashcode
score: 1
linked to: http://stackoverflow.com/q/5082227
tagged with: java
has answer: http://stackoverflow.com/a/23640035
upvote count: 1
tagged with: collections
has answer: http://stackoverflow.com/a/23640837
type: Question
tagged with: hashmap
has body: I am getting confused with one concept. Can someone please throw some light on it. Question: If the key of Hashmap is Immutable Object(create by developer) then do we need to override hashcode() and equals()? Or having immutable field as key solves the problem of overriding hashcode() and equals()? Thanks.
has title: Java Collections: IF the key of Hashmap is Immutable Object then do we need to override hashcode and equals?
downvote count: 0
has answer: http://stackoverflow.com/a/23639889
favorite count: 0

http://stackoverflow.com/q/23719979
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36456884
has comment: http://stackoverflow.com/comment/36457149
tagged with: java
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/36456968
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/36523836
has body: I've create a jFrame in which I've put a button to get me information from a database to fill JTalble. I've added a mouse click event to set the value of the selected row in a jTextField. The problem is the value stays the same. Here's my code: try { int row = jTable4.getSelectedRow(); String str = (jTable4.getModel().getValueAt(row, 0).toString()); String query = "select idclient from client where idclient = '"+str+"' "; rs =(ResultSet) pst.executeQuery(); if(rs.next()){ String str4 = rs.getString("idclient"); jTextField1.setText(str4); } } catch (SQLException e) { Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, e); }
has comment: http://stackoverflow.com/comment/36457096
downvote count: 1
has comment: http://stackoverflow.com/comment/36457325
has title: Why is the value of the selected row stays the same in textfield?
has comment: http://stackoverflow.com/comment/36456981

http://stackoverflow.com/q/23651659
has title: Insert data from applet textfield to mysql database - error
score: 0
tagged with: applet
type: UnansweredQuestion
has body: What I am trying to do is to add data on mysql database using my applet page. my idea is to fill up the textfields then when i hit the save button all the text's will add to mySQL database. But i'm having an error saying Access Denied: java.security.AccessControlException:access denied (java.io.FilePermision "\C:\Program Files(x86)\MySQL\mysql-connector-java-5.1.30\mysql-connector-java-5.1.30-bin.jar‌​" "read") thank you in advance. here's my code: :(( import java.awt.*; import java.applet.*; import java.awt.event.*; import javax.swing.*; import javax.swing.SwingUtilities; import javax.swing.JApplet; import java.sql.*; import java.net.*; public class AddBook extends JApplet { JButton btnSave, btnCancel; JLabel lblIsbn, lblTitle, lblCategory, lblAuthor, lblYPublish, lblPublisher, lblCopies, lblYear, lblMsg1; JTextField txtTitle, txtCategory; JTextField txtIsbn, txtAuthor, txtPublisher, txtCopies, txtYear; String ttitle, tauthor, tpublisher, tcategory, tisbn, tyear, tqty; public void init() { Font fonttxt = new Font("Calibri", Font.PLAIN, 16); Font fontlbl = new Font("Calibri",Font.BOLD, 14); Font fontbtn = new Font("Calibri",Font.BOLD, 16); Font fontTitle = new Font("Arial ",Font.BOLD,30); setLayout(null); setSize(410, 400); setBackground(Color.gray); btnSave = new JButton("Save"); btnSave.setFont(fontbtn); btnCancel = new JButton("Cancel"); btnCancel.setFont(fontbtn); lblMsg1 = new JLabel ("ADD BOOK"); lblMsg1.setFont(fontbtn); lblIsbn = new JLabel("ISBN :"); lblIsbn.setFont(fontlbl); lblTitle = new JLabel ("Title :"); lblTitle.setFont(fontlbl); lblCategory = new JLabel ("Category :"); lblCategory.setFont(fontlbl); lblAuthor = new JLabel ("Author :"); lblAuthor.setFont(fontlbl); lblYear = new JLabel ("Year Published :"); lblYear.setFont(fontlbl); lblPublisher = new JLabel ("Publisher :"); lblPublisher.setFont(fontlbl); lblCopies = new JLabel ("Number of Copies :"); lblCopies.setFont(fontlbl); JTextField txtIsbn = new JTextField ("",100); txtIsbn.setFont(fonttxt); JT…
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36326154
has answer: http://stackoverflow.com/a/23653705
answer count: 2
has comment: http://stackoverflow.com/comment/36326502
has answer: http://stackoverflow.com/a/23653915

http://stackoverflow.com/q/23623594
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: -1
has title: Server side URL Encoding
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36271031
tagged with: javascript
tagged with: servlets
upvote count: 0
answer count: 1
has body: How can we Sanitize, via URL/HTML encoding, potentially danger characters &amp; (&lt; > “ ; /) in the server side, i am using encodeURI() and escape() in jsp page to encode on client side and i used URLEncoder.encode() in my java file to handel server side but it not encoding.
has answer: http://stackoverflow.com/a/23623789
favorite count: 0

http://stackoverflow.com/a/23674899
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36376325
upvote count: 1
answers question: http://stackoverflow.com/q/23673180
has body: Here is an example of what you are looking for Tree Class public class Tree { private String description = null; private ArrayList&lt;Tree&gt; treeList = new ArrayList&lt;Tree&gt;(); private HashMap&lt;Integer,Tree&gt; childrenTreeList = new HashMap&lt;Integer,Tree&gt;(); private int value = 0; public Tree(String description, int value) { this.description = description; this.value = value; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public void addChildTree(Tree childTree, int value) { this.childrenTreeList.put(value, childTree); } public void addTree(Tree tree) { this.treeList.add(tree); } public ArrayList&lt;Tree&gt; getTreeList() { return treeList; } public HashMap&lt;Integer, Tree&gt; getChildrenTreeList() { return childrenTreeList; } } Main Test public class TreeRunner { public static void main(String[] args) { Tree root = new Tree("Root", 1); // Child B Tree treeB = new Tree("SubPart1", 1); treeB.addChildTree(new Tree("SubPart1", 1),1); treeB.addChildTree(new Tree("SubPart1", 2),2); root.addTree(treeB); root.addChildTree(new Tree("Root", 1),1); root.addChildTree(new Tree("Root", 2),2); root.addChildTree(new Tree("Root", 3),3); root.addChildTree(new Tree("Root", 4),4); // Child D Tree treeD = new Tree("SubPart2", 2); treeD.addChildTree(new Tree("SubPart2", 1),1); treeD.addChildTree(new Tree("SubPart2", 2),2); treeD.addChildTree(new Tree("SubPart2", 3),3); root.addTree(treeD); // Child D Tree treeE = new Tree("SubPart3", 3); treeE.addChildTree(new Tree("SubPart3", 1),1); root.addTree(treeE); System.out.println(String.format("Root[Description: %s]",root.getDescription())); for (Map.Entry&lt;Integer, Tree&gt; treeEntry : root.getChildrenTreeList().entrySet()) { System.out.println(String.format("-------- Description: %s %d.%d and Value %d.%d",root.getDescription(),root.getValu…
has comment: http://stackoverflow.com/comment/36375116
type: Answer

http://stackoverflow.com/q/23648365
type: Question
tagged with: multicastsocket
has body: I have an app which continuously sends data in multicast socket after joining to a specific IP group. After sending packets for few hours, all of a sudden it stops sending data. From java socket send is successfull but there is no packet info in tcpdump as well as network packet capture. I have debugged till datagramsocketimpl class, there doesn't seems to have any problem. Suspecting the problem some where after that. Has anyone seen this issue? The data packet just doesn't reach wifi driver. The issue happens randomly no specific procedure.
downvote count: 0
tagged with: tcpdump
tagged with: android-wifi
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android multicastsocket send is dropping packets
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/36342439
has text: And bear in mind, even for English literals in patterns can be necessary, for example to print "1st of May".
comment on: http://stackoverflow.com/q/23635320
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36377852
type: Comment
type: QuestionComment
has text: The questions you're asking don't really make much sense. What exactly is your end goal? It doesn't make sense for Processing to "own" a class named Pikachu. If all you're doing is manipulating images, you don't need Processing at all. What **specifically** are you trying to do? Why do you need Processing to do it?
comment on: http://stackoverflow.com/q/23655225
score: 0

http://stackoverflow.com/q/23713392
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36443506
has comment: http://stackoverflow.com/comment/36443857
has body: I have this calculator working, but I can't figure out how to get the value in the resultpane to the first textbox when you click the "finish" button. I'm new to Java. I've tried doing it, but I kept getting an error. import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.NumberFormat; import javax.swing.AbstractAction; import static javax.swing.Action.NAME; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestCalculator { public static void main(String[] args) { new TestCalculator(); } public TestCalculator() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } ResultPane resultPane = new ResultPane(); JFrame frame = new JFrame("Testing"); frame.setGlassPane(resultPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new CalculatorPane(resultPane)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class ResultPane extends JPanel { private JLabel result; private Timer timer; private int xDelta = (Math.random() &gt; 0.5) ? 1 : -1; private int yDelta = (Math.random() &gt; 0.5) ? 1 : -1; ; public ResultPane() { setOpaque(false); setLayout(null); result = new JLabel(); Font font = result.getFont(); font = font.deriveFont(Font.BOLD, 26f); result.setFont(font); add(result); timer = new Timer(40, new ActionListener() { @Override public void actionPerformed(Ac…
answer count: 2
downvote count: 0
tagged with: calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/36443523
has answer: http://stackoverflow.com/a/23718319
has answer: http://stackoverflow.com/a/23713680
has title: How to transfer a value from one JLabel to another?
has comment: http://stackoverflow.com/comment/36452885
has comment: http://stackoverflow.com/comment/36452914
has comment: http://stackoverflow.com/comment/36443453
has comment: http://stackoverflow.com/comment/36443880
tagged with: jlabel
upvote count: 3
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/36452842
type: Question

http://stackoverflow.com/comment/36494567
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23739696
has text: If you have putty, the equivalent is to select 'Dynamic' when setting up a port forward
score: 0

http://stackoverflow.com/q/23688094
type: AnsweredQuestion
tagged with: tcp
tagged with: java
type: Question
has body: I am new to socket programming in java so facing a problem seems not difficult but unable to solve due to unfamiliarity. Following are codes for Client and Server. Server Code: public class connectionServer { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String clientSentence; String capitalizedSentence; BufferedReader inFromClient; DataOutputStream outToClient; BufferedReader inFromUser; try { ServerSocket welcomeSocket = new ServerSocket(70); Socket connectionSocket; connectionSocket = welcomeSocket.accept(); System.out.println("Connection accepted for " + connectionSocket.getInetAddress() + ": " + connectionSocket.getPort()); InputStreamReader input = new InputStreamReader(connectionSocket.getInputStream()); inFromClient = new BufferedReader(input); while (true) { if(input.ready()) { clientSentence = inFromClient.readLine(); System.out.println(clientSentence); } String tempString = "FROM SERVER: What's problem......"; try { Thread.currentThread().sleep(1000); } catch(Exception e) { System.out.println(e); } outToClient = new DataOutputStream(connectionSocket.getOutputStream()); if(outToClient != null) { outToClient.writeBytes(tempString + "\n"); outToClient.flush(); } } } catch (IOException e) { System.out.println(e); e.printStackTrace(); } } } Client Code: public class connectionClient { static Socket clientSocket = null; ////////////////////////////////////////// ////////////////////////////////////////// /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String sentence; String modifiedSentence; attachShutDownHook(); try { clientSocket = new Socket("127.0.0.1", 70); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());; BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); outToServer.writeBytes("FROM CLIENT 2: Hello \n\n"); while(…
has answer: http://stackoverflow.com/a/23689527
accepted answer: http://stackoverflow.com/a/23689527
score: 0
has title: Facing exception on closing client in Java
answer count: 1
tagged with: sockets

class
tags question: http://stackoverflow.com/q/23643384
tags question: http://stackoverflow.com/q/23768737
tags question: http://stackoverflow.com/q/23707423
tags question: http://stackoverflow.com/q/23680503
tags question: http://stackoverflow.com/q/23736433
tags question: http://stackoverflow.com/q/23722373
tags question: http://stackoverflow.com/q/23755012
tags question: http://stackoverflow.com/q/23619744
tags question: http://stackoverflow.com/q/23661442
tags question: http://stackoverflow.com/q/23726260
tags question: http://stackoverflow.com/q/23682179
tags question: http://stackoverflow.com/q/23659645
tags question: http://stackoverflow.com/q/23675741
tags question: http://stackoverflow.com/q/23666606
tags question: http://stackoverflow.com/q/23695683
tags question: http://stackoverflow.com/q/23730990
tags question: http://stackoverflow.com/q/23736136
tags question: http://stackoverflow.com/q/23705140
tags question: http://stackoverflow.com/q/23737153
tags question: http://stackoverflow.com/q/23705083
tags question: http://stackoverflow.com/q/23735970
tags question: http://stackoverflow.com/q/23714486
tags question: http://stackoverflow.com/q/23775949
tags question: http://stackoverflow.com/q/23768527
tags question: http://stackoverflow.com/q/23698293
tags question: http://stackoverflow.com/q/23708507
tags question: http://stackoverflow.com/q/23739356
type: Tag
tags question: http://stackoverflow.com/q/23697869
tags question: http://stackoverflow.com/q/23743755
tags question: http://stackoverflow.com/q/23712808
tags question: http://stackoverflow.com/q/23764498
tags question: http://stackoverflow.com/q/23708726
tags question: http://stackoverflow.com/q/23730416
tags question: http://stackoverflow.com/q/23648841
tags question: http://stackoverflow.com/q/23717406
tags question: http://stackoverflow.com/q/23772828
tags question: http://stackoverflow.com/q/23743798
tag name: class
tags question: http://stackoverflow.com/q/23713262
tags question: http://stackoverflow.com/q/23715712
tags question: http://stackoverflow.com/q/23632094
tags question: http://stackoverflow.com/q/23675649
tags question: http://stackoverflow.com/q/23642623
tags question: http://stackoverflow.com/q/23646561
tags question: http://stackoverflow.com/q/23744943
tags question: http://stackoverflow.com/q/23751353
tags question: http://stackoverflow.com/q/23674236
tags question: http://stackoverflow.com/q/23645291
tags question: http://stackoverflow.com/q/23737074
tags question: http://stackoverflow.com/q/23743850
tags question: http://stackoverflow.com/q/23722627
tags question: http://stackoverflow.com/q/23697161
tags question: http://stackoverflow.com/q/23712539

http://stackoverflow.com/a/23724534
has body: You are referring to the object itself not the array that is the field of object. Try this: resultMatrix[i][j] = m1.matice[i][j] + m2.matice[i][j]; instead of resultMatrix[i][j] = m1[i][j] + m2[i][j]; btw. I recommend to mark matrixAdd to static because it is a stateless, helper method or extract into a different class.
answers question: http://stackoverflow.com/q/23724495
type: Answer
accepted answer of: http://stackoverflow.com/q/23724495
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23770770
type: Question
has title: Java Spring Form: map one entity to another entity in JSP form
linked to: http://stackoverflow.com/q/706660
tagged with: jsp
has comment: http://stackoverflow.com/comment/36555256
score: 0
answer count: 1
tagged with: spring-form
type: UnansweredQuestion
tagged with: hibernate-mapping
tagged with: spring
has answer: http://stackoverflow.com/a/23771676
tagged with: java
has body: I have two entities: Country and Contact: @Entity @Table(name="countries") @NamedQuery(name="Country.findAll", query="SELECT c FROM Country c") public class Country implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String code; private String name; @OneToMany(mappedBy="countryBean") private List<Contact> contacts; //... } @Entity @Table(name="contacts") @NamedQuery(name="Contact.findAll", query="SELECT c FROM Contact c") public class Contact implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String city; private String street; @ManyToOne @JoinColumn(name="countries_id") private Country countryBean; //... } I need to add new contact and select existing country from database. There is part of my controller: @RequestMapping(value="/contact/add", method=RequestMethod.GET) public String contactAddGetPage(Model model) { Contact contact = new Contact(); model.addAttribute("contact", contact); List<Country> countries = countryManager.findAll(); model.addAttribute("countries", countries); return "contactAdd"; } @RequestMapping(value="/contact/add", method=RequestMethod.POST) public String contactAddSave( @Valid @ModelAttribute("contact") Contact contact, BindingResult result, Model model, final RedirectAttributes redirectAttributes) { if (result.hasErrors()) { model.addAttribute("error", "error"); return "contactAdd"; } contactManager.save(contact); redirectAttributes.addFlashAttribute("message", "ok"); return "redirect:/contact"; } And "contactAdd.jsp" JSP using Spring Form: <c:url var="sendToUrl" value="/contact/add" /> <form:form method="post" action="${sendToUrl}" commandName="contact"> <form:label path="street">Street</form:label> <form:input path="street"/> <form:errors path="street"></form:errors> <form:label path="city">City</form:label> <form:input path="city"/> <form:errors path="city"></form:errors> <form:label path="countryBean">Country</form:label> <form:se…

http://stackoverflow.com/comment/36463040
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23722599
has text: What about second question? Why sphere UV coordinate range is 2058x1036?
type: QuestionComment

http://stackoverflow.com/comment/36266659
type: Comment
has text: @Szymon Sure it is. 6-6-666, or 10-10-1010. Those are dates he is talking about.
type: AnswerComment
comment on: http://stackoverflow.com/a/23620785
score: 0

http://stackoverflow.com/comment/36283950
has text: Please define *compare two sets of genes by gene name*. What do you want to know about these sets? Your question is quite unclear.
comment on: http://stackoverflow.com/q/23630244
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36355221
type: QuestionComment
has text: ok i used your declaration and the problem is solved , thank you very much
comment on: http://stackoverflow.com/q/23666177
score: 0
type: Comment

http://stackoverflow.com/q/23721355
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23721435
has comment: http://stackoverflow.com/comment/36459055
has answer: http://stackoverflow.com/a/50214388
type: Question
has answer: http://stackoverflow.com/a/35235388
tagged with: casting
has answer: http://stackoverflow.com/a/23721435
upvote count: 6
favorite count: 0
answer count: 3
has body: An API I am using has a method that returns a Map&lt;String, Object&gt;, but I know the Object's are String's in this case, so I want it as a Map&lt;String, String&gt;. But for some reason I can't just cast it, Java says Map&lt;String, Object&gt; cannot be casted to Map&lt;String, String&gt;, for some reason. I used: Map&lt;String, Object&gt; tempMap = someApiMethodReturningAMap(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); for (String i : tempMap.keySet()) { map.put(i, String.valueOf(tempMap.get(i))); } as a workaround, but is there an easier way?
possible better answer: http://stackoverflow.com/a/35235388
has title: Easily convert Map<String, Object> to Map<String, String>
score: 6
tagged with: dictionary
type: AnsweredQuestion

http://stackoverflow.com/a/23638960
has body: It seems that the method: setVisibleRowCount(int) can't be used for JLists which are added to a JPanel which has set a Layoutmanager. I rebuild your application a bit, since I couldn't get it working by using a SpringLayout (I admit, I never used it before). But with the BorderLayout it is working fine. You just have to wrap the Scrollbar, which contains the JList into a foreign JPanel for which you don't define a Layoutmanager. I think the reason is that the Layoutmanager will layout it components according to the available space, hence the setVisisbleRowCount will be ignored! But remember, components may be displayed differntly by using another LayoutManager. I personally suggest you to use the BorderLayout for simple arrangement (North, south, ... ), FlowLayout for a series of parallel components and the GridbagLayout for advanced arangements. This should be sufficient for almost all applications. import java.awt.BorderLayout; import javax.swing.DefaultListModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class Ui2 extends JFrame { /** * */ private static final long serialVersionUID = 2464942276900547953L; private JLabel l1; private JPanel panel; private JScrollPane scrollpane; private JList&lt;String&gt; list; public Ui2() { super("HADOOP GUI"); panel = new JPanel(); panel.setLayout(new BorderLayout()); setContentPane(panel); panel.setSize(500, 500); DefaultListModel&lt;String&gt; listmodel = new DefaultListModel&lt;String&gt;(); for (int i = 1; i &lt;= 10; i++) { listmodel.addElement("Record" + i); } list = new JList&lt;String&gt;(listmodel); list.setVisibleRowCount(5); // here is problem list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollpane = new JScrollPane(list); JPanel p = new JPanel(); p.add(scrollpane); pane…
accepted answer of: http://stackoverflow.com/q/23638279
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23638279
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36301624

http://stackoverflow.com/comment/36460035
comment on: http://stackoverflow.com/q/23721160
score: 0
has text: There are other code what really matters is that it can't read the .xhtml , other than that it works fine
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36443476
comment on: http://stackoverflow.com/q/23711664
score: 0
type: Comment
type: QuestionComment
has text: problem is same similar thing is happening to my image

http://stackoverflow.com/a/23630786
has body: Your array won't do what you expect it to do. Think of the array like a 3D array, with each element a point. If you specify a single index, you're essentially telling the computer "OK, I want to assign "A1" to this slice of the array (in your example, you're trying to do something akin to String[][] elementAtI = "A1";). Now that doesn't make sense, does it? To get to a single element in the array, you have to specify all three indices, much like how in 3D space you have to specify all three coordinates to locate a point: School[3][4][5] = "A1"; What might be a better idea than a 3D array is objects. Packing everything into an array works, but that's not as readable as having a SchoolClass[], where each SchoolClass has a name and an array of Students, and each Student has an ID, name, etc.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23630668

http://stackoverflow.com/comment/36377221
type: QuestionComment
comment on: http://stackoverflow.com/q/23678198
has text: Ok fge, i will follow up. is there any way to achieve the output with the above code?
score: 0
type: Comment

http://stackoverflow.com/a/23684247
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36388870
has comment: http://stackoverflow.com/comment/36389161
has comment: http://stackoverflow.com/comment/36389300
has comment: http://stackoverflow.com/comment/36389206
type: Answer
has comment: http://stackoverflow.com/comment/36389274
accepted answer of: http://stackoverflow.com/q/23684220
has comment: http://stackoverflow.com/comment/36389064
answers question: http://stackoverflow.com/q/23684220
score: 5
has comment: http://stackoverflow.com/comment/36388982
upvote count: 5
has body: 1 and 0 are treat as literal int values here, and the result of this operation is an int, which cannot be narrowed by the compiler. You should add a cast explicitly: s = (short) ((i &lt; 100)? 1:0); This is explained in Java Language Specification. Chapter 15. Expressions. 15.25. Conditional Operator ?. The conditional operator has three operand expressions. ? appears between the first and second expressions, and : appears between the second and third expressions. (...) If both the second and the third operand expressions are numeric expressions, the conditional expression is a numeric conditional expression. (...) Numeric conditional expressions are standalone expressions (§15.2). The type of a numeric conditional expression is determined as follows: If the second and third operands have the same type, then that is the type of the conditional expression. If one of the second and third operands is of primitive type T, and the type of the other is the result of applying boxing conversion (§5.1.7) to T, then the type of the conditional expression is T. 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 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. Note that binary numeric promotion performs value set conversion (§5.1.13) and may perform unboxing con…
has comment: http://stackoverflow.com/comment/36388807

http://stackoverflow.com/q/23678620
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has body: I am trying to wrap my head around thread safety in java (or in general). I have this class (which I hope complies with the definition of a POJO) which also needs to be compatible with JPA providers: public class SomeClass { private Object timestampLock = new Object(); // are "volatile"s necessary? private volatile java.sql.Timestamp timestamp; private volatile String timestampTimeZoneName; private volatile BigDecimal someValue; public ZonedDateTime getTimestamp() { // is synchronisation necessary here? is this the correct usage? synchronized (timestampLock) { return ZonedDateTime.ofInstant(timestamp.toInstant(), ZoneId.of(timestampTimeZoneName)); } } public void setTimestamp(ZonedDateTime dateTime) { // is this the correct usage? synchronized (timestampLock) { this.timestamp = java.sql.Timestamp.from(dateTime.toInstant()); this.timestampTimeZoneName = dateTime.getZone().getId(); } } // is synchronisation required? public BigDecimal getSomeValue() { return someValue; } // is synchronisation required? public void setSomeValue(BigDecimal val) { someValue = val; } } As stated in the commented rows in the code, is it necessary to define timestamp and timestampTimeZoneName as volatile and are the synchronized blocks used as they should be? Or should I use only the synchronized blocks and not define timestamp and timestampTimeZoneName as volatile? A timestampTimeZoneName of a timestamp should not be erroneously matched with another timestamp's. This link says Reads and writes are atomic for all variables declared volatile (including long and double variables) Should I understand that accesses to someValue in this code through the setter/getter are thread safe thanks to volatile definitions? If so, is there a better (I do not know what "better" might mean here) way to accomplish this?
type: Question
has answer: http://stackoverflow.com/a/23709834
score: 4
tagged with: synchronized
upvote count: 4
has answer: http://stackoverflow.com/a/23678846
has comment: http://stackoverflow.com/comment/36379156
answer count: 3
has comment: http://stackoverflow.com/comment/36378149
tagged with: volatile
downvote count: 0
accepted answer: http://stackoverflow.com/a/23678846
possible better answer: http://stackoverflow.com/a/23681341
favorite count: 0
has answer: http://stackoverflow.com/a/23681341
linked to: http://stackoverflow.com/q/11459543
has comment: http://stackoverflow.com/comment/36380054
has title: Proper use of volatile variables and synchronized blocks
has comment: http://stackoverflow.com/comment/36378214

http://stackoverflow.com/comment/36427539
type: QuestionComment
comment on: http://stackoverflow.com/q/23704602
score: 1
type: Comment
has text: Note that if you let your IDE format your code, that sort of thing is usually clearly visible.

http://stackoverflow.com/comment/36473762
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23728632
has text: Why not make a second batch file that just starts it?

http://stackoverflow.com/comment/36309352
comment on: http://stackoverflow.com/a/23639890
type: Comment
has text: i added the stacktrace, you can see it now
type: AnswerComment
score: 0

http://stackoverflow.com/a/23714690
upvote count: 3
answers question: http://stackoverflow.com/q/23714440
type: Answer
has body: You should use a CardLayout to swap views (JPanels) in your GUI. To get a fade effect is not the most simple thing to do, but it can be done with a little work. I've done it successfully here where I create a special class called SwappingImgPanel that extends JPanel, and that fades one image into another using a Swing Timer. Specifically, the program does this: The program adds all the swapping components to the CardLayout using JPanel. It also adds a single SwappingImgPanel, a JPanel created to draw two images, one of the component that is fading out, and one of the component that is fading in. When you swap components, you create images of the two components, the one currently visible, and the one that will next be visible. You send the images to the SwappingImgPanel instance You call swap() on the SwappingImgPanel instance. The SwappingImgPanel will then draw both images but uses a Swing Timer to change the Graphic object's composite value. This is what causes an image to be partially visible. When the SwappingImgPanel's Timer is done, a done() method is called which sets the SwappingImgPanel's State to State.DONE. The main GUI is listening to the SwappingImgPanel's state value, and when it achieves State.DONE, the main GUI shows the actual next component (and not an image of it).
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23714440

http://stackoverflow.com/comment/52295989
has text: This sounds great. Do you know a sample for it. A look on the API doc does not give a hint for beginning,.
comment on: http://stackoverflow.com/a/32135091
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23648558
has answer: http://stackoverflow.com/a/23649752
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36343334
downvote count: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23666741
accepted answer: http://stackoverflow.com/a/23666741
has body: I'm looking for a simple way to implement proximity search in java. By Proximity search I mean how it is defined by Lucene: Lucene supports finding words are a within a specific distance away. To do a proximity search use the tilde, "~", symbol at the end of a Phrase. For example to search for a "apache" and "jakarta" within 10 words of each other in a document use the search: "jakarta apache"~10 More specifically: as a start I would like to implement a method of the following form: public static boolean proximityMatches(String txt, String term1, String term2, int wordDistance) { // for the inputs: // txt= "this is a really foo barred world", term1="foo", term2="world", wordDistance=4 // return true // for the inputs: // txt= "this is a really foo barred world", term1="this", term2="bar", wordDistance=1 // return false } Notes: I know how to write a function to satisfy the requirements I've put up there -- what I'm looking for is an accepted standard way to implement this. Thanks.
possible better answer: http://stackoverflow.com/a/23649752
upvote count: 2
tagged with: full-text-search
favorite count: 0
has comment: http://stackoverflow.com/comment/36324392
tagged with: regex
has title: Implementing Proximity Text Search in Java

http://stackoverflow.com/comment/36390384
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23685054
has text: @LuiggiMendoza what do you mean by reversing?
score: 0

http://stackoverflow.com/comment/95953973
score: 1
comment on: http://stackoverflow.com/a/23721843
type: Comment
has text: It's a pity that `equals` is listed under the Abstract Methods tab when it's not really an abstract method.
type: AnswerComment

http://stackoverflow.com/comment/36355879
type: AnswerComment
comment on: http://stackoverflow.com/a/23666855
type: Comment
has text: keypressed is called everytime a key is pressed. removing the velx=0 will ensure that you dont overwrite the actions of another key (as long as it doesnt change the same global variable).
score: 0

http://stackoverflow.com/q/23643898
score: 14
tagged with: model-view-controller
type: AnsweredQuestion
upvote count: 14
tagged with: java
tagged with: javafx
type: Question
possible better answer: http://stackoverflow.com/a/23645859
has answer: http://stackoverflow.com/a/23644018
has answer: http://stackoverflow.com/a/23645859
has comment: http://stackoverflow.com/comment/36311301
tagged with: arraylist
answer count: 2
has body: I am attempting a study of JavaFX because I want to use it as the GUI of my program. My question is essentially a conceptual one: To date my program is mostly the "Model" part of the MVC pattern; that is, almost all of my code is the OO-representation of abstractions in the sense of classes, and all of that code is logical code. Since I do not want to be the only user of my program, I want to add the "View" part of MVC so that people can easily use and manipulate the "Model" part of my program. For this, I want to use JavaFX. In my "Model" classes I obviously use various Lists, Maps, and other classes from the Java Collections API. In order to let the users of my program manipulate these underlying Lists and Maps I want to use the Observable(List/Map) interfaces in JavaFX. A concrete example to bring clarity to the situation: Let's say that I have a MachineMonitor class that every 3 minutes checks certain properties of a Machine, such as if the connection is still good, the speed that the gears are turning, etc. If certain inequalities are met (say that the speed of the gears has fallen to a rate of 1 turn/sec) the MachineMonitor fires a RestartMachineEvent. Currently I use an ArrayList&lt;MachineMonitor> to keep track of all of the individual MachineMonitor's. Now extending to the "View" part of MVC, I want the User to be able to manipulate a TableView that displays the list of MachineMonitors so that they can, for instance, create and remove new MachineMonitor's to monitor various Machines. So that I can keep track of what the user of my program wants to do (say, create a MachineMonitor for Machine #5 that checks to see if the turn/sec of the gears falls below 0.5) I use an ObservableList&lt;MachineMonitor> as the underlying List for the TableView. The easiest way to link the "Model" and "View" of my program would simply be to change the "Model" class to have an ObservableList&lt;MachineMonitor> and not an ArrayList&lt;MachineMonitor> but (getting to the topic of …
downvote count: 0
has title: Does the use of ObservableList in JavaFX go against Model-View-Controller separation?
accepted answer: http://stackoverflow.com/a/23644018
favorite count: 0
has comment: http://stackoverflow.com/comment/46364404
tagged with: observablelist

http://stackoverflow.com/a/23673666
has comment: http://stackoverflow.com/comment/36368406
type: Answer
answers question: http://stackoverflow.com/q/23672720
has body: That's obvious Light or LightDim class extends Element. But elements is List of &lt;T&gt;. So, you can type cast like:- case LIGHT: elements.add((T) new Light()); break; case LIGHTDIM: elements.add((T) new LightDim()); break; or you can use List &lt;? super Element&gt; or if you know Objects to be added are Element. Can be specific like List&lt;Element&gt;
score: 0

http://stackoverflow.com/comment/36385623
type: Comment
comment on: http://stackoverflow.com/q/23681822
type: QuestionComment
has text: Yes I do. I'm not sure how debugging should actually go with so many threads, however I did just notice a couple of things: the result from the sosQuery.test(oid) method is returning before any sosQuery breakpoint gets hit, and the result String is null there. The next breakpoint that gets hit is the callback onSuccess. So the onSuccess is getting called before it's done? After those breakpoints get hit several times, then my actual SosQuery.test breakpoints start getting hit. Hmm...
score: 0

http://stackoverflow.com/comment/36484387
score: 0
type: AnswerComment
has text: @user253296 hold the windows key then click the `test`
type: Comment
comment on: http://stackoverflow.com/a/23734538

http://stackoverflow.com/q/23759620
downvote count: 0
answer count: 1
tagged with: aop
favorite count: 0
has body: Is it possible to use same aspect method for multiple pointcuts but with different parameters given from xml? Something like this(1 and 2 are parameters) : &lt;!-- Aspect --&gt; &lt;bean id="logAspect" class="LoggingAspect" /&gt; &lt;aop:config&gt; &lt;aop:aspect id="aspectLoggging" ref="logAspect" &gt; &lt;aop:pointcut id="testAround" expression="execution(* methodA(..))" /&gt; &lt;aop:pointcut id="testAroundC" expression="execution(* methodC(..))" /&gt; &lt;!-- @Around --&gt; &lt;aop:around method="logProcess(1)" pointcut-ref="testAround" /&gt; &lt;aop:around method="logProcess(2)" pointcut-ref="testAroundC" /&gt; &lt;/aop:aspect&gt; When I call methodA I want logProcess method to output 1 and when I call methodC I want logProcess method to output 2 My logProcess method : public Object logProcess(ProceedingJoinPoint joinPoint) throws Throwable {} Spring @Transactional wont rollback after putting aspect around method
has answer: http://stackoverflow.com/a/23759989
has comment: http://stackoverflow.com/comment/36532498
linked to: http://stackoverflow.com/q/23755006
upvote count: 1
tagged with: parameter-passing
tagged with: spring
has comment: http://stackoverflow.com/comment/36532268
type: AnsweredQuestion
tagged with: aspect
accepted answer: http://stackoverflow.com/a/23759989
score: 1
has title: Passing parameter to same aspect method for different pointcut from xml
tagged with: java
type: Question

http://stackoverflow.com/comment/36494723
type: Comment
has text: Yes, you are right, but the message could be sent after the client disconnect and before the timeout. If it was sent in this ~30sec interval, the message is not received.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23739436

http://stackoverflow.com/q/23679047
has comment: http://stackoverflow.com/comment/36378915
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36378760
has comment: http://stackoverflow.com/comment/36378797
has answer: http://stackoverflow.com/a/23679310
score: 0
has body: When I try to compile my code I get error cannot find symbol for .size() and .get(int). If I move the for loop outside the catch block I get a cannot find symbol error for the currentUserDiary variable. getExisitingDiaries() returns a DiaryBook so I thought this would work. Just wondering if there is something wrong with assigning an Object to a variable this way or if theres something wrong with the rest of my code. I have to use the catch block because the methods read from a text file. AccountList aListOb = new AccountList(); try { aListOb.loadExistingDiaries(myAccountName); DiaryBook currentUserDiary = new DiaryBook(); currentUserDiary = aListOb.getExistingDiaries(myAccountName); for (int i = 0; i &lt; currentUserDiary.size(); i++) { System.out.println(currentUserDiary.get(i)); } } catch (IOException e) { } these methods are in the AccountList class: public void loadExistingDiaries(String name) throws IOException { for(int i = 0; i &lt; aList.size(); i++) { if (aList.contains(new Account(name, null))) { aList.get(i).loadExistingDiaries(); break; } } } public DiaryBook getExistingDiaries(String name) throws IOException { DiaryBook d = new DiaryBook(); for(int i = 0; i &lt; aList.size(); i++) { if (aList.contains(new Account(name, null))) { aList.get(i).loadExistingDiaries(); d = aList.get(i).getDiaryBook(); break; } } return d; }
has title: Assigning an object to a variable with methods in catch block
possible better answer: http://stackoverflow.com/a/23680022
has answer: http://stackoverflow.com/a/23680022
accepted answer: http://stackoverflow.com/a/23679310
type: AnsweredQuestion

http://stackoverflow.com/a/23661451
has body: If you want to match ) or (, use the regexp [()].
has comment: http://stackoverflow.com/comment/36345202
score: 0
answers question: http://stackoverflow.com/q/23661336
has comment: http://stackoverflow.com/comment/36345074
type: Answer

http://stackoverflow.com/a/23689736
answers question: http://stackoverflow.com/q/23689613
has comment: http://stackoverflow.com/comment/36502119
type: Answer
has comment: http://stackoverflow.com/comment/36473781
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36473853
has comment: http://stackoverflow.com/comment/36502082
downvote count: 0
has body: The "probable" cause is the use of KeyListener on the text fields. The main problem is you are not taking into account what should occur if one of the fields is empty, "" is not a valid number. Don't use KeyListeners on text fields, if you want to perform real time updates on fields, you should be using a DocumentListener instead. KeyListener won't be notified if the the user pastes content into the field... You should also consider using a JSpinner or a JFormattedField or even a DocumentFilter to restrict what the user can actually type into the fields Something like... if (!userDenominatorInput.getText().isEmpty() &amp;&amp; !userNumeratorInput.getText().isEmpty()) { double userDenominator = Double.parseDouble(userDenominatorInput.getText()); double userNumerator = Double.parseDouble(userNumeratorInput.getText()); calculate(userNumerator, userDenominator); } Should help...

http://stackoverflow.com/comment/36311788
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23643953
has text: So if I have R, A, B, C and D if D's parent is set to C because C is its neighbor, B's parent is set to A because A is it's neighbor, A's parent is set to R and C's parent is set to R for the same reasons I essentially have my ParPtrTree? Thank you for your help thus far!
type: AnswerComment

http://stackoverflow.com/q/23657032
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23662551
has answer: http://stackoverflow.com/a/23663692
has title: Importing properties to soapUI
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/23662711
answer count: 3
tagged with: groovy
has body: I need to import properties to soapUI test case, the purpose is to send a random id with every amf call that's initiated. I have prepared the id's in a notepad, im not good in groovy scripting and i got no idea as of how to call the values from the script and pass it over to the property table. I read a few scripts but they really dint help me out, I need a script that can read the values from the notepad and pass over the values to the property field in the test case. This is the scenario im planning to execute; I have a set of functions, the main parameter for the calls is the user's id which have to be passed along every call. This user id's are saved to a text file, what i need is that i should be able to call these values from the text file through soapUI's parameter definitions. the value in the notepad will be of the format; big_12345
tagged with: soapui

http://stackoverflow.com/a/23748970
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23748942
has body: Math.random() gives you a long, which can far exceed the range of values that an integer can represent. You then assign that value to an integer. That is what the compiler is warning you about. http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html

http://stackoverflow.com/q/23670997
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36369084
downvote count: 1
has answer: http://stackoverflow.com/a/23672980
type: Question
has comment: http://stackoverflow.com/comment/36365535
has comment: http://stackoverflow.com/comment/36365537
answer count: 2
has comment: http://stackoverflow.com/comment/36369594
tagged with: jsp
has comment: http://stackoverflow.com/comment/36365818
has comment: http://stackoverflow.com/comment/36364398
favorite count: 0
has comment: http://stackoverflow.com/comment/36365312
has comment: http://stackoverflow.com/comment/36365710
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36365626
has comment: http://stackoverflow.com/comment/36368511
has title: how to pass parameter in jsp in this case
has comment: http://stackoverflow.com/comment/36363802
has body: I have DB structure like : This is doGet() of Controller Servlet as : protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getSubjects(request, response); } and getSubjects(request, response) is : private void getSubjects(HttpServletRequest request, HttpServletResponse response) throws ServletException{ try { List&lt;Subject&gt; subjects = subjectDAO.subjectList();// I'm sending subjects List as Arttribute and, Please SEE *** below ### HERE by passing subject ID Here. List&lt;Page&gt; pages = pageDAO.topicList(subjectId); // Now I want to send pages List as Arttribute as well and, Please SEE### below request.setAttribute(&quot;subjects&quot;, subjects); request.setAttribute(&quot;pages&quot;, pages); getServletContext().getRequestDispatcher(&quot;/view.jsp&quot;).forward( request, response); } catch (Exception e) { throw new ServletException(&quot;Error &quot;, e.getCause()); } } and this is my JSP &lt;ul class=&quot;subjects&quot;&gt; *** HERE below I'm getting that subjects List. &lt;c:forEach items=&quot;${subjects}&quot; var=&quot;subject&quot;&gt; &lt;li &lt;c:catch&gt; &lt;c:choose&gt; &lt;c:when test=&quot;${subject.subjectId == param.subj_id}&quot;&gt; &lt;c:out value=&quot; class=\&quot;selected\&quot;&quot;/&gt; &lt;/c:when&gt; &lt;/c:choose&gt; &lt;/c:catch&gt;&gt;&lt;a href='/contexct/super-controller?action=view-content&amp;subj_id= &lt;c:out value=&quot;${subject.subjectId}&quot;/&gt;'&gt; &lt;c:out value=&quot;${subject.subjectName}&quot; /&gt; &lt;/a&gt;&lt;/li&gt; &lt;ul class=&quot;pages&quot;&gt; ### HERE below I can get that pages List .But how can I get value of subjectId So that I can get pages from DB, Please SEE$$$ above. &lt;c:forEach items=&quot;${pages}&quot; var=&quot;page&quot;&gt; &lt;li &lt;c:catch&gt; &lt;c:choose&gt; &lt;c:when test=&quot;${page.pageId == param.topic_id}&quot;&gt; &lt;c:out value=&quot; class=\&quot;selected\&quot;&quot;/&gt; &lt;/c:when&gt; &lt;/c:choo…
has answer: http://stackoverflow.com/a/23672317

http://stackoverflow.com/comment/36279319
has text: You can lookup those classes in the [API documentation](http://docs.oracle.com/javase/8/docs/api/). They work almost the same as other list and map classes, so why do you need a special tutorial for these old classes? The tutorial you already found explains exactly how to use lists, sets and maps.
comment on: http://stackoverflow.com/a/23627937
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/36284792
comment on: http://stackoverflow.com/q/23630710
score: 0
has text: @Selvin So you are saying I would need as many objects as the size of listDataHeader for the Hashmap to work?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36691718
type: Comment
comment on: http://stackoverflow.com/a/23742534
has text: use session.createQuery() instead of getSession().createQuery().
score: 0
type: AnswerComment

http://stackoverflow.com/q/23621741
has title: issues with use of this keyword in java
has answer: http://stackoverflow.com/a/23621789
has answer: http://stackoverflow.com/a/23621764
upvote count: 1
has body: I am new to java and trying to understand the use of this keyword in java.As per documentation if instance and local variables have same name then local variables mask the instance variables.We use this keyword so that instance variable may not be masked by local variable.Below is the program i was writing to understand the use of this key work but even after use of this keyword instance variable is still getting masked. class Box{ int height=5; int length=10; int breadth=15; int CalcVol(){ int vol = height*breadth*length; return vol; } Box(int height, int length,int breadth){ this.height = height; length = length; breadth = breadth; System.out.println("height is " + height); } } class MyBox{ public static void main(String args[]){ Box mybox1 = new Box(10, 20, 30); int vol=mybox1.CalcVol(); System.out.println("volume is" + vol); } } What i am thinking is that variable "height" printed in Box constructor should print 5 ie value of instance variable but its printing 10 ie the value passed as parameter.Please help me on this.
favorite count: 0
has comment: http://stackoverflow.com/comment/36267665
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23621860
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23621842
has answer: http://stackoverflow.com/a/23622052
has comment: http://stackoverflow.com/comment/36267670
tagged with: this
downvote count: 0

http://stackoverflow.com/q/23722433
tagged with: primefaces
duplicate of: http://stackoverflow.com/q/4734580
has answer: http://stackoverflow.com/a/23722917
answer count: 1
accepted answer: http://stackoverflow.com/a/23722917
has title: create Converter with SelectOneMenu in JSF
type: AnsweredQuestion
tagged with: jsf
score: 0
tagged with: java
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/4734580
has body: I can't get the selected item from a SelectOneMenu. I supply a Set to the menu and want the user to select one of it. I put the menu into a form, so I have a commandButton which I intended to use to perform the selection. This implementation gives me this error :java.util.LinkedHashSet cannot be cast to com.gestion.projet.domain.Projet i want to get a projet Object not a list of projet then this is my the trace: mai 18, 2014 1:06:54 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute Avertissement: java.util.LinkedHashSet cannot be cast to com.gestion.projet.domain.Projet java.lang.ClassCastException: java.util.LinkedHashSet cannot be cast to com.gestion.projet.domain.Projet at com.gestion.projet.dao.ProjetDAOImpl.findProjetByNom(ProjetDAOImpl.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy42.findProjetByNom(Unknown Source) at com.gestion.projet.web.jsf.PhaseComponentImpl.getAsObject(PhaseComponentImpl.java:298) 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…

http://stackoverflow.com/comment/52276382
comment on: http://stackoverflow.com/a/23695909
type: AnswerComment
has text: The last paragraph in James_D's response is your answer. You override the default behavior using the code he listed immediately above, then include your code after the line `super.sort();`
type: Comment
score: 0

http://stackoverflow.com/comment/36396052
has text: I was unclear but I'm talking about changing `value` to by an instance of `MyEnum` as well as using the enum values for comparison
comment on: http://stackoverflow.com/q/23687459
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23683917
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23682347
upvote count: 1
has body: I think you may need to encode the knowledge of formatting a Type in that type. If your aim is to keep the MessageService agnostic to whatever data may come in, you could e.g. require each type to format itself, such as: trait MessageType { val name: String def format(relatedId: Long): String } case class FooMessageType(foo: Foo) extends MessageType { val name = "Foo" def format(relatedIid: Long) = { val foo = Foo.findById(relatedId) "This is ${foo.name}" } } Then your MessageService would only know about the MessageType interface, and implementations thereof would be provided in different modules. Note that you likely would need to allow each module to register its MessageTypes against the MessageService at startup.

http://stackoverflow.com/comment/36345023
comment on: http://stackoverflow.com/a/23661280
has text: Omg now i got u.. I think i'm working inside of wrong tag onCreateView() this is where i should work in but now im working in onCreate(Bundle savedInstanceState) im i right?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36310052
comment on: http://stackoverflow.com/q/23643243
has text: @SotiriosDelimanolis I don't want to make the method that parse many Dates one after another a steady source of garbage while it is unnecessary at all.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36453889
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23713424
has text: Furthermore, the pseudo-code in the link you've provided isn't entirely clear to me, and appears to be geared more for C++ devs. There is no STL in Java, so it would need to be implemented differently.

http://stackoverflow.com/comment/36344009
has text: Have you read the documentation of `Scanner#nextLine`?
score: 0
comment on: http://stackoverflow.com/q/23660933
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36310676
type: QuestionComment
comment on: http://stackoverflow.com/q/23643594
has text: But @ajb is certainly right. Whoever wrote this code sample should not be teaching Java. It's not just "bad form" - it's a fairly common source of bugs.
score: 0
type: Comment

http://stackoverflow.com/comment/36550622
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23768759
has text: Take a look to `addListSelectionListener`

http://stackoverflow.com/comment/36539604
has text: Well thanks very much. I didn't even think for a second the `.setTag()` method and thanks for that. Yeah the other answers were good too. Thanks again.
comment on: http://stackoverflow.com/a/23763587
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36469036
has text: I have wanted to write something like this [CallerBlocksPolicy](https://gist.github.com/garyrussell/63038cdd886e00ef01b8) for some time (to cover other use cases), but never got around to it. 8 threads are still not enough for your test case, because it times out trying to launch an assembler. However, with 80 threads as shown in the gist, I just killed your test after it created nearly 9000 connections and was still going strong.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23723556

http://stackoverflow.com/q/23756645
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Database to XML (and vice versa) through Java
accepted answer: http://stackoverflow.com/a/23783417
has answer: http://stackoverflow.com/a/23758251
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: database
tagged with: jaxb
has body: I'm trying to find some tutorial examples on how to exchange data between databases and XML files using Java, from getting and setting specific data from a database to (if possible) change how the database is structured. I have conducted research into this, but I'm unsure on whether its JDBC I should look into, XML:DB, JAXB, or if any of them are even relevant to what I'm trying to do. I plan to create a database example, and then see if I can exchange data to and from an XML file using Java, just to see how it works; what should I look into in order to accomplish this? Many thanks.
possible better answer: http://stackoverflow.com/a/23757961
has answer: http://stackoverflow.com/a/23757961
answer count: 3
downvote count: 0
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/23783417

http://stackoverflow.com/q/23618897
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36262360
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36262240
has body: I am doing sharing in my application using ShareActionProvider. However I can not find a way to validate if sharing was successful or not (failed, user cancelled it at some point, etc.). Is it possible to do this? I know I could make it easy using startActivityForResult but I found out that using ShareActionProvider is a recommended way.
answer count: 1
tagged with: android-sharing
has answer: http://stackoverflow.com/a/23619330
score: 0
tagged with: android
has title: Detect success/failure while sharing content using ShareActionProvider

http://stackoverflow.com/comment/36487035
score: 1
comment on: http://stackoverflow.com/q/23736070
type: QuestionComment
type: Comment
has text: This will be \r\n. Carrage return+line feed.

http://stackoverflow.com/comment/36340667
has text: @HotLicks I think I would agree with you on this. But now cannot edit my comment. I would say see the link in my previous comment the answers over there explain very well.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23654947
type: Comment

http://stackoverflow.com/a/23776689
score: 0
answers question: http://stackoverflow.com/q/23776313
type: Answer
has body: You can use weight on LinearLayout. <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="0.5" android:layout_gravity="left|top" android:scaleType="centerCrop" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/imaget" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="left|top" android:layout_weight="0.5" android:scaleType="centerCrop" android:src="@drawable/ic_launcher" /> With setting android:layout_weight you can set that images' heights.

http://stackoverflow.com/comment/36268494
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23622074
has text: You did `Scanner myLineScan = new Scanner(myLine);`, you need a `new Scanner(usageFile);` for each iteration of the outer loop. Move that line inside the first loop
type: Comment

http://stackoverflow.com/a/23665374
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23665333
type: Answer
has body: You want "new Double (price).hashCode()" for the "price" part of the expression.
accepted answer of: http://stackoverflow.com/q/23665333

http://stackoverflow.com/comment/36368901
score: 0
type: Comment
type: QuestionComment
has text: Or else, well, your input seems to be XML so why not use a streaming XML parser API?
comment on: http://stackoverflow.com/q/23673992

http://stackoverflow.com/comment/36347771
score: 0
type: Comment
type: QuestionComment
has text: Use request attributes with EL. But this seems like a bad idea. Your logic should be in the servlet.
comment on: http://stackoverflow.com/q/23662626

http://stackoverflow.com/comment/36994496
type: Comment
has text: greg, that should really be the answer, not a comment!
comment on: http://stackoverflow.com/q/23658224
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36559829
score: 2
comment on: http://stackoverflow.com/q/23773938
type: Comment
has text: @KshitizSharma: I disagree. This is a specific, practical programming question that arises from technical constraints in some, but not all, OO environments.
type: QuestionComment

http://stackoverflow.com/comment/36572854
score: 0
type: AnswerComment
has text: Bitronix has it's own XA complaint pool. There is a very close relationship between their pool and the transaction management semantics so you should not embed other connection pool. c3pO works fine, but for resource local transactions. If you ever want to give a try to the fastest non-XA CP, the check HikariCP.
type: Comment
comment on: http://stackoverflow.com/a/23758427

http://stackoverflow.com/comment/36364028
type: QuestionComment
comment on: http://stackoverflow.com/q/23668631
has text: @Tony I'm not sure what you mean. You're saying you don't want the button? Because buttons have nothing to do with `CardLayout`. You change panels by calling `show(Container, String)`. Calling it using an `ActionListener` for buttons is optional. You don't need a button to switch. Im sure MadProgrammer is referring to the panel being flagged invalidated. `revalidate()` invalidates, then validates. He also mentioned calling `super.paint` when you override it, which is important Cut the code down to pure necessities, and post a runnable example. You aren't giving us enough code to work with
score: 0
type: Comment

http://stackoverflow.com/comment/116925440
comment on: http://stackoverflow.com/a/52221245
type: AnswerComment
has text: For those who might confuse for "...", replace with "it.getYourProperty()"
score: 0
type: Comment

http://stackoverflow.com/q/23730416
upvote count: 1
possible better answer: http://stackoverflow.com/a/23730434
has comment: http://stackoverflow.com/comment/36477132
has answer: http://stackoverflow.com/a/23730434
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/36476922
has comment: http://stackoverflow.com/comment/36477344
has comment: http://stackoverflow.com/comment/36476963
has comment: http://stackoverflow.com/comment/36476916
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/23730737
has answer: http://stackoverflow.com/a/23730475
has body: I have been trying to simulate Stack using java classes. here go my class constructor: public Stack(Class&lt;?&gt; type){ if(type==String.class){ //... } switch(type){ case (String.class): //... break; case (Integer.class): //... break; case (Double.class): //... break; case (Byte.class): //... break; default: break; } this.counter = -1; } but confusingly for me, the if block works fine. But with the switch/case block it doesn't compile. error says incompatible types switch(type){ ^ required: int found: Class And error: constant expression required case (String.class): this repeats for all cases in the switch block. Please kindly point me whether if anything missing here.
has comment: http://stackoverflow.com/comment/36477608
has comment: http://stackoverflow.com/comment/36477096
has title: Java switch/case vs if issue
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36477294
has comment: http://stackoverflow.com/comment/36477184
tagged with: data-structures
has answer: http://stackoverflow.com/a/23730446
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/36477396
accepted answer: http://stackoverflow.com/a/23730737
linked to: http://stackoverflow.com/q/4354662
favorite count: 0
has answer: http://stackoverflow.com/a/23730512
answer count: 5

http://stackoverflow.com/a/23704865
has comment: http://stackoverflow.com/comment/36427899
has comment: http://stackoverflow.com/comment/36428022
has comment: http://stackoverflow.com/comment/36427798
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23704808
score: 2
has body: You can't compare two Strings like that. You are comparing the objects rather than the contents. Do this instead: if (input.trim().equals(com1)) { ...
accepted answer of: http://stackoverflow.com/q/23704808
downvote count: 0
has comment: http://stackoverflow.com/comment/36427875
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36427865

http://stackoverflow.com/a/23726173
answers question: http://stackoverflow.com/q/23726146
has body: string.split("");//returns string[] array of characters or you may use string.toCharArray();//char array is returned If you don't want to use latte; you can compare like this if (string.equals("a1")) //you code
score: 0
type: Answer

web-applications
tags question: http://stackoverflow.com/q/23616540
tags question: http://stackoverflow.com/q/23747910
tags question: http://stackoverflow.com/q/23633971
tags question: http://stackoverflow.com/q/23629205
tags question: http://stackoverflow.com/q/23747268
tags question: http://stackoverflow.com/q/23728916
tags question: http://stackoverflow.com/q/23747714
tag name: web-applications
tags question: http://stackoverflow.com/q/23624308
tags question: http://stackoverflow.com/q/23696482
tags question: http://stackoverflow.com/q/23774632
tags question: http://stackoverflow.com/q/23637300
type: Tag
tags question: http://stackoverflow.com/q/23755139

http://stackoverflow.com/q/23639943
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23639996
favorite count: 0
tagged with: complexity-theory
has comment: http://stackoverflow.com/comment/36304735
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23639996
upvote count: 3
has comment: http://stackoverflow.com/comment/36303020
tagged with: java
downvote count: 3
type: Question
tagged with: algorithm
has title: complexity and big oh notation on algorithms
has body: I need som help understanding how this works! how do I go about calculating the complexity of 'Computing the first half of an array of n items' or 'displaying the third element in a linked list' ? I need someone to explain how this works, theses are just examples, so be free to use your own if it helps explaining! thank you.

http://stackoverflow.com/q/23718135
upvote count: 2
has body: I've tried this: package-info.java @XmlSchema(xmlns= { @XmlNs(prefix="Person", namespaceURI="sample.url.something"), @XmlNs(prefix="xsi", namespaceURI="http://www.w3.org/2001/XMLSchema-instance") }) Java @XmlRootElement(name = "Person:sampleData") public class Person { private static String path = "files/test.xml"; @XmlElement() public String Name; @XmlElement() public int Age; public Person(){} public Person(String name, int age){ this.Name = name; this.Age = age; } public static String PersonToXMLString(Person person) throws JAXBException { JAXBContext jc = JAXBContext.newInstance(Person.class); StringWriter sw = new StringWriter(); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "somelocation.xsd"); marshaller.marshal(person, sw); return sw.toString(); } public static Person XMLStringToPerson() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Person.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Person Person = (Person) unmarshaller.unmarshal(new File(path)); return Person; } public static void WriteXMLStringFile(String xml) throws IOException { File file = new File(path); try (FileOutputStream fop = new FileOutputStream(file)) { if (!file.exists()) { file.createNewFile(); } byte[] contentInBytes = xml.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); } catch (IOException e) { e.printStackTrace(); } } public static String ReadXmlStringFromFile() throws IOException { BufferedReader br = new BufferedReader(new FileReader(new File(path))); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line.trim()); } return sb.toString(); } public static void main(String[] args) throws JAXBException, IOException { Person user = new Person("User",23); String xml = user.PersonToXMLString(user); System.out.println(xml); user.WriteXMLStringFile(xml); x…
has answer: http://stackoverflow.com/a/23721533
accepted answer: http://stackoverflow.com/a/23721533
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/36453157
has comment: http://stackoverflow.com/comment/36453225
has title: How to add suffix to XmlRootElement
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36395262
has text: Are you trying to set the color, or get it, or both?
type: QuestionComment
comment on: http://stackoverflow.com/q/23687393
type: Comment
score: 1

http://stackoverflow.com/comment/36308846
comment on: http://stackoverflow.com/q/23642783
score: 0
has text: When you move to Android Studio, or otherwise to Gradle for the build system, you can use build types to separate the source out into separate directories that will only be included when you are building a certain output (e.g., `debug` or `release`).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36439774
has text: `i.getSifraIzlagaca()` does not happen to return a question mark, right?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23711419

http://stackoverflow.com/q/23771697
has answer: http://stackoverflow.com/a/23774640
tagged with: selenium-webdriver
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1821803
tagged with: java
has answer: http://stackoverflow.com/a/23774621
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23774621
accepted answer: http://stackoverflow.com/a/23774640
has comment: http://stackoverflow.com/comment/36560752
has comment: http://stackoverflow.com/comment/36605833
score: 0
has title: Is it possible to include modules I used when compiling a .jar?
linked to: http://stackoverflow.com/q/9812209
linked to: http://stackoverflow.com/q/12531766
has body: I have very minimal knowledge of Java, coming from a mainly Python background, and I was wondering if it is possible to include the modules that I used with a .jar? For example, my program uses Selenium Webdriver and Selenium Chromedriver, is it possible for me to make it so that my user doesn't need to have these installed? Thank you and sorry if this has been asked before!
tagged with: selenium-chromedriver

otto
tag name: otto
tags question: http://stackoverflow.com/q/23742092
type: Tag
tags question: http://stackoverflow.com/q/23620072

http://stackoverflow.com/q/23646526
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/36315484
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23646559
tagged with: java
tagged with: swing
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23646559
has body: JPanel Initiation p = new JPanel() { private static final long serialVersionUID = 1L; public void paintComponent(Graphics g) { if(errors == 1) g.drawOval(215, 50, 75, 75); else if(errors == 2) g.drawOval(200,200,200,200); } }; Method that calls repaint static void drawHead() { System.out.println("Head"); errors = 1; p.removeAll(); p.revalidate(); p.repaint(); } Before repaint my frame looks like this, https://i.sstatic.net/T8F0V.png And afterwards it looks like this, https://i.sstatic.net/UFwr0.png I'm thinking there is an error in my drawHead() method but I cannot seem to resolve the issue. Does anyone know what is going on? My desired outcome would be the first image, but with a head drawn in.
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/36315518
has title: Panel.repaint(); messes up layout
linked to: http://stackoverflow.com/q/5665156
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/36557542
has text: `Thread.sleep(1000);` Don't block the EDT (Event Dispatch Thread) - the GUI will 'freeze' when that happens. Instead of calling `Thread.sleep(n)` implement a Swing `Timer` for repeating tasks or a `SwingWorker` for long running tasks. See [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for more details.
comment on: http://stackoverflow.com/q/23772701
type: Comment
type: QuestionComment
score: 0

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/23773276
tags question: http://stackoverflow.com/q/23739696
tags question: http://stackoverflow.com/q/23750746
tag name: httpsurlconnection

http://stackoverflow.com/comment/36515484
type: Comment
has text: Is that allowed since icon is an ImageIcon? How can it be returning a String
type: AnswerComment
comment on: http://stackoverflow.com/a/23750915
score: 0

http://stackoverflow.com/q/23710037
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23718739
has comment: http://stackoverflow.com/comment/36439237
has answer: http://stackoverflow.com/a/23710119
favorite count: 0
has comment: http://stackoverflow.com/comment/36437476
has title: Java - Json deserialize data []
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36439213
upvote count: 1
has comment: http://stackoverflow.com/comment/36440478
tagged with: java
has comment: http://stackoverflow.com/comment/36439692
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23710119
tagged with: gson
possible better answer: http://stackoverflow.com/a/23719197
has answer: http://stackoverflow.com/a/23719197
downvote count: 0
has comment: http://stackoverflow.com/comment/36441261
score: 1
has comment: http://stackoverflow.com/comment/36437377
has comment: http://stackoverflow.com/comment/36441087
has body: I am new to stackoverflow. I am creating an Java application which it will get data from a web server. The data is in json format. Example" [ { "item_name": "Adame", "item_type": "Special", "item": "Chestplate", "item_min_lvl": "50", "enchantment": { "health": "0.3", "dam": "24%", "life": "0.1", "xp": "24%", "loot": "22%" }, "def": "73" }, { "item_name": "Sticks'", "item_type": "Unique", "item": "Stick", "item_min_lvl": "4", "enchantment": { "health": "0.6", "mana": "1", "dam": "12%", "life": "0.3", "xp": "17%", "loot": "17%" }, "min_dam": "39", "max_dam": "34" } ] I know how to deserialize json using Gson. As you can see, it's started with [. I never deserialize this case before. Also, the json data is not the same(e.g. enchantment). I also searched in Google but I can't find any similar case. Can anyone help me with the code?

http://stackoverflow.com/comment/36538840
comment on: http://stackoverflow.com/a/23763084
score: 0
type: AnswerComment
type: Comment
has text: Yes, and it should be.

http://stackoverflow.com/comment/36277195
comment on: http://stackoverflow.com/q/23626896
score: 0
has text: where do you call the doLogin from?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23740634
tagged with: date
has body: I have two date strings and I want to know how many seconds difference there is between them. 2014-05-19 16:37:36:690 // formattedDate 2014-05-19 19:38:00:000 // expString I use the following code: SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss:SSS"); Date d1 = null; Date d2 = null; d1 = sdf.parse(expString); d2 = sdf.parse(formattedDate); long diff = d1.getTime() - d2.getTime(); long exp = diff / 1000 % 60; In this particular example exp is 23. What is the problem here?
type: Question
has comment: http://stackoverflow.com/comment/36495869
accepted answer: http://stackoverflow.com/a/23740776
score: 0
has title: Time difference in seconds gives me wrong answers
answer count: 3
tagged with: date-format
has comment: http://stackoverflow.com/comment/36496299
favorite count: 0
tagged with: parsing
has answer: http://stackoverflow.com/a/23741723
possible better answer: http://stackoverflow.com/a/23740855
upvote count: 1
has answer: http://stackoverflow.com/a/23740776
downvote count: 1
has answer: http://stackoverflow.com/a/23740855
has comment: http://stackoverflow.com/comment/36496218
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36496153
tagged with: java

http://stackoverflow.com/comment/36358211
has text: @user3572544 Sounds like a god-object. Break it up. Always strive for shorter, smaller, simpler pieces. I'd have to look at the code as a whole to make a concrete recommendation, but the approach you're asking about is definitely not the right one. You're not leveraging the tools that your programming language already gives you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23667888

http://stackoverflow.com/comment/36342415
type: QuestionComment
score: 1
has text: Java has its own *portable* way of doing this: http://docs.oracle.com/javase/tutorial/essential/io/move.html
comment on: http://stackoverflow.com/q/23660096
type: Comment

http://stackoverflow.com/a/23636523
answers question: http://stackoverflow.com/q/23636456
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36296397
type: AcceptedAnswer
has body: So, is there another way I could import all the android classes in order for me to save the time of importing each one individually? import android.*; will only import classes and interfaces that are directly in the android package. To import all classes/interfaces in android.app, use import android.app.*;. Bear in mind that Eclipse/ADT provides multiple ways of adding the imports for you, such as Ctrl-Shift-O to resolve all missing imports.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23636456

http://stackoverflow.com/comment/36344675
type: Comment
type: QuestionComment
has text: Does `GaData results` contain more than one line? It might be helpful to *add* your revised code *after* the existing codeblock (ie, do not erase the existing codeblock as your original question won't make much sense without the existing code.
comment on: http://stackoverflow.com/q/23660163
score: 0

http://stackoverflow.com/comment/36480888
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23732444
score: 0
has text: Do you know that BigInteger has his own method to check for primes? Check out [BigInteger::isProbablePrime](http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#isProbablePrime%28int%29).

http://stackoverflow.com/a/23763362
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36548168
upvote count: 1
has body: Based on the limited information you provide, it sounds like the application is using the Java Preferences API. In this case, where the data is actually stored is OS-dependent. In Windows, it's in the Registry. Linux and OS X, I'm not sure. That is, the data is not likely stored in a single properties file somewhere from which you can just copy it. If you have access to the code, you can export the Preferences object to a file though. FileOutputStream output = new FileOutputStream("myPrefs.xml"); myPrefs.exportSubtree(output); Edit: Looks like in Linux you may find the info in one of these two places: ~/.java/.userPrefs /etc/.java/.systemPrefs
answers question: http://stackoverflow.com/q/23762730
accepted answer of: http://stackoverflow.com/q/23762730

http://stackoverflow.com/a/23775993
has comment: http://stackoverflow.com/comment/36563563
type: Answer
has comment: http://stackoverflow.com/comment/36563768
answers question: http://stackoverflow.com/q/23775503
has body: Instead of using IOUtils copy method ServletOutputStream out = response.getOutputStream(); IOUtils.copy(in, out); You can use following : ServletOutputStream out = response.getOutputStream(); byte[] bytes = IOUtils.toByteArray(in); out.write(bytes); out.close(); out.flush(); Hope this will work.
score: 0

http://stackoverflow.com/comment/36517550
type: AnswerComment
score: 0
type: Comment
has text: Very useful link! I didn't find any standard Exception that was related with the actual problem (Service exception that should be returned to the client), so Hirak's answer makes sense (creating a custom Exception class).
comment on: http://stackoverflow.com/a/23751861

http://stackoverflow.com/q/23683889
tagged with: java
has answer: http://stackoverflow.com/a/23683912
has comment: http://stackoverflow.com/comment/36389513
has title: java.lang.NullPointerException caused by a Vector
type: Question
answer count: 2
has body: I 'm using a matrix where each element is a vector of object "Person". I defined my Person class. In an other class (and in the same package), I declared ma matrix as the following: Vector&lt;CKYCell&gt; [] [] Score= new Vector [length][length]; I want to know the size of each element of the matrix, I use: System.out.println(Score[i][i].size()); But I have the following error: java.lang.NullPointerException Is there any one who could help me. Thanks in advance.
has comment: http://stackoverflow.com/comment/36388489
score: 0
has answer: http://stackoverflow.com/a/23683982
type: UnansweredQuestion

http://stackoverflow.com/q/23628840
has comment: http://stackoverflow.com/comment/36281701
has body: i'm a new member. I really need your help. :) Problem: I want to insert selected item of combo box into mysql, but i dont want the item, but i want the pk of selected item to be insert. I need help to detect my error and tell me what is the problem and what should i do. FYI, i'm using netbeans. Here is my code. // member type combo box private void FillComboBoxMemberRegistration(){ try{ String sql = "select * from jeniskeahlian"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); while(rs.next()){ String memberType = rs.getString("Type"); MemberTypeComboBox.addItem(memberType); } } catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } //Member type combo box [Insert] String memberTypeList = MemberTypeComboBox.getSelectedItem().toString(); String sql1 ="Select MemberTypeID from jeniskeahlian where Type = '" + memberTypeList ; pst = conn.prepareStatement(sql1); rs = pst.executeQuery(); while(rs.next()){ String memberType = rs.getString("MemberTypeID"); pst.setString(10, memberType); }
score: 0
answer count: 1
tagged with: jdbc
tagged with: combobox
has answer: http://stackoverflow.com/a/23629430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36342564
tagged with: java
tagged with: mysql
has title: How to insert combobox selected item pk into mysql?
type: Question

http://stackoverflow.com/comment/36724111
score: 0
type: AnswerComment
type: Comment
has text: Thank you. What I really need to know is how the services talk to one another/interact within the Logical architecture Model? Can you help me with that, thanks!
comment on: http://stackoverflow.com/a/23795106

http://stackoverflow.com/comment/36315609
comment on: http://stackoverflow.com/a/23646559
type: AnswerComment
has text: I'd also consider using a `switch` statement instead of an `if` statement and reverse the order in which the values are checked, this would allow you to keep count of the number of errors but reduce the amount of duplicated code you would need to produce in order to get the `if` statement to work
score: 0
type: Comment

http://stackoverflow.com/a/23758288
has body: try below code :- radioAktivitasGroup = (RadioGroup) findViewById(R.id.radioAktivitasGroup); setContentView(R.layout.aktivitas_user); to // this right way to do setContentView(R.layout.aktivitas_user); radioAktivitasGroup = (RadioGroup) findViewById(R.id.radioAktivitasGroup); Null pointer exception shown because you initialize view before layout add.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23758192

http://stackoverflow.com/a/44603582
has body: paragraph.setSpacingBetween(1); It will create a line spacing of 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23660811
score: 1
downvote count: 0

http://stackoverflow.com/comment/36273233
has text: Show your source code. How do you annotated the field? Was it @XmlSchemaType(name="date")?
score: 0
comment on: http://stackoverflow.com/q/23623400
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36522038
has text: ya I have did one mail, have you got it?
type: QuestionComment
comment on: http://stackoverflow.com/q/23626909
score: 0
type: Comment

import
type: Tag
tags question: http://stackoverflow.com/q/23703328
tag name: import
tags question: http://stackoverflow.com/q/23643364
tags question: http://stackoverflow.com/q/23710829
tags question: http://stackoverflow.com/q/23710326
tags question: http://stackoverflow.com/q/23681327
tags question: http://stackoverflow.com/q/23762124
tags question: http://stackoverflow.com/q/23679029
tags question: http://stackoverflow.com/q/23690119

http://stackoverflow.com/comment/36350394
has text: @user3102085 Glad to hear it!
comment on: http://stackoverflow.com/a/23664006
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23727204
has answer: http://stackoverflow.com/a/23727317
has comment: http://stackoverflow.com/comment/36470824
has body: I am trying to put keywords into a string buffer alpha and omit duplicate characters. I am getting an out of bounds error at the keyword to alpha comparison. public String putKeyword(String keyword) { StringBuffer alpha = new StringBuffer(); alpha.append(keyword.charAt(0)); for(int i = 1; i &lt; keyword.length(); i++){ boolean found = false; for(int j = 0; j &lt; i; j++){ if(keyword.charAt(i) == alpha.charAt(j)) found = true; if(found = false) alpha.append(keyword.charAt(i)); } } return alphabet = alpha.toString(); }
tagged with: java
tagged with: indexoutofboundsexception
type: Question
tagged with: replace
has comment: http://stackoverflow.com/comment/36470847
tagged with: string
has title: Out of bounds error at keyword to alpha comparison
answer count: 3
favorite count: 0
downvote count: 6
has answer: http://stackoverflow.com/a/23727595
type: UnansweredQuestion
tagged with: keyword
upvote count: 1
has answer: http://stackoverflow.com/a/23727257
score: -5

http://stackoverflow.com/comment/36561565
has text: is your question is related to [this](http://stackoverflow.com/q/14076730/2764279)
type: QuestionComment
comment on: http://stackoverflow.com/q/23774996
score: 0
type: Comment

http://stackoverflow.com/a/23755613
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23754325
has body: //try this one import java.util.Scanner; //Scanner class required for user input. class xyz { public static void main(String ar[]) { int row,col; Scanner in=new Scanner(System.in); //defining Object for scanner class System.out.println("Enter row"); row=in.nextInt(); System.out.println("Enter Column"); col=in.nextInt(); int mat[][]=new int[row][col]; //giving matrix size for(int i=0;i&lt;row;i++) { for(int j=0;j&lt;col;j++) { mat[i][j]=0; //or any value decided by you } } } }

http://stackoverflow.com/comment/36502004
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23743529
has text: Few days back I tried this and I found that its efficient, only from the perspective of carrying out some calculation independently i.e one calculation doesn't affect the other one in such cases we can use it.If you want further information on streams I suggest you take a look at the video from VJUG for streams work shop. Again it internally uses the fork join at the end of the above mentioned link its stated.

http://stackoverflow.com/q/23671842
has answer: http://stackoverflow.com/a/23955890
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36366823
has comment: http://stackoverflow.com/comment/36365712
linked to: http://stackoverflow.com/q/139926
has comment: http://stackoverflow.com/comment/36368370
favorite count: 0
has comment: http://stackoverflow.com/comment/36364889
has comment: http://stackoverflow.com/comment/36365169
type: Question
has comment: http://stackoverflow.com/comment/36365776
answer count: 2
upvote count: 1
tagged with: regex
has answer: http://stackoverflow.com/a/23677170
has body: I need a regex expresssion which match below strings in java. select * from test select * from test where a=100 select * from test where a=100 and b=100 the select statement may or may not contain where condition, also it may contain 1 to n number of conditions, i need a single regex to match all of those, can anyone help i tried to match the string by using below regex expression, but it fails select (([A-Za-z0-9]{1,20}(|\\,))*|\\*) from ([A-Za-z0-9]{1,20})( where ([A-Za-z0-9]{1,20}((| )(\\=|\\&gt;|\\&lt;)(| ))[A-Za-z0-9]{1,20})|$) Criteria: i) a string should start with select ii) if where is present it should be followed by a pair of variable and value like below: `select * from test where a=10;` iii) Between two variable and value pair and should be present like below: `select * from test where a=10 and b=10` iv) a string may or may not contain where v) a string should not end with and public class Test { public static Pattern pattern; public static Matcher matcher; private static final String PATTERN="(\\s)*select(\\s)+((\\*)|([a-zA-Z0-9]+))(\\s)+from(\\s)+[a-zA-Z0-9]*(\\s)+where(\\s)+(‌​[a-zA-Z0-9]*(\\s)*=(\\s)*[0-9]*)+(\\s)*((\\s)*and(\\s)*([a-zA-Z0-9]*(\\s)*=(\\s)*[0-9]*)‌​)*(\\s)*"; public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String data; pattern=Pattern.compile(PATTERN,Pattern.CASE_INSENSITIVE); do{ data=br.readLine(); matcher=pattern.matcher(data); if(matcher.find()){ System.out.print("True"); }else{ System.out.print("false"); } System.out.print(":"+data+":\n"); }while(data!="exit"); } } Test Cases(should show true) select a from test select a from test where a=10 select a from test where a=10 and b=10 select a from test where a=10 and b=10 and c=10 Test Cases(should show false) select a from test where select a from test where a=10 and select a from test where a=10 b=10 select a from test where a=10 and b=10 and thanks
accepted answer: http://stackoverflow.com/a/23955890
has comment: http://stackoverflow.com/comment/36364967
has comment: http://stackoverflow.com/comment/36365513
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23677170
has title: regex for matching string with multiple occurance in java
has comment: http://stackoverflow.com/comment/36366732
downvote count: 1
has comment: http://stackoverflow.com/comment/36365401
has comment: http://stackoverflow.com/comment/36367195
has comment: http://stackoverflow.com/comment/36371757
has comment: http://stackoverflow.com/comment/36367305
has comment: http://stackoverflow.com/comment/36365447
has comment: http://stackoverflow.com/comment/36365279
has comment: http://stackoverflow.com/comment/36364997
has comment: http://stackoverflow.com/comment/36365515
has comment: http://stackoverflow.com/comment/36365790

http://stackoverflow.com/comment/36477076
score: 0
comment on: http://stackoverflow.com/q/23729665
type: Comment
type: QuestionComment
has text: I updated my post to clarify the question.

jtextpane
tags question: http://stackoverflow.com/q/23620233
tags question: http://stackoverflow.com/q/23646008
tags question: http://stackoverflow.com/q/23637224
tags question: http://stackoverflow.com/q/23715048
tag name: jtextpane
tags question: http://stackoverflow.com/q/23729665
tags question: http://stackoverflow.com/q/23753342
type: Tag
tags question: http://stackoverflow.com/q/23731334
tags question: http://stackoverflow.com/q/23763200
tags question: http://stackoverflow.com/q/23712809
tags question: http://stackoverflow.com/q/23757183
tags question: http://stackoverflow.com/q/23742187

http://stackoverflow.com/comment/36299692
type: QuestionComment
comment on: http://stackoverflow.com/q/23638066
has text: I having off graphics2d for a while. I just tried to point in the direction you should look into. I think the link I provided should help.
score: 0
type: Comment

http://stackoverflow.com/comment/36264997
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) Provide ASCII art (or an image with a simple drawing) of the GUI as it should appear in smallest size and (if resizable) with extra width/height.
comment on: http://stackoverflow.com/q/23619727
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36309844
type: QuestionComment
has text: What do you mean by _translate this into linked list format_? Don't just dump your code. Explain what you are trying to achieve and why what you've done doesn't work. If you haven't done _anything_, you should go try something now. If you don't know what to do, SO is probably not the right place to start looking.
comment on: http://stackoverflow.com/q/23643338
score: 0
type: Comment

http://stackoverflow.com/comment/36374115
comment on: http://stackoverflow.com/a/23675281
type: AnswerComment
score: 0
type: Comment
has text: Try `answer = s.substring(s.indexOf("src=\""), s.indexOf("\"",s.indexOf("\"")+1) + 1);`

http://stackoverflow.com/a/23700374
has comment: http://stackoverflow.com/comment/36418704
score: 0
answers question: http://stackoverflow.com/q/23699899
has comment: http://stackoverflow.com/comment/36420295
type: Answer
has body: I would suggest in your case that you use the catalog views. In Oracle catalog views you will find all the metadata that describe an Oracle database: http://www.oracle.com/pls/db92/db92.catalog_views For example, to get all the foreign keys from a certain table: select * from all_constraints constraints where constraints.table_name = 'MY_TABLE' and constraints.constraint_type = 'R' There is a deeper and better answer here: Oracle get foreign keys
has comment: http://stackoverflow.com/comment/36419500

http://stackoverflow.com/q/23628267
score: 0
has comment: http://stackoverflow.com/comment/36282075
answer count: 1
has answer: http://stackoverflow.com/a/23631540
has body: I have a MailSender class that has 2 methods: private Session createSmtpSession(final String fromEmail, final String fromEmailPassword) { final Properties props = new Properties(); props.setProperty ("mail.host", "smtp.gmail.com"); props.setProperty("mail.smtp.auth", "true"); props.setProperty("mail.smtp.port", "" + 587); props.setProperty("mail.smtp.starttls.enable", "true"); props.setProperty ("mail.transport.protocol", "smtp"); return Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(fromEmail, fromEmailPassword); } }); } public void sendEmail(String subject, String fromEmail, String fromEmailPassword, String content, String toEmail){ Session mailSession = createSmtpSession(fromEmail, fromEmailPassword); mailSession.setDebug (true); try { Transport transport = mailSession.getTransport (); MimeMessage message = new MimeMessage (mailSession); message.setSubject (subject); message.setFrom (new InternetAddress (fromEmail)); message.setContent (content, "text/html"); message.addRecipient (Message.RecipientType.TO, new InternetAddress (toEmail)); transport.connect (); transport.sendMessage (message, message.getRecipients (Message.RecipientType.TO)); } catch (MessagingException e) { System.err.println("Cannot Send email"); e.printStackTrace(); } } ok, The way the above code works is like this: I have personal gmail myEmail@gmail.com &amp; if I want to send msg to destination email like aa@xyz.com from myEmail@gmail.com, then I need to call sendEmail(subject, "myEmail@gmail.com", fromEmailPassword, content, "aa@xyz.com"); But recently I bought VPS from Godaddy &amp; I am using Godaddy Email (info@mydomain.com) so I want to send smg to destination email like aa@xyz.com from info@mydomain.com, then I need to call sendEmail(subject, "info@mydomain.com", fromEmailPassword, content, "aa@xyz.com"); However I got error cos Godaddy using port 25 So I changed the code…
has comment: http://stackoverflow.com/comment/36281680
has comment: http://stackoverflow.com/comment/36281771
type: AnsweredQuestion
tagged with: java
type: Question
has title: Why Java MailSender does not Recognize the destination email?
accepted answer: http://stackoverflow.com/a/23631540

http://stackoverflow.com/a/23687940
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23687897
accepted answer of: http://stackoverflow.com/q/23687897
type: Answer
upvote count: 5
has body: You're not adding your button or your JPanel to anything, and so no JFrame is magically going to display them. You should add your JButton to your JPanel via its add(...) method, and then add the JPanel to the JFrame via its add(...) method, and do so before setting the JFrame visible. Most importantly, you should read the Swing tutorials, since I speak from experience when saying you'll get no-where just guessing at this stuff. This is all well explained there. As an aside, avoid setting the sizes of any components and instead read the tutorial section on use of the layout managers as it will allow you to simplify and empower your code greatly.

http://stackoverflow.com/q/23698910
tagged with: annotations
score: 2
answer count: 0
tagged with: java
type: Question
has title: OpenJPA PersistenceException: LongId cannot be cast to MyEntityClass... @OneToMany in combination with FetchType.EAGER
has comment: http://stackoverflow.com/comment/36416009
has comment: http://stackoverflow.com/comment/36417181
tagged with: fetch
has body: When I try to get an object from my database via entity manager that includes a further object that is annotated with @OneToMany and the parameter "fetch = FetchType.EAGER", I got the following exception (below are more Information about my entities and testcases): [ERROR 15:50:40] projectNameRestController.catchEmAll(75) | general error occurred &lt;openjpa-2.2.2-r422266:1468616 nonfatal general error&gt; org.apache.openjpa.persistence.PersistenceException: org.apache.openjpa.util.LongId cannot be cast to de.projectName.domain.test.Parent FailedObject: select p from Parent p [java.lang.String] at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1027) at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:926) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1033) at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280) at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381) at org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.loadElement(RelationToManyInverseKeyFieldStrategy.java:90) at org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.loadElement(RelationCollectionInverseKeyFieldStrategy.java:76) at org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.processEagerParallelResult(StoreCollectionFieldStrategy.java:313) at org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.loadEagerParallel(StoreCollectionFieldStrategy.java:247) at org.apache.openjpa.jdbc.meta.FieldMapping.loadEagerParallel(FieldMapping.java:916) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1106) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1059) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:636) at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:117) at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStor…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36416091
tagged with: one-to-many
upvote count: 2
type: UnansweredQuestion
tagged with: openjpa

http://stackoverflow.com/comment/36505215
has text: In your code, you are trying to add `List<Car.CarItems>` to `List<Honda.CarItems>`. You can't do that, since a `Car.CarItems` is not necessarily a `Honda.CarItems`, and most specifically, `Car.CarItems` doesn't extend `Honda.CarItems`, but the other way around.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23743741

http://stackoverflow.com/q/23731093
has title: Java: type parameter must implement interface
has answer: http://stackoverflow.com/a/23731104
answer count: 2
has comment: http://stackoverflow.com/comment/36478158
tagged with: interface
accepted answer: http://stackoverflow.com/a/23731104
type: AnsweredQuestion
tagged with: syntax
score: 0
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23731112
has body: I have a type T that implements interface I, how do I specify that a method takes an object T that implements I, eg. public SomeClass(T&lt;implements I&gt; parameter) { .... }
has answer: http://stackoverflow.com/a/23731112

http://stackoverflow.com/a/52390048
type: Answer
has body: A good way to go around it in some cases would be to use the @Builder
upvote count: 19
has comment: http://stackoverflow.com/comment/108222549
has comment: http://stackoverflow.com/comment/120577855
score: 19
answers question: http://stackoverflow.com/q/23761242
downvote count: 0
has comment: http://stackoverflow.com/comment/120547993

http://stackoverflow.com/q/23635542
has title: How do you seed non scoped named bindings using Guice ?
has body: Building a web based application using Guice and have this peculiar situation - I am using a lot of method interceptors that are lightweight. My question is - I have a named binding say "Operation.Current" the value of which needs to be changed when one of these interceptors executes within a single request thread. So the bound value changes multiple times within a single request thread. I need this value to be injected as I need. Currently I am using request.setAttribute(Key.get(Operation.class, Names.named("Operation.Current")).toString(), op); in my GuiceFilter to initialize the value. And I want to replace this value when the interceptors execute. So I need to re seed my value present in the request as an attribute multiple times through the request. What is a better way to solve this issue ? Since I see that the value is not in a real sense RequestScoped. So ideally this value should be non scoped and bound the name. But how do I change the value as I need outside a Guice Module ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23675746
type: Question
score: 1
tagged with: java
upvote count: 1
tagged with: guice
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36352551
type: QuestionComment
has text: I would not use any Java synchronization, but instead as soon as someone starts to reserve a seat, reserve it for them. If they cancel, put it back in the pool of available seats. Also, since this is web based, they might just close their browser, so you need to have a time stamp on these provisional reservations, and periodically release any that are over `X` minutes old.
score: 1
comment on: http://stackoverflow.com/q/23664644
type: Comment

http://stackoverflow.com/q/23707193
downvote count: 0
favorite count: 0
has body: I have two classes in a package: firstClass and secondClass. I created a textfield in firstClass, let's assume it's txtStringNumber. I created a method in firstClass to get txtStringNumber value, like this: public String getStrNumber(){ String strNumber = txtStringNumber.getText(); return strNumber; } I must pass it to secondClass as String and put the strNumber as BigInteger value. In second class I created a method to get value of txtStringNumber from firstClass, like tis: public static String theNumbers(){ firstClass f = new firstClass(); return f.getStrNumber(); } public static String strAllNumbers = theNumbers(); When I print strAllNumbers in secondClass, it prints the correct value. Then I add this: public static BigInteger bigAllNumbers = new BigInteger(strAllNumbers); In my mind, it should works. But in real, it doesn't. Error occurs. So I check the error, there said: throw new NumberFormatException("Zero length BigInteger"); I guess BigInteger accept strAllNumbers as empty. But just like I already said, when I print strAllNumbers directly without set it to BigInteger, it returns the correct value. What's wrong here and how can I fix this?
type: UnansweredQuestion
tagged with: biginteger
score: 1
tagged with: java
has title: java get value from JTextField and set it as BigInteger
upvote count: 1
has answer: http://stackoverflow.com/a/23707208
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23707211

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/23735004
tags question: http://stackoverflow.com/q/23743932
tags question: http://stackoverflow.com/q/23680808
tags question: http://stackoverflow.com/q/23743842

http://stackoverflow.com/comment/36353006
comment on: http://stackoverflow.com/a/23665370
score: 2
has text: This is the reason why I had to protect my question. Please try to understand the motive of the question first.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36449221
type: QuestionComment
has text: I want to automate a function key being pressed on someones PC keyboard.
comment on: http://stackoverflow.com/q/23716227
score: 0
type: Comment

http://stackoverflow.com/comment/36325630
type: Comment
comment on: http://stackoverflow.com/a/23648042
has text: AFAIK, it only seems logical to have a single main method serving as the entry point of the application. Other than that, you can have as many main methods you like !
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36457202
score: 0
type: QuestionComment
type: Comment
has text: So I will change it to List. What are its pros against ArrayList? And regarding to the maxCustomers, there will not be more Customers than that number, so it would not resize.
comment on: http://stackoverflow.com/q/23720030

http://stackoverflow.com/comment/109558645
score: 0
type: AnswerComment
has text: Thank u, ohh I guess in Java its called Upcasting (if I m not wrong), but this way I cant access the instance variable for the VBox.
type: Comment
comment on: http://stackoverflow.com/a/23729459

http://stackoverflow.com/q/23624228
has comment: http://stackoverflow.com/comment/36366369
has comment: http://stackoverflow.com/comment/36513924
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36357702
has comment: http://stackoverflow.com/comment/36513885
has comment: http://stackoverflow.com/comment/36360062
has title: PDFBOX printing issue: Printed PDF unexpectedly rotated 90 degrees and incorrect size
has comment: http://stackoverflow.com/comment/36603272
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36276355
has comment: http://stackoverflow.com/comment/36305887
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/36504076
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/31665293
has comment: http://stackoverflow.com/comment/36320738
has comment: http://stackoverflow.com/comment/36390877
has comment: http://stackoverflow.com/comment/36553362
answer count: 1
has comment: http://stackoverflow.com/comment/36476457
has body: I am using PDFBox 2.0.0-SNAPSHOT to print the PDF in printer(both HW &amp; virtual), and it printing work but printed PDF unexpectedly rotated 90 degrees and incorrect size. example PDF download link printed result PDF download link Following is my code snippet: PrinterJob printJob = PrinterJob.getPrinterJob(); PrintService prsvc = getPrinterServiceByName(PrinterName); printJob.setPrintService(prsvc); PDDocument pdfdoc = PDDocument.load(PdfFile); printJob.setPageable(new PDPageable(pdfdoc, printJob)); printJob.print(); pdfdoc.close(); Now I have been updated with the latest PDFBox 2.0.0-SNAPSHOT version, and use PDFPrinter constructor to print PDF.And add ImageableArea to define paper imageable area using custom format.But issue still existed. See below: PrinterJob printJob = PrinterJob.getPrinterJob(); PrintService prsvc = getPrinterServiceByName(PrinterName); printJob.setPrintService(prsvc); PDDocument document = PDDocument.load(PdfFile); Paper paper = new Paper(); paper.setSize(1005.0,396.0); //354.5 x 139.7 mm paper.setImageableArea(0, 0, 1005.0, 396.0); //354.5 x 139.7 mm //result 139.7 mm x 354.5 mm. Rotated 90 degrees PDFPrinter printer = new PDFPrinter(document,printJob,Scaling.ACTUAL_SIZE,Orientation.PORTRAIT,paper,false,0); //result 139.7 mm x 354.5 mm. Rotated 90 degrees and context inverted. //PDFPrinter printer = new PDFPrinter(document,printJob,Scaling.ACTUAL_SIZE,Orientation.LANDSCAPE,paper,false,0); //same result with setting Orientation.LANDSCAPE //PDFPrinter printer = new PDFPrinter(document,printJob,Scaling.ACTUAL_SIZE,Orientation.AUTO,paper,false,0); PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(printer.getPageable()); printer.silentPrint(); How do I fix this?
favorite count: 0
has comment: http://stackoverflow.com/comment/36341563

http://stackoverflow.com/a/23743580
has body: I'm assuming you want to re-size your icon to look the same no matter what size you change it to. Regular images will are composed of pixels therefore lost of quality is inevitable. When I did a web design project at my school I learned about Vector images(.svg). Summary Of Vector Vs Bitmap http://etc.usf.edu/techease/win/images/what-is-the-difference-between-bitmap-and-vector-images/ Of course anyone please correct me if I'm wrong but I think vectors is the only way you can achieve your goal assuming that I'm understanding your question. Vector image quality does not change much or at all on re-size. Java doesn't natively support Vector Images but follow this tutorial and you should achieve your goal. (It's not really a tutorial more like copy and paste) http://plindenbaum.blogspot.com/2009/07/simple-java-based-svg-renderer.html Also this link will let you convert your existing images to SVG http://vectormagic.com/home (you get 2 downloads when you sign up) There are other tools to convert to SVG but this was the quickest solution I could find. If you're good with Photoshop I think I saw some tutorials for it but don't quote me on that. I hope this is what you were looking for best of luck to.
has comment: http://stackoverflow.com/comment/36502981
upvote count: 1
has comment: http://stackoverflow.com/comment/36505113
has comment: http://stackoverflow.com/comment/36502387
answers question: http://stackoverflow.com/q/23742790
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/36486694
score: 0
type: QuestionComment
has text: What exactly does "jammed" mean?
type: Comment
comment on: http://stackoverflow.com/q/23734903

http://stackoverflow.com/comment/36482988
has text: Related: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
score: 0
comment on: http://stackoverflow.com/q/23733821
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23755201
type: Question
score: 0
answer count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/23755561
duplicate of: http://stackoverflow.com/q/3320400
linked to: http://stackoverflow.com/q/3320400
tagged with: logging
has body: when i starting tomcat server I got this error INFO: Server startup in 1751 ms 20 mai 2014 10:42:47 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc GRAVE: The web application [/servlet] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 20 mai 2014 10:42:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak. 20 mai 2014 10:42:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads GRAVE: The web application [/servlet] appears to have started a thread named [CronTriggers_Worker-1] but has failed to stop it. This is very likely to create a memory leak. 20 mai 2014 10:42:47 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads GRAVE: The web application [/servlet] appears to have started a thread named [CronTriggers_Worker-2] but has failed to stop it. This is very likely to create a memory leak. can you help me please
type: AnsweredQuestion
has title: Starting tomcat server with error
tagged with: java
accepted answer: http://stackoverflow.com/a/23755561

option-type
tags question: http://stackoverflow.com/q/23773024
tags question: http://stackoverflow.com/q/23635559
tag name: option-type
type: Tag

http://stackoverflow.com/comment/36546121
comment on: http://stackoverflow.com/a/23760761
type: Comment
has text: @Tanata05 just rightclick on the project node in the projects view, select new, standard deployyment descriptor and the web.xml file will be created with basic settings. Then, find it in WEB-INF, doubleclick it and edit with the provided wizards or directly by editing the xml file. Before it was generated automatically when you generated a project, but since JEE6 it's optional and that's why it's not generated by default.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23637788
has answer: http://stackoverflow.com/a/23637992
tagged with: java
has comment: http://stackoverflow.com/comment/36298587
accepted answer: http://stackoverflow.com/a/23638169
has title: Can it be relied on a singleton instance as a shared resource?
has comment: http://stackoverflow.com/comment/36298329
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36298484
has answer: http://stackoverflow.com/a/23638169
favorite count: 0
has body: In a program, I am planning to use singleton hashmap, being generated in Spring IoC, as shared resourced in between different threads, but I need to make sure that this instance is not going to be regenerated ever, otherwise, I lose my cached data. Can I rely on it? default-lazy-init="true" &lt;util:map id="sharedResource" map-class="java.util.HashMap" key-type="KeyClass" value-type="ValueClass"/&gt;
has comment: http://stackoverflow.com/comment/36298657
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36298577
downvote count: 0
score: 1
type: Question
possible better answer: http://stackoverflow.com/a/23637992
has comment: http://stackoverflow.com/comment/36298396

http://stackoverflow.com/comment/36293667
comment on: http://stackoverflow.com/q/23635211
score: 0
type: Comment
type: QuestionComment
has text: `array[x]++` doesn't increase array size, like your comment says... it increases the value of the number stored at position `x` by 1. Initially the value at position `x` is 0. So when you call `array[x]++`, where x=5(for example), the value at position 5 will increase by 1, meaning that there was an occurrence of 5. There still a chunk of code missing (output I guess)

http://stackoverflow.com/comment/36478931
has text: the `fx:id` must be placed inside ` ` and replace the line with as suggested
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23731126
type: AnswerComment

http://stackoverflow.com/comment/36553861
score: 0
type: Comment
has text: I open the windows by having a button under File -> open, then the user selects an image and then the internal frame opens within the desktop pane.
comment on: http://stackoverflow.com/a/23770301
type: AnswerComment

http://stackoverflow.com/a/23728788
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23728670
accepted answer of: http://stackoverflow.com/q/23728670
type: Answer
has comment: http://stackoverflow.com/comment/36474571
upvote count: 1
score: 1
has body: Could it be that you're using hadoop pre-0.23.0 library against later version metadata file? Type 2 was introduced in DataChecksum 3 years ago as part of HADOOP-7443 http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DataChecksum.java?r1=1146111&amp;r2=1146300.

http://stackoverflow.com/comment/36449093
comment on: http://stackoverflow.com/q/23716227
score: 3
has text: The don't have Unicode representations because they're *function* keys. They do things. Not type things.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23649187
tagged with: callable-statement
tagged with: sql
tagged with: jdbc
score: 0
has answer: http://stackoverflow.com/a/23649258
type: AnsweredQuestion
has body: I thought it would be a simple google search, but I can't find an answer to this: I'm moving Access db to SQL Server, I have turned some of the queries into views. My Java application used to call every query using simple: { call dbo.GetOtherRanges() } //Well, not entirely true - Access did not use 'dbo' schema in front of the name This works for stored procedures. But when I do that on views I receive the following: [SQL Server]The request for procedure 'GetOtherRanges' failed because 'GetOtherRanges' is a view object. I thought it would be as simple as removing the () brackets after the name of the view, but that didn't do the trick. How do I 'call' the views using JDBC CallableStatment? Is there a different way of calling table-valued functions as well?
has title: How to call a 'view' using callablestatement
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23649258

http://stackoverflow.com/a/23758196
has body: Try with this: while read line do echo $line; jar=`basename $line` mvn install:install-file -Dfile=$line -DgroupId=com.strategyard.thirdparty -DartifactId=$jar -Dversion=1.0 -Dpackaging=jar done &lt;&lt;&lt; $(find . -name "*.jar")
score: -1
has comment: http://stackoverflow.com/comment/36535905
upvote count: 0
has comment: http://stackoverflow.com/comment/36538475
type: Answer
answers question: http://stackoverflow.com/q/23757756
downvote count: 1

http://stackoverflow.com/comment/36336791
type: QuestionComment
comment on: http://stackoverflow.com/q/23656982
has text: You may end up with the answer "It had to be one way round and what you consider more readable isn't necessarily what everyone considers more readable"
type: Comment
score: 1

http://stackoverflow.com/comment/36359893
has text: this lead me down a better path. I created a BeanFactoryPostProcessor that wrapped each PropertySource of the environment property sources with a custom PropertySource that could decrypt the properties as they are fetched from their original property source.
type: AnswerComment
comment on: http://stackoverflow.com/a/23633649
score: 0
type: Comment

http://stackoverflow.com/q/23673237
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/23673380
linked to: http://stackoverflow.com/q/6065258
favorite count: 0
has comment: http://stackoverflow.com/comment/36367461
has comment: http://stackoverflow.com/comment/36367937
tagged with: android
has comment: http://stackoverflow.com/comment/36367567
has comment: http://stackoverflow.com/comment/36367862
type: AnsweredQuestion
has body: I can't see the reason why my program is not working. Whenever I try to run it, it just force closes. Here are my programs: My MainActivity package com.example.teacher; public class MainActivity extends ActionBarActivity { private DatabaseHelper dbHelper = new DatabaseHelper(MainActivity.this,"MyDatabase",2); TextView text; EditText txtPassword; EditText teachersId; EditText teachersName; Button btnAdd; Button btnDelete; Button btnSearch; Button btnPresent; Button btnAbsent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (TextView) findViewById(R.id.textView1); txtPassword = (EditText) findViewById(R.id.txtPassword); teachersId = (EditText) findViewById(R.id.txtTeachersID); teachersName = (EditText) findViewById(R.id.txtTeachersName); btnPresent = (Button) findViewById(R.id.btnPresent); btnAbsent = (Button) findViewById(R.id.btnAbsent); btnAdd = (Button) findViewById(R.id.btnAddTeacher); btnDelete = (Button) findViewById(R.id.btnDeleteTeacher); SQLiteDatabase db = dbHelper.getWritableDatabase(); try { db.execSQL("create table Users(ID integer, name varchar(90), pass varchar(90), attendance varchar(30));"); text.setText("Successful in creating table."); } catch(Exception e) { text.setText("Error in creating table."); e.printStackTrace(); } btnAdd.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if("".equals(teachersId.getText().toString()) || "".equals(txtPassword.getText().toString())) { Toast toast = Toast.makeText(MainActivity.this, "Something needs to be typed in.", Toast.LENGTH_LONG); toast.show(); } else { long flag = 0; int id = 1; SQLiteDatabase db = dbHelper.getWritableDatabase(); Cursor cursor = db.query("Users", new String[]{"count(*) ID"}, null, null, null, null, null); while(cursor.moveToNext()) { int idFromDatabase = cursor.getInt(cursor.getColumnIndex("ID")); if(idFromDatabase != 0) { id = 1 + idFromDatabase; } } ContentValues…
has comment: http://stackoverflow.com/comment/36367745
has comment: http://stackoverflow.com/comment/36367465
type: Question
has comment: http://stackoverflow.com/comment/36367525
score: -5
has comment: http://stackoverflow.com/comment/36367611
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/36367410
has title: ANDROID: Force close issue
has answer: http://stackoverflow.com/a/23673380
upvote count: 0

http://stackoverflow.com/q/23655225
has body: I think this is so wrong, but I need it... So, to run Processing's sketch in Java mode, you have to extends PApplet in the main class, and there, in the setup() determine the window size using size(int x, int y). Then when you run it, it'll show a Java window Applet Viewer. What I wanna ask is, how to prevent that window from appearing? I've tried to remove the size method, but it appeared in (what seems like) it's default size. Tried put 0 as params, went wrong (the x and y have to be > 0). Is there any way to do that? If there's any lack information or I've made a mistake with the post, please tell me. 1st edit - add more info Let's say I have 2 classes: the one that implemented Processing and extends PApplet is named Pikachu by me, and an ordinary Java class I named Jojo. Jojo will pass params to Pikachu and Pikachu will process that param. The param is image's name, or if it could, an image itself (I don't know yet tho, can Processing execute Image class from Java?). Then Processing will process that image, gave an output, again as image (Yet, again I don't know yet, can Processing gave output an image for Java to use?). So, that's why I don't need a window to appear.
has comment: http://stackoverflow.com/comment/36335441
has comment: http://stackoverflow.com/comment/36335196
has comment: http://stackoverflow.com/comment/36336531
tagged with: processing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36334272
tagged with: java
has comment: http://stackoverflow.com/comment/36388396
has comment: http://stackoverflow.com/comment/36334361
has comment: http://stackoverflow.com/comment/36377438
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36377852
has comment: http://stackoverflow.com/comment/36338774
has answer: http://stackoverflow.com/a/23680562
has comment: http://stackoverflow.com/comment/36339006
answer count: 1
has comment: http://stackoverflow.com/comment/36335948
has title: How to make PApplet doesn't show a window
has comment: http://stackoverflow.com/comment/36333781
accepted answer: http://stackoverflow.com/a/23680562

http://stackoverflow.com/comment/36450556
type: Comment
type: QuestionComment
has text: @JamesPoulson: Ok! got it..
comment on: http://stackoverflow.com/q/23716836
score: 1

http://stackoverflow.com/a/23735729
accepted answer of: http://stackoverflow.com/q/23735303
has comment: http://stackoverflow.com/comment/36486530
has body: Your whole comparator is broken, I kept seeing more problems with it. Just do something like this: if (x%2 != y%2) { if (x%2==0) { return -1; } else { return 1; } } else { return x.compareTo(y); } First check to see if they are not both odd or both even. If they are different then sort based on odd or even. Then if they are both odd or both even fall back to the standard Integer compare functionality.
type: Answer
answers question: http://stackoverflow.com/q/23735303
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36486637
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/36421992
has text: No, I'm using eclipse for this project.
type: Comment
comment on: http://stackoverflow.com/a/23698416
score: 0
type: AnswerComment

swingworker
tags question: http://stackoverflow.com/q/23646542
tags question: http://stackoverflow.com/q/23627365
tags question: http://stackoverflow.com/q/23699256
tags question: http://stackoverflow.com/q/23742354
tag name: swingworker
tags question: http://stackoverflow.com/q/23663540
type: Tag

http://stackoverflow.com/comment/36344054
type: Comment
type: QuestionComment
has text: oh sorry my bad. But i Initialize my uiComponent. like this UIComponent uiComponent = UIComponent.getCurrentComponent(facesContext); is it right way iam not sure about it
comment on: http://stackoverflow.com/q/23659381
score: 0

http://stackoverflow.com/a/23666741
has body: If there's an accepted standard way to do this, it's to use Lucene. There are some regex gimmicks you can use, like this one from RegexBuddy's library (where word1 and word2 are placeholders for the search terms, and the 3 in {1,3}? is the maximum distance): \b(?:word1(?:\W+\w+){1,3}?\W+word2|word2(?:\W+\w+){1,3}?\W+word1)\b Trouble is, this relies on an extremely simplistic, arbitrary notion of what constitutes a word. It doesn't match contractions or hyphenated words, but it does match "words" with digits and underscores in them. You could tweak the regex to deal with those problems, but more will pop up to replace them. And ugly as it already was, each tweak makes the regex that much less readable, that much harder to maintain. This barely scratches the surface of what full-text search engines save you from. If you have a very specific, tightly constrained task to accomplish, regexes or other "syntax-level" tools might suit. But if you need to work at the semantic level, recognizing natural-language words and phrases, you want a search engine or other dedicated tool.
has comment: http://stackoverflow.com/comment/36386920
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23648558
answers question: http://stackoverflow.com/q/23648558

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/23633156
tags question: http://stackoverflow.com/q/23636814
tag name: session-timeout
tags question: http://stackoverflow.com/q/23649578

http://stackoverflow.com/comment/36283865
score: 0
type: AnswerComment
has text: I have put details about that too in the end of the post. Please check.
type: Comment
comment on: http://stackoverflow.com/a/23630102

http://stackoverflow.com/a/23673524
upvote count: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23673274
has body: List&lt;B&gt; does not extend List&lt;A&gt;. There are good reasons for that; informally, consider that the contract for List&lt;A&gt; "you can put an instance of A in it" is not valid for List&lt;B&gt;. You need to indicate that you are willing to accept lists with subtypes of A. You can do that with a wildcard like List&lt;? extends A&gt;. However then your return type also becomes List&lt;? extends A&gt; and you don't want that. What you really want is that if you pass in List&lt;B&gt;, the return type is List&lt;B&gt;. To do this properly without casts, you need to bind the type and specify it can sublass A. public static &lt;T extends A&gt; List&lt;T&gt; doSomething(List&lt;T&gt; items, T item) { // manipulate items return items; } This should work.
score: 5
has comment: http://stackoverflow.com/comment/36368126
accepted answer of: http://stackoverflow.com/q/23673274

http://stackoverflow.com/a/32821965
answers question: http://stackoverflow.com/q/23625439
downvote count: 1
score: -1
upvote count: 0
has body: I had this same problem. For a reason unknown to me, putting the mysql-connector-java*.jar in WEB-INF/lib no longer works in Ubuntu LTS 14.04 I solved it by copying this file (and this file alone) to /usr/share/tomcat7/lib and restarted tomcat7 as a service service tomcat7 restart and everything sprang to life. Best of luck
type: Answer

substance
tag name: substance
type: Tag
tags question: http://stackoverflow.com/q/23670848

http://stackoverflow.com/comment/36318238
comment on: http://stackoverflow.com/q/23647765
type: Comment
score: 0
has text: First of all a web application is mostly exported as a war. So you can use the war to deploy on client server.
type: QuestionComment

http://stackoverflow.com/a/23769040
has body: Try this new java.text.SimpleDateFormat("yyyy-MM-dd").parse( $P{Enddatum}) - 1
has comment: http://stackoverflow.com/comment/36551098
type: Answer
has comment: http://stackoverflow.com/comment/36550864
answers question: http://stackoverflow.com/q/23768536
has comment: http://stackoverflow.com/comment/36551298
score: 0

http://stackoverflow.com/q/23630097
type: UnansweredQuestion
has body: I'd like to make use of spring-security with ROLE_ADMIN and ROLE_USER roles. I therefore try to create a typesafe enum class, but the @Secured annotation requires a constant String, which I cannot achieve by using an enum class. What could I change in the following code? public enum UserRole { ADMIN("ROLE_ADMIN"); private String role; public UserRole(String role) { this.role = role; } } //error: The value for annotation attribute Secured.value must be a constant expression @Secured(USerRole.ADMIN.value()) public class SecuredView { }
has answer: http://stackoverflow.com/a/47454813
has comment: http://stackoverflow.com/comment/108218872
tagged with: enums
tagged with: java
type: Question
upvote count: 27
has comment: http://stackoverflow.com/comment/36285054
downvote count: 0
has title: How to create typesafe user roles for Spring Security?
tagged with: spring-security
score: 27
linked to: http://stackoverflow.com/q/8835818
has answer: http://stackoverflow.com/a/54713712
linked to: http://stackoverflow.com/q/19303584
has answer: http://stackoverflow.com/a/78419773
has answer: http://stackoverflow.com/a/67924816
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/36417807
has text: you'll want to add the generic type to the instantiation of listOfItems, too `listOfItems = new ArrayList<Product>()`
score: 0
comment on: http://stackoverflow.com/q/23698711
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36308847
score: 0
type: QuestionComment
has text: Can you show us the `returnAllObjects` method?
type: Comment
comment on: http://stackoverflow.com/q/23642734

testng
tags question: http://stackoverflow.com/q/23640262
tags question: http://stackoverflow.com/q/23674962
tags question: http://stackoverflow.com/q/23686636
tags question: http://stackoverflow.com/q/23700805
tags question: http://stackoverflow.com/q/23624355
tags question: http://stackoverflow.com/q/23774353
tag name: testng
tags question: http://stackoverflow.com/q/23624985
tags question: http://stackoverflow.com/q/23634928
tags question: http://stackoverflow.com/q/23774773
type: Tag

http://stackoverflow.com/comment/36367284
type: Comment
comment on: http://stackoverflow.com/a/23672611
score: 0
type: AnswerComment
has text: Thanks, I thought I had unique genes in my result set but you are right.

http://stackoverflow.com/comment/36470070
comment on: http://stackoverflow.com/a/23726836
has text: There is a class called Media in JavaFX and its constructer can take the file path actually.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23737481
answer count: 2
upvote count: 0
has title: Write String to multiple txt files
has answer: http://stackoverflow.com/a/23737573
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23737574
downvote count: 2
tagged with: swing
type: Question
has body: The following code writes a string to a specific file. String content = "Text To be written on a File"; File file = new File("c:/file.txt"); FileOutputStream foutput = new FileOutputStream(file); if (!file.exists()) { file.createNewFile(); } byte[] c = content.getBytes(); foutput.write(c); foutput.flush(); foutput.close(); I want to use this code in a Jbutton so every time the user clicks it, it writes the string to a NEW text file NOT OVERWRITE the existed one. I tried to do but I couldn't get the result. Thank you in advance.
score: -2
tagged with: java

http://stackoverflow.com/comment/36514286
type: Comment
comment on: http://stackoverflow.com/a/23749991
score: 0
type: AnswerComment
has text: I'm adding the array because at some point down the line, it will contain an array of strings, not just the one. Right now I'm trying to figure out how to do it with the arraylist having only one string value, to learn. Also, I was trying the double check, ([i][j] & [j][i]) because I was hoping to see if it would work in an adjacency list, (which takes a lot more than this I know, but I go with baby steps so I actually understand how to do things)

http://stackoverflow.com/q/23695847
has answer: http://stackoverflow.com/a/23696085
has body: I have this ugly piece of code: for (int i = 1; i &lt;= 1100; i++) { if (i&lt;=SpbAndRegionPerSession){ submit(new SiteRequest(SpbAndRegion + i, SiteRequestType.SEARCH_PAGE)); } if (i&lt;=KrasnodarRegionPerSession){ //stuff } if (i&lt;=NovosibRegionPerSession){ //stuff } if (i&lt;=RostovRegionPerSession){ //stuff } if (i&lt;=TatarstanPerSession){ //stuff } if (i&lt;=MoscowAndRegionPerSession){ //stuff } } I want to shorten it. In JS I would do it this way: var regions = [{perSession:500,link:'somehref.com/page='}]; for (var i=0;i&lt;regions.length;i++){ for (var n;n&lt;regeions[i].perSession;n++){ submit(SiteRequest(regeions[i].link + i, SEARCH_PAGE)); } } How can I do that in Java? I am very new to it.
accepted answer: http://stackoverflow.com/a/23696085
score: 0
answer count: 3
has title: Java: create an array of structures and iterate over it
favorite count: 0
has answer: http://stackoverflow.com/a/23696467
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/23696162
has answer: http://stackoverflow.com/a/23696162
type: Question

http://stackoverflow.com/q/23750966
score: 4
has answer: http://stackoverflow.com/a/23751707
accepted answer: http://stackoverflow.com/a/23751707
tagged with: rest
answer count: 1
favorite count: 0
has title: Using Gson how to add variable name as top level parameter for json of a REST call
upvote count: 4
has comment: http://stackoverflow.com/comment/36516399
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am trying call a REST service and using gson I am getting the following json for the following java pojo. pojo public class AlphaParameters { private int one; private int two; private int three; //getter setters //constructors } Json {"one":4, "two":5, "three":10 } I am using the following code Gson gson = new Gson() AlphaParameters alphaParameters = new AlphaParameters(one,two,three); gson.toJson(alphaParameters ); Earlier this code used to work, but now seems the server side which is on .net changed their implementation and now they are expecting the json in the following format. Everything is same but seems now they want the toplevel variable name in the json. {"alphaParameters": {"one":4, "two":5, "three":10 } } Question : Is there a specific api of Gson which I can use to generate the above json without refactoring my code ? Or writing a wrapper class to include alphaParameters will be a better approach . ( I will have to write a lot of boilerplate code for latter ). Thanks for your help.
tagged with: gson
has comment: http://stackoverflow.com/comment/36516264
type: Question

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23673447
tags question: http://stackoverflow.com/q/23661116
tags question: http://stackoverflow.com/q/23652405
tags question: http://stackoverflow.com/q/23771872
tags question: http://stackoverflow.com/q/23676373
tags question: http://stackoverflow.com/q/23747268
tags question: http://stackoverflow.com/q/23652823
tags question: http://stackoverflow.com/q/23645291
tags question: http://stackoverflow.com/q/23648495
tags question: http://stackoverflow.com/q/23673745
tags question: http://stackoverflow.com/q/23627199
tags question: http://stackoverflow.com/q/23726523
type: Tag
tags question: http://stackoverflow.com/q/23730325
tags question: http://stackoverflow.com/q/23709303
tags question: http://stackoverflow.com/q/23699715
tags question: http://stackoverflow.com/q/23744756
tags question: http://stackoverflow.com/q/23681499
tags question: http://stackoverflow.com/q/23658946
tags question: http://stackoverflow.com/q/23760002
tags question: http://stackoverflow.com/q/23688500
tags question: http://stackoverflow.com/q/23668808
tags question: http://stackoverflow.com/q/23709897
tags question: http://stackoverflow.com/q/23777209
tags question: http://stackoverflow.com/q/23736457
tags question: http://stackoverflow.com/q/23754634
tags question: http://stackoverflow.com/q/23627758
tags question: http://stackoverflow.com/q/23660919
tags question: http://stackoverflow.com/q/23775620
tags question: http://stackoverflow.com/q/23776313
tags question: http://stackoverflow.com/q/23672617
tags question: http://stackoverflow.com/q/23623029
tags question: http://stackoverflow.com/q/23712950
tags question: http://stackoverflow.com/q/23639823
tags question: http://stackoverflow.com/q/23679769
tags question: http://stackoverflow.com/q/23676605
tags question: http://stackoverflow.com/q/23619422
tags question: http://stackoverflow.com/q/23769407
tags question: http://stackoverflow.com/q/23634749
tags question: http://stackoverflow.com/q/23760191
tags question: http://stackoverflow.com/q/23729962
tags question: http://stackoverflow.com/q/23709119
tags question: http://stackoverflow.com/q/23634696
tags question: http://stackoverflow.com/q/23636528
tags question: http://stackoverflow.com/q/23680536
tags question: http://stackoverflow.com/q/23763819
tags question: http://stackoverflow.com/q/23699594
tags question: http://stackoverflow.com/q/23687085
tags question: http://stackoverflow.com/q/23649668
tags question: http://stackoverflow.com/q/23627082
tags question: http://stackoverflow.com/q/23752329
tags question: http://stackoverflow.com/q/23735218
tags question: http://stackoverflow.com/q/23686325
tags question: http://stackoverflow.com/q/23769839
tags question: http://stackoverflow.com/q/23628160
tags question: http://stackoverflow.com/q/23626896
tags question: http://stackoverflow.com/q/23669385
tags question: http://stackoverflow.com/q/23772071
tags question: http://stackoverflow.com/q/23690242
tags question: http://stackoverflow.com/q/23678908
tags question: http://stackoverflow.com/q/23661820
tags question: http://stackoverflow.com/q/23615771
tags question: http://stackoverflow.com/q/23669595
tags question: http://stackoverflow.com/q/23632644
tags question: http://stackoverflow.com/q/23751949
tags question: http://stackoverflow.com/q/23752899
tags question: http://stackoverflow.com/q/23641608
tags question: http://stackoverflow.com/q/23657706
tags question: http://stackoverflow.com/q/23625705
tags question: http://stackoverflow.com/q/23627989
tags question: http://stackoverflow.com/q/23670548
tags question: http://stackoverflow.com/q/23754731
tags question: http://stackoverflow.com/q/23627372
tag name: xml
tags question: http://stackoverflow.com/q/23723413
tags question: http://stackoverflow.com/q/23704221
tags question: http://stackoverflow.com/q/23628157
tags question: http://stackoverflow.com/q/23620855
tags question: http://stackoverflow.com/q/23688694
tags question: http://stackoverflow.com/q/23638610

http://stackoverflow.com/q/23720140
accepted answer: http://stackoverflow.com/a/23720279
possible better answer: http://stackoverflow.com/a/23720382
has answer: http://stackoverflow.com/a/23720632
has title: Using Factory pattern with multiple arguments in Java
has answer: http://stackoverflow.com/a/23720382
tagged with: constructor
upvote count: 2
tagged with: design-patterns
tagged with: factory
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36456804
tagged with: java
has body: I have the following class structure: a base class 'Message' which contains some common members (/fields), 'Imessage' interface that has some methods that all messages should implement, a lot of different message classes that extends (inherits) the base 'Message' class and have a lot of fields, an enum for each message type and a factory class which given an enum creates an instance of the proper message class. The issue is that I'm not sure where/how to implement the setting of values for each of the message classes. It can't be in it's constructor because in the factory method i need to build generic instances. Should i implement a 'Create' method for each of the messages that will set all of it's members? public static Message buildMessage(MessageType messageType) { Message message = null; switch (messageType) //TODO: add all messages! { case CONNECT: message = new ConnectMessage(); break; case CONNECT_RESPONSE: message = new ConnectResponseMessage(); break; case DISCONNECT: message = new DisconnectMessage(); break; case FLOWSTART: message = new FlowStartMessage(); break; default: return null; } return message; }
has answer: http://stackoverflow.com/a/23720279
type: Question
downvote count: 0
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/36312694
comment on: http://stackoverflow.com/a/23628801
has text: thanks for your help. However, It seems that still doesn't work.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36411935
type: Comment
type: QuestionComment
score: 2
has text: Cool. That's what I hoped it'd do. It would've been a major design flop otherwise.
comment on: http://stackoverflow.com/q/23696317

http://stackoverflow.com/q/23771186
has comment: http://stackoverflow.com/comment/36555274
linked to: http://stackoverflow.com/q/9851813
type: AnsweredQuestion
tagged with: oop
linked to: http://stackoverflow.com/q/3404301
has title: Array initialized at declaration not actually initialized until after call to super constructor
tagged with: java
has comment: http://stackoverflow.com/comment/36555517
accepted answer: http://stackoverflow.com/a/23771259
has comment: http://stackoverflow.com/comment/36555228
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23771272
has answer: http://stackoverflow.com/a/23771272
has comment: http://stackoverflow.com/comment/36554934
has comment: http://stackoverflow.com/comment/36555641
has comment: http://stackoverflow.com/comment/36554896
has comment: http://stackoverflow.com/comment/36555194
has body: I am experiencing a seemingly odd problem, although I understand there is probably some reason behind this design, and would like to find out why it is this way. Consider two classes, Foo and Bar. Bar extends Foo and overrides a method that Foo implements. Foo is quite simple: public class Foo { public Foo() { System.out.println("Foo constructor"); someMethod(); } public void someMethod() { System.out.println("Foo.someMethod"); } } Bar is where the problem is. It defines an array which is initialized outside the constructor (I don't know what the term is for this). I noticed that when someMethod is called from Foo, the array has not yet been initialized, but when right after the call to super(), the array IS initialized. Here is Bar: public class Bar extends Foo { int[] a = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; public Bar() { super(); System.out.println("FooBar constructor"); if (a == null) System.out.println("FooBar a is null"); } public void someMethod() { if (a == null) System.out.println("FooBar.someMethod a is null"); } } This doesn't quite make sense. I want to access the array from a method which is called in the super constructor, but the array isn't initialized. I have tried to think of a solution. My first idea was to initialize the array in Bar's constructor, but that still won't initialize it before the call to super. For reference, the output is as follows: Foo constructor FooBar.someMethod a is null FooBar constructor Why is Java designed like this, and what is the best way around it?
has comment: http://stackoverflow.com/comment/36555000
has answer: http://stackoverflow.com/a/23771259
score: 0

http://stackoverflow.com/comment/36449593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23716409
has text: Can you post more of the code, like where you're calling the Account constructor and adding it to the list? From what you have here, it looks like every Account will have the `accNum` of `1` (initialized to 0 and incremented once in the constructor).

http://stackoverflow.com/a/23735184
answers question: http://stackoverflow.com/q/23702431
type: Answer
accepted answer of: http://stackoverflow.com/q/23702431
score: 0
type: AcceptedAnswer
has body: I think your issue is coming around these lines in your method: if( !testNode.hasNode(name) ) { testNode.addNode( name, "nt:unstructured" ); } return testNode.getPath()+"/"+name; The expectations you have set up for it are as follows: EasyMock.expect(CONTENT_NODE_MOCK.hasNode("viv")).andReturn(false); EasyMock.expect(CONTENT_NODE_MOCK.addNode("viv","nt:unstructured")).andReturn(CHILD_NODE_MOCK); EasyMock.expect(CHILD_NODE_MOCK.getPath()).andReturn("/content/viv"); The problem is that your code doesn't use the response from the addNode() method, but your test expectations are set up such that the code would use the response from the addNode() method. The way I see it you have 2 options: If the code is correct, then you need to adjust your expectations to something like this: EasyMock.expect(CONTENT_NODE_MOCK.hasNode("viv")).andReturn(false); EasyMock.expect(CONTENT_NODE_MOCK.addNode("viv","nt:unstructured")).andReturn(CHILD_NODE_MOCK); EasyMock.expect(CONTENT_NODE_MOCK.getPath()).andReturn("/content/viv"); If the test is correct (that'd be nice, TDD and all that) then you need to alter your code to look like this: Node childNode = testNode; //Or some other valid creation if( !testNode.hasNode(name) ) { childNode = testNode.addNode( name, "nt:unstructured" ); } return childNode.getPath()+"/"+name;

http://stackoverflow.com/q/23776610
favorite count: 0
has answer: http://stackoverflow.com/a/23777159
has title: SVM prediction of images OpenCV
has body: I'm able to train the system but when I try to predict, Bad argument exception is raised. OpenCV Error: Bad argument (The sample is not a valid vector) in cvPreparePredictData, file ........\opencv\modules\ml\src\inner_functions.cpp, line 1099 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\ml\src\inner_functions.cpp:1099: error: (-5) The sample is not a valid vector in function cvPreparePredictData ] This is my code: System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat classes = new Mat(); Mat trainingData = new Mat(); Mat trainingImages = new Mat(); Mat trainingLabels = new Mat(); CvSVM clasificador; String path="C:\\java workspace\\ora\\images\\Color_Happy_jpg"; for (File file : new File(path).listFiles()) { Mat img=new Mat(); Mat con = Highgui.imread(path+"\\"+file.getName(),Highgui.CV_LOAD_IMAGE_GRAYSCALE); con.convertTo(img, CvType.CV_32FC1,1.0/255.0); img.reshape(1, 1); trainingImages.push_back(img); trainingLabels.push_back(Mat.ones(new Size(1, 75), CvType.CV_32FC1)); } System.out.println("divide"); path="C:\\java workspace\\ora\\images\\Color_Sad_jpg"; for (File file : new File(path).listFiles()) { Mat img=new Mat(); Mat m=new Mat(new Size(640,480),CvType.CV_32FC1); Mat con = Highgui.imread(file.getAbsolutePath(),Highgui.CV_LOAD_IMAGE_GRAYSCALE); con.convertTo(img, CvType.CV_32FC1,1.0/255.0); img.reshape(1, 1); trainingImages.push_back(img); trainingLabels.push_back(Mat.zeros(new Size(1, 75), CvType.CV_32FC1)); } trainingLabels.copyTo(classes); CvSVMParams params = new CvSVMParams(); params.set_kernel_type(CvSVM.LINEAR); CvType.typeToString(trainingImages.type()); CvSVM svm=new CvSVM(); clasificador = new CvSVM(trainingImages,classes, new Mat(), new Mat(), params); clasificador.save("C:\\java workspace\\ora\\images\\svm.xml"); Mat out=new Mat(); clasificador.load("C:\\java workspace\\ora\\images\\svm.xml"); Mat sample=Highgui.imread("C:\\java workspace\\ora\\images\\Color_Sad_jpg\\EMBfemale20-2happy.j…
upvote count: 2
score: 1
downvote count: 1
tagged with: opencv
type: AnsweredQuestion
tagged with: java
tagged with: svm
type: Question
accepted answer: http://stackoverflow.com/a/23777159
answer count: 1

http://stackoverflow.com/q/23737523
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/23738415
has answer: http://stackoverflow.com/a/23739828
accepted answer: http://stackoverflow.com/a/23739828
score: 2
type: AnsweredQuestion
has body: I'm new at Java and have been having some issues while passing a variable from one class to another main class. A little about the program - I have one main class called "Server.java" and another main class called "Client.java" This is a simple TCP Server-client program written in java. The server class is executed first so it can accept connection from the client, which is executed second. Once the client is connected to the server, the client specifies the name of the file it wishes to receive from the server by typing, for instance, "alice.txt" and then the server sends the file with that name in it's directory to the client. Where I'm stuck - I'm only able to receive file on the client side if I hard code the name of the file first in the server (check the code below). I wish to take the file name from the client side and pass to the Server class so the code works for all the files and not just one, which was hard coded. Any help is appreciated :) Server.java import java.io.*; import java.net.*; class Server { public static void main(String argv[]) throws Exception { //beginning of the try method try { //create a new serversocket object with port no 6789 ServerSocket welcomeSocket = new ServerSocket(6789); //while loop while(true) { //create a new socket object and accept the connection and it waits for any connection from client Socket connectionSocket = welcomeSocket.accept(); //display confirmation to the user System.out.println("Connection accepted!"); System.out.println("File request recevied!"); //specify the file the server wants to send File myFile = new File("alice.txt"); //THIS IS WHERE THE FILE FROM THE CLIENT IS HARD-CODED. I AM TRYING TO REPLACE THE FILE NAME WITH A VARIABLE THAT WAS PASSED FROM THE CLIENT SIDE //get the byte array length of the file byte [] bArray = new byte [(int)myFile.length()]; //open a new file object FileInputStream f = new FileInputStream(myFile); //new buffered input stream object BufferedInputStream bs = new BufferedInputS…
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/36490776
type: Question
tagged with: network-programming
has answer: http://stackoverflow.com/a/23738415
has comment: http://stackoverflow.com/comment/36490872
has title: TCP Server and Client java
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23677544
tagged with: external
linked to: http://stackoverflow.com/q/8231059
answer count: 0
has body: I add an external jar to libs folder, and i can see this methods from the code and no error appears. When i compile the app launch no problem but when i press the botton that use the method of the external jar the app crash, this is the Logcat: 05-15 13:37:49.782: E/dalvikvm(17475): Could not find class 'es.jerogaren.funciones.aleatorio1', referenced from method com.example.ejemplo.FullscreenActivity$5.onClick 05-15 13:37:49.782: W/dalvikvm(17475): VFY: unable to resolve new-instance 1034 (Les/jerogaren/funciones/aleatorio1;) in Lcom/example/ejemplo/FullscreenActivity$5; 05-15 13:37:49.782: D/dalvikvm(17475): VFY: replacing opcode 0x22 at 0x0007 05-15 13:37:49.782: D/dalvikvm(17475): DexOpt: unable to opt direct call 0x2125 at 0x09 in Lcom/example/ejemplo/FullscreenActivity$5;.onClick 05-15 13:37:49.812: I/Adreno-EGL(17475): &lt;qeglDrvAPI_eglInitialize:320&gt;: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13 05-15 13:37:49.842: D/OpenGLRenderer(17475): Enabling debug mode 0 05-15 13:37:51.624: W/dalvikvm(17475): threadid=1: thread exiting with uncaught exception (group=0x415e4ba8) 05-15 13:37:51.634: E/AndroidRuntime(17475): FATAL EXCEPTION: main 05-15 13:37:51.634: E/AndroidRuntime(17475): Process: com.example.ejemplo, PID: 17475 05-15 13:37:51.634: E/AndroidRuntime(17475): java.lang.NoClassDefFoundError: es.jerogaren.funciones.aleatorio1 05-15 13:37:51.634: E/AndroidRuntime(17475): at com.example.ejemplo.FullscreenActivity$5.onClick(FullscreenActivity.java:137) 05-15 13:37:51.634: E/AndroidRuntime(17475): at android.view.View.performClick(View.java:4438) 05-15 13:37:51.634: E/AndroidRuntime(17475): at android.os.Handler.handleCallback(Handler.java:733) 05-15 13:37:51.634: E/AndroidRuntime(17475): at java.lang.reflect.Method.invoke(Method.java:515) 05-15 13:37:51.634: E/AndroidRuntime(17475): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 05-15 13:37:51.634: E/AndroidRuntime(17475): at com.android…
type: UnansweredQuestion
tagged with: android
has title: App running crash with this error: could not find class external jar Android
has comment: http://stackoverflow.com/comment/36376214
has comment: http://stackoverflow.com/comment/36381729
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36375982
duplicate of: http://stackoverflow.com/q/8231059
has comment: http://stackoverflow.com/comment/36375977
tagged with: jar
score: 0
has comment: http://stackoverflow.com/comment/36375854

http://stackoverflow.com/comment/36447836
has text: I changed it to JSONException, still doesnt work. I have downloaded the jar from here: [link](http://www.java2s.com/Code/Jar/j/Downloadjavajsonjar.htm) I have also cleaned and build the project, no compilation error.
comment on: http://stackoverflow.com/q/23714119
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23729915
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36476098
upvote count: 0
has answer: http://stackoverflow.com/a/23729941
has body: Why does this program work counter to my expectations? I expect: 1 50 47 50 I get: 0 50 0 50 class Poppet { int i; Poppet(int i) { i = i; } } class Ideone { private final int i = 50; // Initialized final private final int j; // Blank final private final Poppet p; // Blank final reference // Blank finals MUST be initialized in the constructor: public Ideone() { j = 1; // Initialize blank final p = new Poppet(1); // Initialize blank final reference System.out.println(p.i); } public Ideone(int x) { j = x; // Initialize blank final p = new Poppet(x); // Initialize blank final reference System.out.println(p.i); } public static void main (String[] args) { Ideone t = new Ideone(); System.out.println(t.i); Ideone r = new Ideone(47); System.out.println(r.i); } } Can you please explain why?
has comment: http://stackoverflow.com/comment/36476743
favorite count: 0
accepted answer: http://stackoverflow.com/a/23729941
downvote count: 1
possible better answer: http://stackoverflow.com/a/23729939
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23729939
has title: Why does this Java program work counter to my expectations?
tagged with: java

http://stackoverflow.com/comment/36383844
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23681537
has text: I tried it and it did not result in any exception, i parsed and printed date and it gave me `Sun Dec 01 04:35:03 IST 2013`
score: 0

http://stackoverflow.com/a/23717658
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23717554
score: 1
has body: Thanks for editing your post. Much easier to help when I can see what's causing problems. You're checking hasNext() once every two lines. Should be checked every line because you shouldn't trust the text file to be what you expect and should display an informative error message when it isn't. You're also declaring the strings inside the scope of the loop so nothing outside the loop even knows what they are. Shoving subjectCode into into the subjectNames collection is probably not what you want. As it is, each nextline() is stepping on the last string value. That means you're forgetting all the work done in previous iterations of the loop. The collections.add() calls, not the strings, should be in the loop. Make sure to declare the collections before the loop and put their add calls in the loop. See if you get useful results. Give "Reading a plain text file in Java" a read.
downvote count: 0

http://stackoverflow.com/a/23637509
type: AcceptedAnswer
downvote count: 0
has body: This code comes from f.carlsen here, and I've used it myself. class HttpHandlerWithServletSupport implements HttpHandler { private HttpServlet servlet; private final class RequestWrapper extends HttpServletRequestWrapper { private final HttpExchange ex; private final Map&lt;String, String[]&gt; postData; private final ServletInputStream is; private final Map&lt;String, Object&gt; attributes = new HashMap&lt;&gt;(); private RequestWrapper(HttpServletRequest request, HttpExchange ex, Map&lt;String, String[]&gt; postData, ServletInputStream is) { super(request); this.ex = ex; this.postData = postData; this.is = is; } @Override public String getHeader(String name) { return ex.getRequestHeaders().getFirst(name); } @Override public Enumeration&lt;String&gt; getHeaders(String name) { return new Vector&lt;String&gt;(ex.getRequestHeaders().get(name)) .elements(); } @Override public Enumeration&lt;String&gt; getHeaderNames() { return new Vector&lt;String&gt;(ex.getRequestHeaders().keySet()) .elements(); } @Override public Object getAttribute(String name) { return attributes.get(name); } @Override public void setAttribute(String name, Object o) { this.attributes.put(name, o); } @Override public Enumeration&lt;String&gt; getAttributeNames() { return new Vector&lt;String&gt;(attributes.keySet()).elements(); } @Override public String getMethod() { return ex.getRequestMethod(); } @Override public ServletInputStream getInputStream() throws IOException { return is; } @Override public BufferedReader getReader() throws IOException { return new BufferedReader(new InputStreamReader( getInputStream())); } @Override public String getPathInfo() { return ex.getRequestURI().getPath(); } @Override public String getParameter(String name) { String[] arr = postData.get(name); return arr != null ? (arr.length &gt; 1 ? Arrays.toString(arr) : arr[0]) : null; } @Override public Map&lt;String, String[]&gt; getParameterMap() { return postData; } @Override public Enumeration&lt;String&gt; getParameterN…
accepted answer of: http://stackoverflow.com/q/23634837
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/104161892
answers question: http://stackoverflow.com/q/23634837
has comment: http://stackoverflow.com/comment/104169024

http://stackoverflow.com/comment/36430061
type: AnswerComment
has text: Wow, works great! I'll take good note of this .find() when using the matcher in the future =)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23705283

http://stackoverflow.com/a/23751875
answers question: http://stackoverflow.com/q/23751759
type: Answer
score: 2
downvote count: 0
has body: Well, I would say that almost always the right solution is to fix the layouting either by using a different layout manager, or by using a different hierarchy of containers (or both). However, since it seems you won't be persuaded (I infer that from your question), I can suggest a solution to the specific question you ask (again, I would recommend to take a different path of fixing the layout, which probably is your real problem). You can set the maximum height without affecting the maximum width, by overriding the setMaximumSize() method as follows: @Override public void setMaximumSize(Dimension size) { Dimension currMaxSize = getMaximumSize(); super.setMaximumSize(currMaxSize.width, size.height); } Another approach can be to keep the "overridden" setting of the max height, and return it when returning the maximum height, like so: private int overriddenMaximumHeight = -1; public void setMaximumHeight(int height) { overriddenMaximumHeight = height; } @Override public Dimension getMaximumSize() { Dimension size = super.getMaximumSize(); int height = (overriddenMaximumHeight &gt;=0) ? overriddenMaximumHeight : size.height; return new Dimension(size.width, height); } Again (lastly), I would recommend taking a more common approach, but if you insist ...
upvote count: 2

http://stackoverflow.com/q/23705372
has comment: http://stackoverflow.com/comment/36429447
answer count: 1
tagged with: javafx-2
favorite count: 0
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/23705437
score: 0
tagged with: java
has body: I am trying to understand how widgets in JavaFX work, and given the following FXML I don't get why a ScrollPaneis putting a split in after the ListView: <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Label?> <?import javafx.scene.control.ListView?> <?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.ToolBar?> <?import javafx.scene.Group?> <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.Pane?> <ListView/> I just want to have a ListView with a possiblity to scroll if the list is too long. Using JavaFX included in the latest JDK 8 (1.8.0_05) on Linux Mint.
downvote count: 1
has title: JavaFX: why scrollpane is including a splitpane?
has comment: http://stackoverflow.com/comment/36429082
type: UnansweredQuestion
tagged with: javafx-8

http://stackoverflow.com/comment/36523969
comment on: http://stackoverflow.com/a/23754791
score: 1
has text: @TAsk I didn't mean your answer is in-convenient. It depends on the requirement. Many frameworks use it too, E.g. when you pass parameter value to a sql query, or print log with some argument etc. However it could be in-convenient in two sides, 1) the method caller has to prepare the array carefully, in terms of the sequence order; 2) the method callee has to get the value by index and (probably) with type casting
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36420387
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23700833
has text: think about conditions you set and how to handle all the possible cases you need
type: Comment

http://stackoverflow.com/comment/36294249
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23635263
score: 0
has text: No, I have transparent background

http://stackoverflow.com/comment/36490058
has text: @Shai Almog please do you think you could help me with this question https://stackoverflow.com/questions/23730176/j2me-how-to-parse-a-byte-array-into-xml-and-then-read-and-display-specific-data
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23713796
score: 0

http://stackoverflow.com/comment/36268080
has text: If you don't want the subclass's `calculateTotal()` to override the superclass's version, you should **either** give it a different name, **or** make the superclass's version private.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23621920
score: 0

http://stackoverflow.com/comment/36271011
comment on: http://stackoverflow.com/q/23623585
score: 0
type: Comment
type: QuestionComment
has text: Read: [**How to debug small programs**](http://ericlippert.com/2014/03/05/how-to-debug-small-programs/).

http://stackoverflow.com/comment/36501925
type: Comment
has text: I'm not convinced this is off topic. Please explain or remove the regex tag from the forum
comment on: http://stackoverflow.com/q/23739711
score: 0
type: QuestionComment

http://stackoverflow.com/q/23695726
has comment: http://stackoverflow.com/comment/36410060
tagged with: android
has answer: http://stackoverflow.com/a/23696950
favorite count: 0
tagged with: static
accepted answer: http://stackoverflow.com/a/23696684
possible better answer: http://stackoverflow.com/a/23696950
upvote count: 1
has body: I have a static ArrayList&lt;Profile&gt; that I want to be able to access from any activity within my app. When I do finally get around to it, I do something like this: Profile profile = Globals.profiles.get(selected); Normally I understand that when I retrieve and object from an ArrayList and make changes to it, I am changing the object in the ArrayList. This is the behavior I want but I wonder if it still holds true if the ArrayList is static. For instance, if I: profile.setNewName("Mike"); Is the name changed only for the local object derived from the static ArrayList, or is the object in the ArrayList updated as well? Like I said, this is expected behavior when ArrayList is not static.
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36410867
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23696684
has title: What happens when I grab an object from a static ArrayList and change its parameters?
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/36350005
type: AnswerComment
type: Comment
score: 0
has text: Sorry, my initial response was incorrect, see the update above.
comment on: http://stackoverflow.com/a/23646565

http://stackoverflow.com/a/23667743
has comment: http://stackoverflow.com/comment/36358761
has comment: http://stackoverflow.com/comment/36357543
has comment: http://stackoverflow.com/comment/36357650
has comment: http://stackoverflow.com/comment/36358636
has comment: http://stackoverflow.com/comment/36358966
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36358511
has comment: http://stackoverflow.com/comment/36358071
has comment: http://stackoverflow.com/comment/36357623
has comment: http://stackoverflow.com/comment/36358682
has comment: http://stackoverflow.com/comment/36358441
has body: You could either take advantage of the color property support of the component or supply your own color property which could set and retrieved through the use of setters and getters The following example simply uses the components existing foreground property... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class GameExample { public static void main(String[] args) { new GameExample(); } public GameExample() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } MyGame game = new MyGame(); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(game); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class MyGame extends JPanel implements ActionListener { Timer t = new Timer(5, this); int x = 0, y = 0, velx = 0, vely = 0, g = 0; public MyGame() { t.start(); setFocusTraversalKeysEnabled(false); setForeground(Color.RED); InputMap im = getInputMap(WHEN_IN_FOCUSED_WINDOW); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false), "up-pressed"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false), "down-pressed"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false), "left-pressed"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false), "right-pres…
type: Answer
accepted answer of: http://stackoverflow.com/q/23667478
has comment: http://stackoverflow.com/comment/36357945
has comment: http://stackoverflow.com/comment/36358122
has comment: http://stackoverflow.com/comment/36358202
has comment: http://stackoverflow.com/comment/36358487
has comment: http://stackoverflow.com/comment/36358356
upvote count: 1
has comment: http://stackoverflow.com/comment/36358014
has comment: http://stackoverflow.com/comment/36357852
has comment: http://stackoverflow.com/comment/36358551
has comment: http://stackoverflow.com/comment/36357569
answers question: http://stackoverflow.com/q/23667478
score: 1
has comment: http://stackoverflow.com/comment/36357988
has comment: http://stackoverflow.com/comment/36358449

http://stackoverflow.com/q/23679716
has comment: http://stackoverflow.com/comment/36380177
has comment: http://stackoverflow.com/comment/36380024
has answer: http://stackoverflow.com/a/23679930
has comment: http://stackoverflow.com/comment/36380389
has comment: http://stackoverflow.com/comment/36380321
has body: In this servlet,the code is never reaching the else part why so?even though i have not added any cookies and it is still printing some random value?Why so? public class profile extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Cookie[] ck=req.getCookies(); resp.setContentType("text/html"); PrintWriter out=resp.getWriter(); if(ck!=null) { System.out.println("hello"); RequestDispatcher rd=req.getRequestDispatcher("/index.jsp"); rd.include(req, resp); out.println("welcome to your profile "+ck[0].getValue()); } else { out.println("sorry annonymous,you have to login first"); RequestDispatcher rd=req.getRequestDispatcher("/login.jsp"); rd.include(req, resp); } } } and even eclipse was saying dead code why so?
tagged with: servlets
score: 0
has title: Why is the code not reaching else part
answer count: 1
has comment: http://stackoverflow.com/comment/36380913
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36380517
has comment: http://stackoverflow.com/comment/36379971
has comment: http://stackoverflow.com/comment/36380148
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/36380154
type: Question
has comment: http://stackoverflow.com/comment/36380226
has comment: http://stackoverflow.com/comment/36380110

http://stackoverflow.com/comment/36509882
type: Comment
comment on: http://stackoverflow.com/q/23747810
has text: What do you mean? I didn't want to do the Random r = new Random if thats what you are referring. I also stated above that it IS pseudo-random.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23777024
downvote count: 0
has title: get uploaded file path in java web application
has body: Since from the 4 days i have been trying to find out the path for the uploaded file. I think it wont possible. Can any one tell me how to get the uploaded file path in java web application. Is there any external API to get the uploaded file path? And my project is google app engine type project. Please some one answer it.
tagged with: java
favorite count: 0
type: Question
tagged with: jsp
upvote count: 2
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23777287
score: 2

http://stackoverflow.com/q/23680161
tagged with: jcombobox
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23680331
has answer: http://stackoverflow.com/a/23680336
tagged with: java
has answer: http://stackoverflow.com/a/23680331
has body: I developed a simple JFrame that is composed of a panel containing a label, a combo box and a button. All I want is to redirect the user to different panels based on his choice from the combo box. I seem to have an error when making the button check the chosen item. Here's what I've done so far... import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Test { public static void main(String [] args) { // The Frame Design Part... final JFrame ApplicationFrame=new JFrame("Bounceable Ball Game"); ApplicationFrame.setVisible(true); ApplicationFrame.setSize(600,600); ApplicationFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ApplicationFrame.setLocationRelativeTo(null); JMenuBar ApplicationMenuBar=new JMenuBar(); JMenu File=new JMenu("File"); JMenu Edit=new JMenu("Edit"); JMenu Play=new JMenu("Play"); ApplicationMenuBar.add(File); JMenuItem Exit=new JMenuItem("Exit"); File.add(Exit); ApplicationMenuBar.add(Edit); ApplicationMenuBar.add(Play); ApplicationFrame.setJMenuBar(ApplicationMenuBar); JPanel ApplicationPanel =new JPanel(new GridBagLayout()); GridBagConstraints DesignConstraints=new GridBagConstraints(); DesignConstraints.insets=new Insets(10,10,10,10); DesignConstraints.gridx=0; DesignConstraints.gridy=1; JLabel GameChoiceLabel=new JLabel("Please Select The Game That You Want To Play..."); ApplicationPanel.add(GameChoiceLabel,DesignConstraints); DesignConstraints.gridx=0; DesignConstraints.gridy=2; ApplicationPanel.add(GameChoiceComboBox,DesignConstraints); DesignConstraints.gridx=0; DesignConstraints.gridy=3; JButton GameChoiceButton=new JButton("Play Game"); GameChoiceButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { JComboBox comboBox = (JComboBox) e.getSource(); Object selected = comboBox.getSelectedItem(); if(selected.toString().equals("TennisBall")) { ApplicationMenuBar.add(File); JMenuItem Exit=new JMenuItem("Exit"); File.add(Exit); ApplicationMenuBar.add(Edit); ApplicationMenuBar.add(Pla…
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36381069
accepted answer: http://stackoverflow.com/a/23680336
score: 0
answer count: 2
has title: A JButton To Determine The Action To Be Performed Based On A JComboBox Choice
has comment: http://stackoverflow.com/comment/36381279

http://stackoverflow.com/comment/36480193
score: 0
has text: You get any exception ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23732216

http://stackoverflow.com/comment/36524692
has text: Updated the answer with some clues.
type: AnswerComment
comment on: http://stackoverflow.com/a/23742764
score: 0
type: Comment

http://stackoverflow.com/comment/36558831
type: QuestionComment
comment on: http://stackoverflow.com/q/23758072
score: 0
has text: Is there a flag that disables this behaviour ?
type: Comment

http://stackoverflow.com/a/23670656
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23670570
type: Answer
upvote count: 2
has body: You are not posting any data with the curl command and hence it is going as a GET instead of POST. Here is how you can send the POST request using --data option: curl --data "dummyparam=dummvalue" -u test@test.com:test http://www.example.com/mappingFile
has comment: http://stackoverflow.com/comment/36368479

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/23657136
tags question: http://stackoverflow.com/q/23683126
tags question: http://stackoverflow.com/q/23660163
tags question: http://stackoverflow.com/q/23659736
tags question: http://stackoverflow.com/q/23722078
type: Tag
tags question: http://stackoverflow.com/q/23748399

http://stackoverflow.com/a/25859373
score: 2
upvote count: 2
has body: I ran into a similar issue with SBT failing to launch due to missing class files. I think this happens when you delete a version of Java (i.e. downgrading from Java 1.8 to 1.7 or 1.6). I know this is historical, but I've found a workaround: On OS X Terminal, navigate your home directory ~ and create a new file using the command vim .sbtconfig. Paste the following: SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -XX:MaxPermSize=256M" Then save with :wq and restart sbt. If you're still having this issue, please post an update and I'll try to give you some assistance. Also, if you're not super Terminal-friendly, you can use a standard text editor to save the .sbtconfig file.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23770475
type: Answer
accepted answer of: http://stackoverflow.com/q/23770475

http://stackoverflow.com/q/23707156
has title: Substring for specific characters
answer count: 1
has comment: http://stackoverflow.com/comment/36432012
has body: I have a file name as a String from which I want to extract the account number. The String will look like the below.. jack-16-05-2014-13-32-48_216043_PHOTO.jpg The account number will always be before the word "PHOTO" and it will always be either 5 or 6 characters length. In this example it is "216043" The total String length can vary because the name at the beginning can be different. Can someone please share what is the best way in Java to extract the account number. Thanks.
favorite count: 0
score: -4
downvote count: 4
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36432003
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23707234
accepted answer: http://stackoverflow.com/a/23707234

http://stackoverflow.com/comment/36819577
comment on: http://stackoverflow.com/a/23831805
score: 0
type: AnswerComment
has text: Your code works but it doesn't mean it's correct. As your texture uses the GL_TEXTURE_2D target, texture.enable(gl) has the same effect than gl.glEnable(GL2.GL_TEXTURE_2D) but this texture target must be enabled before binding the texture. gl.glEnable(GL2.GL_TEXTURE_2D) and gl.glDisable(GL2.GL_TEXTURE_2D) shouldn't be called each time you draw a single block/mesh but once per drawing session, for example in GLEventListener.display(GLAutoDrawable drawable).
type: Comment

nexus
type: Tag
tags question: http://stackoverflow.com/q/23704590
tag name: nexus

http://stackoverflow.com/comment/36338003
type: QuestionComment
has text: @Stefoan I don't think this answers my question. I'm not asking how create a RESTFul webservice client but how to manage its resources (such as HTTP connections/ sockets) if a service itself acts as as RESTFul webservice client.
type: Comment
comment on: http://stackoverflow.com/q/23656786
score: 0

http://stackoverflow.com/comment/36495326
has text: I have actually tried this and it is unable to locate the element still
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23704518
type: Comment

http://stackoverflow.com/q/23740777
has comment: http://stackoverflow.com/comment/36496990
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/13178824
has body: I'm having problems with unmarshaling using JAXB. I want to make every item from XML to be stored as object in ArrayList. But as far as I try to parse it, I always get null values: Board{ID=null, Brand=null, Name=null, Price=null, shape=null, camber=null, stance=null} Could anyone give a hint where is the problem. I'm new to JAXB. XML file boards.xml: <BOARDS> The APO Supreme is an interesting board. To start off I think someone filed down the edges because we have never experienced so little edge hold. It was to the point where it was a bit scary. Hopefully this was not how the board really rides because there is some snap and pop to it. <riding_style> All Mountain Freestyle </riding_style> <riding_level> Intermediate - Expert </riding_level> Directional Twin <camber_profile> Flat to Rocker </camber_profile> Centered $499 drawable\\snb_apo_supreme.jpg The Arbor Draft was the first snowboard in their line up to go rocker back in 2010. Over the years the Arbor Draft has pretty much remained the same board with the exception of a few minor refinements. This is one of the better jib park boards we came across and it also isn’t bad out of the jib park. <riding_style> Jib / Street </riding_style> <riding_level> Beginner - Expert </riding_level> True Twin <camber_profile> Continuous Rocker </camber_profile> Centered $399 drawable\\snb_arbor_draft.jpg <BOARDS> Here's the class where information should be stored. Board class: import java.util.ArrayList; import javax.xml.bind.annotation.*; @XmlRootElement(name="BOARDS") class Board { private String id; private String brand; private String name; private String description; private String price; private String shape; private String ridingLevel; private String ridingStyle; private String camber; private String stance; private String picture; ArrayList<Board> listOfBoards; public ArrayList<Board> getListOfBoards() { return listOfBoards; } public void setListOfBoards(ArrayList<Board> listOfBoards) { this.listOfBoards = listOfBoar…
type: UnansweredQuestion
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/36500504
has comment: http://stackoverflow.com/comment/36496049
has title: How unmarshal XML using JAXB. Particular case
has answer: http://stackoverflow.com/a/23741189
score: 0
has comment: http://stackoverflow.com/comment/36498738
answer count: 1

http://stackoverflow.com/comment/36285054
comment on: http://stackoverflow.com/q/23630097
score: 0
type: QuestionComment
type: Comment
has text: Why not create a constant of type string?

http://stackoverflow.com/q/23750612
type: Question
score: -1
has comment: http://stackoverflow.com/comment/36514975
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36514936
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23750680
has answer: http://stackoverflow.com/a/23750704
has title: Cannot play audio file through java
has body: In my program I am trying to play an audio file of a women screaming. I am using a simple code, through sun.audio, but am unable to get the file to play. Here is the code: package hauntedHouseAdventure; import java.io.*; import sun.audio.*; public class AudioScreamer { public static void main(String[] args) throws Exception {` // open the sound file as a Java input stream String screamFile = " C:/Users//alan/Downloads/woman-scream-01.au"; InputStream in = new FileInputStream(screamFile); // create an audiostream from the inputstream AudioStream audioStream = new AudioStream(in); // play the audio clip with the audioplayer class AudioPlayer.player.start(audioStream); } } The error I'm getting is Exception in thread "main" java.io.FileNotFoundException: C:\Users\alan\Downloads\woman-scream-01.au (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) at hauntedHouseAdventure.AudioScreamer.main(AudioScreamer.java:19)
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/36314542
type: Comment
type: QuestionComment
score: 0
has text: There are ways of doing this, but you should think seriously about whether it's a good idea. Why don't you want to use collections? See http://stackoverflow.com/questions/1817524/generic-arrays-in-java
comment on: http://stackoverflow.com/q/23645891

http://stackoverflow.com/a/23767864
answers question: http://stackoverflow.com/q/23766467
type: Answer
has body: When you hover over the unused import Intellij IDEA pops up a little red bulb which allows you to add the library to the classpath. Finding that fixed it.
score: 0

http://stackoverflow.com/q/23713672
type: Question
answer count: 2
downvote count: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/31684966
has comment: http://stackoverflow.com/comment/36448744
has body: I would like to change the role of the user. Changing role of the user in the database. Everything is based on Spring Security. My code: UserDetails user = userDetailsManager.loadUserByUsername(userData.getUser().getUsername()); user.getAuthorities().add(new SimpleGrantedAuthority(role)); userDetailsManager.updateUser(user); Error: Error:(99, 30) java: method add in interface java.util.Collection&lt;E&gt; cannot be applied to given types; required: capture#1 of ? extends org.springframework.security.core.GrantedAuthority found: org.springframework.security.core.authority.SimpleGrantedAuthority reason: actual argument org.springframework.security.core.authority.SimpleGrantedAuthority cannot be converted to capture#1 of ? extends org.springframework.security.core.GrantedAuthority by method invocation conversion I don't know why is this error. How can otherwise change the role for the user?
has comment: http://stackoverflow.com/comment/36445821
favorite count: 0
has comment: http://stackoverflow.com/comment/36451044
linked to: http://stackoverflow.com/q/3716920
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/36447526
has answer: http://stackoverflow.com/a/31688485
tagged with: roles
score: 1
tagged with: java
has title: Change user roles by userDetailsManager

http://stackoverflow.com/comment/36306895
has text: @DaveSchweisguth Please correct me if I am wrong. OP is asking why use same name for fields and method parameters?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23641675
type: AnswerComment

http://stackoverflow.com/q/23661442
tagged with: java
tagged with: methods
type: Question
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/36345168
answer count: 1
type: UnansweredQuestion
has title: send data to running instance
has answer: http://stackoverflow.com/a/23661771
has body: Hello I am creating software which allow files to be uploaded, my software has a chat client which will create a instance of a file uploader class, this file uploader class will take the file from the file chooser, convert it to byte and upload it to the sql database. so essentially I have a main chat client which contains a text area for chat to be show in. I have main chat windows which displays contacts. when the user double clicks on a contact the chat client opens up: private void jList1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: if (evt.getClickCount() == 2) { String userID = lbluserID.getText(); String selectedContact = jList1.getSelectedValue().toString(); ChatClient chatClientObject = new ChatClient(selectedContact, userID); ChatClient.runchatClient(selectedContact, userID); } } within this chat client I have placed a button which allows the selection of the file. the dbconnect class will upload the file to the server, once this is done I need a message to appear in the chat client text area displaying that the file has been uploaded. I have tried to make a instance of the chat client in the dbconnect class and then call a method to output the message how ever this gives me errors. what I really want to do is allow my program to open the chat client for the contact the user clicks on and also be able to return the message to the same chat client instead of creating a new instance. I hope my question is clear as it is pretty hard to explain.... for example, If i click on "Ben" in the main client a chat client will open for "ben" this chat client contains a text area. when i have finished uploading the file which is done by the dbconnect class I want the string message "file sent" to be returned to the chat I have open with "ben".
tagged with: instance

http://stackoverflow.com/comment/36318240
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23647687
type: Comment
has text: How big are your arrays of bytes? You could prepare a "low resolution" model (smaller array) for preliminary test like SJuan76 suggests

http://stackoverflow.com/a/23617723
has comment: http://stackoverflow.com/comment/36259884
has body: change ${emp.Price()} to ${emp.price}
upvote count: 2
answers question: http://stackoverflow.com/q/23617691
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36259837

http://stackoverflow.com/comment/36362789
comment on: http://stackoverflow.com/q/23670452
has text: Any particular reason why? This is ultimately going on Android, and the smaller the binary is, the better.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23765152
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23765132
upvote count: 4
has body: You have View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; // remove this adView = new AdView(getActivity()); // this is unreachable coz you have return above. The return at the end of onCreateView is fine
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/36542782
accepted answer of: http://stackoverflow.com/q/23765132

http://stackoverflow.com/comment/36459055
comment on: http://stackoverflow.com/q/23721355
has text: That's easy and understandable way, I would only recommend to change the cast to 'String.valueOf()' - you need to have a meaningful impl of the toString() method of the Object arg.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/36552936
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23769992
has text: Well, you can check the bugs of your IDE then and/or report a new one. Also, you can try clearing the caches of your IDE and reload your project, then try again. Also, you can try in another IDE. This seems to be an IDE issue.

http://stackoverflow.com/a/23654333
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23654054
answers question: http://stackoverflow.com/q/23654054
has body: If you plan to work without an IDE then i suggest you start using a build tool either Ant or Maven for that. Otherwise you could just compile everything using javac and use the standard java tools to make your project and build a war, but that would make your life a living hell :)
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23668910
possible better answer: http://stackoverflow.com/a/32690014
accepted answer: http://stackoverflow.com/a/23670920
tagged with: webview
upvote count: 4
has answer: http://stackoverflow.com/a/32690014
has body: I tried to make the UI by using webview in JavaFX, but there is one problem, when a large image is opened using popup, memory usage is very large, and when the popup is closed, the memory usage does not go down, I see the memory usage via the Task Manager in Windows , when the image with a size of approximately 8MB opened using webview, memory reached 300MB in use, I do not understand why it is so large, I've tried stage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() { @Override public void handle(WindowEvent event) { webengine.load(null); } }); but still, do not make the memory freed
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23670920
has answer: http://stackoverflow.com/a/45855030
type: Question
score: 4
answer count: 3
has title: How To Clear Javafx Webview Memory usage after closing stage
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/36373311
type: Comment
comment on: http://stackoverflow.com/a/23673010
has text: Sounds like an idea. Maybe I should try allocating random numbers using something other than a for loop. Thanks
score: 0
type: AnswerComment

http://stackoverflow.com/a/23720182
has comment: http://stackoverflow.com/comment/36457066
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23720118
answers question: http://stackoverflow.com/q/23720118
type: AcceptedAnswer
upvote count: 28
type: Answer
has comment: http://stackoverflow.com/comment/36457099
score: 27
has body: I'm assuming you're on Windows, because this behavior seems about right for Windows. When you enter a character, you do something like this: Press a Press return Step 2 passes a line separator sequence that indicates to the input console that you have pressed enter, which tells the console that you have finished entering this line of input. So the console passes the entire line to your program. This line separator sequence on Windows is made up of the carriage return character '\r' followed by the newline character '\n'. So your line is really "a\r\n". What System.in.read() does is read a single byte from the input console. As the characters you input all fit into a single byte, what your program does is consumes the inputted characters one by one, so it's something like this: Output: Enter Character 0 &gt; User inputs: "a\r\n" // You only entered 'a', the other two characters are from the enter key array[0] = System.in.next(); // sets array[0] to 'a', "\r\n" are still "waiting" on the input stream Output: Enter Character 1 &gt; String "\r\n" is still on input, so read from those: array[1] = System.in.next(); // sets array[1] to '\r', "\n" is still "waiting" Output: Enter Character 2 &gt; String "\n" is still on input, so read from that array[2] = System.in.next(); // sets array[2] to '\n', input source is now empty Output: Enter Character 3 &gt; Nothing is waiting on the input stream, so program waits for user input ... and so on What you want to do is make a Scanner, and read an entire line at once, so the only character you process is the content you entered: Scanner scanner = new Scanner(System.in); // Creates a new scanner that reads from System.in String line = scanner.nextLine(); // Reads an entire line from console, **not including newline breaks at the end of a line** // use line.charAt(i) to get individual characters, or use line.toCharArray() to get the string's backing char[] If you were to print the integer values of each of the elements in your array, …

http://stackoverflow.com/a/23676197
downvote count: 0
type: Answer
has body: Most likely the problem is from clause. You should capitalize your entity names, and entity names and properties are case-sensitive in JPQL: .... from User u, Subscriptions s, UserSubscriptions us where .... Also you're likely to encounter problem with property names. In your query all them are capitalized: where u.openID = :openId and u.UserId = us.UserId and But, JPA provider most likely will expect userId, not UserId.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23675798
accepted answer of: http://stackoverflow.com/q/23675798
type: AcceptedAnswer

http://stackoverflow.com/comment/36433904
comment on: http://stackoverflow.com/q/23708026
has text: @laalto Thanks, that was it. I was simply declaring the intent in the wrong space.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36358462
has text: you can look at this http://stackoverflow.com/questions/6182771/how-to-properly-handle-exceptions-in-a-jsp-servlet-app
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23668269

http://stackoverflow.com/comment/36501071
type: Comment
type: QuestionComment
has text: I don't think there is a way just like you think. JVar supports literals and array but not arraylist. Even with JArray you'll have to do looping or method chaining. :)
score: 0
comment on: http://stackoverflow.com/q/23680137

http://stackoverflow.com/comment/36361879
score: 0
type: Comment
has text: It also counts Food as 3 times. In total, it will count 6, instead I want only 4 (Entertainment, Food, Products, Health & Beauty)
comment on: http://stackoverflow.com/a/23669479
type: AnswerComment

http://stackoverflow.com/comment/36504678
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23742447
has text: After some more reading I now kind of understand that just making an ajax call will revalidate the session. but I am worried that I may screw up the current view with a behind the scenes ajax call can anyone give an example of an ajax call that honestly does nothing?

http://stackoverflow.com/comment/36343533
score: 0
type: Comment
has text: A monospaced font is no guarantee of `-` / `>` alignment.
comment on: http://stackoverflow.com/a/23660776
type: AnswerComment

http://stackoverflow.com/q/23716065
has title: when a variable of type Location is passed to "onLocationChanged". the App crashes
accepted answer: http://stackoverflow.com/a/23718682
has answer: http://stackoverflow.com/a/23716461
tagged with: android
possible better answer: http://stackoverflow.com/a/23716461
tagged with: locationlistener
has answer: http://stackoverflow.com/a/23718682
type: AnsweredQuestion
has body: As shown below, why when i pass the mCurrentLocation which is retrieved from getLastKnownLocation to onLocationChanged callback, the app crashes? JavaCode: private void prepareGPS() { // TODO Auto-generated method stub this.mCriteria = new Criteria(); setLocationProviderCriteria(this.mCriteria); this.mProvider = mLocMgr.getBestProvider(getLocationProviderCriteria(), false); if (this.mProvider == null) { Toast.makeText(getApplicationContext(), NO_PROVIDER, Toast.LENGTH_LONG).show(); }else { this.mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this); this.mCurrentLocation = this.mLocMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER); this.onLocationChanged(mCurrentLocation); } } @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub if (location != null) { this.latEt.setText(String.valueOf(location.getLatitude())); this.lngEt.setText(String.valueOf(location.getLongitude())); }else { Toast.makeText(getApplicationContext(), "onLocationChanged returned NULL", Toast.LENGTH_LONG).show(); } } LogCat: 05-18 00:04:02.190: E/AndroidRuntime(9311): FATAL EXCEPTION: main 05-18 00:04:02.190: E/AndroidRuntime(9311): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.meetingpointlocator_03/com.example.meetingpointlocator_03.MeetingPointFix}: java.lang.NullPointerException 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362) 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.app.ActivityThread.access$700(ActivityThread.java:168) 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329) 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.os.Handler.dispatchMessage(Handler.java:99) 05-18 00:04:02.190: E/AndroidRuntime(9311): at android.os.Loo…
tagged with: java
has comment: http://stackoverflow.com/comment/36448796
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/36322138
comment on: http://stackoverflow.com/q/23649927
type: Comment
type: QuestionComment
has text: I guess you have to write yourself a litter helper method :P I did so myself in a 2D Game I wrote for NPC dialogues, it's really not difficult and there are different approaches.
score: 0

http://stackoverflow.com/q/23665688
has body: I am using Quartz Scheduler as a Spring bean in a clustered environment. I have some jobs annotated with @NotConcurrent and they are running once per cluster (i.e. only in one node, only in one thread). Now I need to run one job on every node of the cluster. I removed the @NotConcurrent annotation, but it only run on every thread on one machine. It does not get fired on other nodes. What should I annotate the job with? Example: Job1 NotConcurrent annotated is scheduled at midnight => It fires only on 1 machine every midnight. Job2 annotated scheduled at midnight => It fire on every machine every midnight. Thank you.
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23673652
accepted answer: http://stackoverflow.com/a/23673652
upvote count: 9
tagged with: quartz-scheduler
tagged with: spring
tagged with: cluster-computing
type: AnsweredQuestion
tagged with: job-scheduling
has title: Quartz Scheduler: Trigger some jobs on every cluster node and some only once per cluster
tagged with: java
score: 9
type: Question

http://stackoverflow.com/a/23727418
downvote count: 0
has comment: http://stackoverflow.com/comment/36474798
type: Answer
answers question: http://stackoverflow.com/q/23726373
upvote count: 1
has body: If you want to do your code this way, I would probably do two things: 1) maintain index fields for each array for the next free index, and 2) I wouldn't recommend resizing your array by 1 each time, as our current code is running through the array 2 n times (n = array length), 1st to initialize the array, and 2nd to create a new array. Two options to optimize thisL one would be be to look into the Arrays class. it contains methods such as Array.copyOf() that can perhaps be useful here. You could also check if the array is full, and if it is then resize it by a number greater than one to reduce extra work. For instance: import java.util.Arrays; class Test{ private String[] a; private int next; public Test(int size){ a = new String[size]; next = 0; } public void add(String s){ if(next == a.length){ Arrays.copyOf(a, a.length+1); } a[next] = s; next++; } } The easiest way would be to use an ArrayList (or any class that implements the java.util.List interface), as previously mentioned by Jon Skeet - it will do all the work for you.
score: 1

http://stackoverflow.com/q/23651280
tagged with: java
tagged with: multithreading
type: Question
has title: Simulate counting over N sensors with java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23651416
has body: I need to simulate in Java N sensors that send to me an obsvertation at random time. Where an observation contain more value like: timestamp - temperature - umiditiy - ... When i receive an observation from anyone (the time of observation is random for all sensor) of the N sensors i need to call a rutine R that refresh a data structure (in common between all sensors) with some counting. I need to syncronyze the R call, if i call R first time for call R second time i need R first time to finish his work. All my observation are actually stored in a CSV file, one file for sensor. But i need to simulate a "online streaming". How i can make that in Java? If i make N threads (one for sensor) that read his CSV file, i can't read the observation in right temporal order over all CSV. For example, if i have this 2 csv: Csv1: 18:00 - low - low 19:00 - low - high Csv2 18:03 - high - low I need first to refresh my counting with obsvervation at time 18:00 in csv1, then with obsvervation at time 18:0 in csv2 and finally with observation at time 19:00 in csv2. EDIT1: I have make a test with SynchronousQueue because I need to syncronyze my N thread, my problem is when one thread do something on counting structure other thread can't access to it. I have find this example: package threadTest; import java.util.concurrent.SynchronousQueue; public class SynchronousQueueTest { private SynchronousQueue sq = new SynchronousQueue(true); class PutThread implements Runnable { public void run() { for(int i=0; i &lt;1000; i++) { try { System.out.println("PUT"); //sq.put("A"); sq.put("A"); } catch (InterruptedException e) { e.printStackTrace(); } } } } class TakeThread implements Runnable { public void run() { for(int i=0; i &lt;1000; i++) { try { System.out.println("TAKE"); System.out.println(sq.take()); } catch (InterruptedException e) { e.printStackTrace(); } } } } public static void main(String[] args) { new Thread((new SynchronousQueueTest()).new PutThread()).start(); new Thread((new Synchro…
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/q/23742815
has answer: http://stackoverflow.com/a/23869024
has answer: http://stackoverflow.com/a/23914727
has body: I'm trying to use Java WatchEvent ENTRY_MODIFY to check if a file is being access (ie: read, copied to clipboard). However from the documentation and a small test case I've made, that event isn't being fired. It's only fired when the file is changed. Am I doing something wrong? If so, how can I monitor a file on the filesystem?
type: UnansweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36592130
has comment: http://stackoverflow.com/comment/36590133
type: Question
has comment: http://stackoverflow.com/comment/36590518
tagged with: filesystems
has answer: http://stackoverflow.com/a/23796327
tagged with: monitoring
has comment: http://stackoverflow.com/comment/36590462
answer count: 3
score: 2
linked to: http://stackoverflow.com/q/14226064
downvote count: 0
has title: Monitor filesystem access on critical systems
favorite count: 0

http://stackoverflow.com/a/23684126
has comment: http://stackoverflow.com/comment/36424531
type: Answer
upvote count: 12
downvote count: 0
answers question: http://stackoverflow.com/q/23684083
accepted answer of: http://stackoverflow.com/q/23684083
score: 12
has body: Use an AtomicInteger which is implemented using CAS. AtomicInteger has an incrementAndGet() method you can use for this purpose. It is also useful to know that there are more Atomic* variants in the JDK, so there is also AtomicLong if Integer is not enough for you.
type: AcceptedAnswer

http://stackoverflow.com/a/23620213
has comment: http://stackoverflow.com/comment/36292302
has comment: http://stackoverflow.com/comment/36333049
has body: Why not just have spring unmarshal the AuthorizationServer class for you? Then you would just annotate it with @Valid and look at the BindingResult object for errors: @RequestMapping(value = "/somUrl", method = RequestMethod.POST) @ResponseBody public void doSomething(@RequestBody @Valid AuthorizationServer authorizationServer, BindingResult bindingResult) throws Exception { if (bindingResult.hasErrors()) { //do something } Update: Try this code to programmatically validate: ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); Set&lt;ConstraintViolation&lt;AuthorizationServer&gt;&gt; errors = validator.validate(authorizationServer); Update 2: What about this: @Valid AuthorizationServer authorizationServer = mapper.readValue(bytes, AuthorizationServer.class);
answers question: http://stackoverflow.com/q/23618602
score: 0
has comment: http://stackoverflow.com/comment/36306951
type: Answer

http://stackoverflow.com/q/23627730
has answer: http://stackoverflow.com/a/23627981
type: AnsweredQuestion
tagged with: linux
type: Question
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/23627904
tagged with: java
answer count: 3
has title: Running an app in Eclipse AVD
has body: I downloaded an ADT bundle for linux a few days ago and since then, I've been trying to figure out how do I load my android app project to my an AVD. I created and AVD using the AVD manager of eclipse and I'm stuck after that. How do I load my app to the AVD? do I have to use the "terminal"? or can I upload directly using Eclipse only. Thanks!!
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23627905
has comment: http://stackoverflow.com/comment/36278745
has answer: http://stackoverflow.com/a/23627905
tagged with: adt
accepted answer: http://stackoverflow.com/a/23627904

http://stackoverflow.com/comment/36290768
score: 1
has text: Have you tried using a newer version of eclipse?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23633992

http://stackoverflow.com/comment/36396718
type: AnswerComment
comment on: http://stackoverflow.com/a/23683090
has text: Sometimes this is the case, but unlikely to be the case here; see my answer.
type: Comment
score: 0

http://stackoverflow.com/q/23746085
answer count: 1
tagged with: user-interface
downvote count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/36506310
tagged with: applet
favorite count: 0
has title: Java elements arangement
accepted answer: http://stackoverflow.com/a/23746278
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23746278
type: Question
has comment: http://stackoverflow.com/comment/36506413
has comment: http://stackoverflow.com/comment/36506639
tagged with: java
has comment: http://stackoverflow.com/comment/36506363
score: -1
has comment: http://stackoverflow.com/comment/36506514
has comment: http://stackoverflow.com/comment/36506330
has body: I have the following code. If i maximize the window of the applet, all the elements will be ordered on a single line. I would like to have some elements on a line and other on another line and so on. I tried to create panels but it doesn't work. What should I change in order to solve this problem ? import java.applet.Applet; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Numbers extends Applet implements ActionListener{ private Button b1,b2,b3; private Label lb1,lb2,lb3; private TextField tf1,tf2,tf3; private Panel row1,row2,row3,row4,row5; private Panel CreatePanel(LayoutManager layout_type) { Panel p=new Panel(); p.setLayout(layout_type); return p; } public void init() { setLayout(new FlowLayout(FlowLayout.LEFT,4,2)); row1=CreatePanel(new FlowLayout(FlowLayout.CENTER,4,2)); lb1=new Label("First number: "); tf1=new TextField("",10); row1.add(lb1); row1.add(tf1); add(row1); row2=CreatePanel(new FlowLayout(FlowLayout.CENTER,2,2)); lb2=new Label("Second number: "); row2.add(lb2); tf2=new TextField("",10); row2.add(tf2); add(row2); row3=CreatePanel(new FlowLayout(FlowLayout.CENTER,4,2)); b1=new Button("Multiply "); b1.addActionListener(this); row3.add(b1); b2=new Button("Add"); b2.addActionListener(this); row3.add(b2); b3=new Button("Subtract"); b3.addActionListener(this); row3.add(b3); add(row3); row4=CreatePanel(new FlowLayout(FlowLayout.CENTER,4,2)); row5=CreatePanel(new FlowLayout(FlowLayout.CENTER,5,2)); lb3=new Label("Result: "); row5.add(lb3); add(row5); } public void actionPerformed(ActionEvent e) { String txt1=tf1.getText(); String txt2=tf2.getText(); int n=Integer.parseInt(txt1); int m=Integer.parseInt(txt2); if(e.getSource()==b1) lb3.setText("Result: "+n*m); if(e.getSource()==b2) lb3.setText("Result: "+(n+m)); if(e.getSource()==b3) lb3.setText("Result: "+(n-m)); } }

http://stackoverflow.com/comment/36550463
type: QuestionComment
comment on: http://stackoverflow.com/q/23768872
type: Comment
has text: Didn't even try your code, but wanted to ask why aren't you using affine? http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html
score: 1

http://stackoverflow.com/comment/36551102
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23769143
has text: can I use netstat in java exec???
score: 0

http://stackoverflow.com/q/23713320
has comment: http://stackoverflow.com/comment/36443593
type: Question
has answer: http://stackoverflow.com/a/23713386
tagged with: java
score: 0
answer count: 3
tagged with: user-interface
has answer: http://stackoverflow.com/a/23713385
type: UnansweredQuestion
tagged with: android
has title: Updating UI (via loop) without delay?
has answer: http://stackoverflow.com/a/23713505
has body: I want to change the background of my app while it's running (an infinite loop) - however, the app either stops responding or just blanks completely. I think this is due to using Thread.sleep(1); - this will just make the app sleep. My current code: runOnUiThread(new Runnable(){ @SuppressWarnings("deprecation") @Override public void run(){ GradientDrawable gd = new GradientDrawable(Orientation.TL_BR, green); gd.setGradientType(GradientDrawable.RADIAL_GRADIENT); gd.setGradientCenter(0.5f, 1.25f); gd.setCornerRadius(0f); for(int x = 0; x &lt; 400; x++){ Thread.sleep(20); gd.setGradientRadius((float) 400 - x); findViewById(R.id.ms_layout).setBackgroundDrawable(gd); } } }); In the for loop, I want the gradient's radius to change and then update the background, however, this doesn't work: I'm guessing when it sleeps the whole application halts and then resumes to find out it needs to halt again. How can I fix this? In other words, how can I use a loop to update the UI without disrupting the app's main thread?

http://stackoverflow.com/comment/36495586
comment on: http://stackoverflow.com/q/23707388
score: 0
type: QuestionComment
type: Comment
has text: I've managed to reproduce the issue. Without `setNewRevision(false)` it works - I realize that may not be feasible in all cases, but is it a reasonable workaround for you for the moment?

http://stackoverflow.com/q/23698443
has comment: http://stackoverflow.com/comment/36415863
has body: From a Java app, I'd like to programmatically: start a digital ocean server [EDIT: on LINUX debian] install Tomcat on this server [EDIT: this step must be executed remotely, from my Java app] upload an existing war file to the server and deploy it on Tomcat I have found all details on SO on how to do 1. an 3., but not 2. ?
has comment: http://stackoverflow.com/comment/36427535
has comment: http://stackoverflow.com/comment/36416944
downvote count: 0
answer count: 1
tagged with: tomcat
favorite count: 0
has title: Install Tomcat remotely (on a digital ocean server?)
accepted answer: http://stackoverflow.com/a/23699360
has comment: http://stackoverflow.com/comment/36414963
has comment: http://stackoverflow.com/comment/36416599
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36427369
tagged with: java
upvote count: 1
type: Question
tagged with: remote-server
has answer: http://stackoverflow.com/a/23699360
tagged with: digital-ocean

http://stackoverflow.com/q/23701986
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36422014
has comment: http://stackoverflow.com/comment/36421986
has comment: http://stackoverflow.com/comment/36422077
type: Question
accepted answer: http://stackoverflow.com/a/23702084
tagged with: java
has comment: http://stackoverflow.com/comment/36422274
possible better answer: http://stackoverflow.com/a/23702171
has answer: http://stackoverflow.com/a/23702084
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36421937
has comment: http://stackoverflow.com/comment/36422036
has comment: http://stackoverflow.com/comment/36422023
has title: Java loop execution error
has comment: http://stackoverflow.com/comment/36422321
has comment: http://stackoverflow.com/comment/36422151
has comment: http://stackoverflow.com/comment/36422058
has comment: http://stackoverflow.com/comment/36421985
has body: This is my code: import java.io.*; import java.util.*; class comp { int a,b,i,k,l; comp() { Scanner s=new Scanner(System.in); System.out.println("Enter the number"); a=s.nextInt(); b=s.nextInt(); divide(a,b); } public void display(int[] b) { for(i=0;i&lt;b.length;i++) System.out.println(b[i]); } public void divide(int e,int f) { int[] st=new int[20]; //System.out.println(e); i=0; if(e&gt;0) { l=e%10; e=e/10; st[i]=l; i++; } this.display(st); //return st; } } class km extends comp { public static void main(String args[]) { km m=new km(); } } The if loop in the divide function is getting executed only once.It should execute exactly to the number of digits of the number.I am just trying to convert integer to an array.
has answer: http://stackoverflow.com/a/23702171

http://stackoverflow.com/comment/36416153
has text: dd-MMM-yyyy will give you 13-Mar-2014. If you want to match 13-MAR-14, you can use "dd-MMM-yy". But I don't know if there is a way to get the month directly in uppercase. You can find all patterns here: http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23697906

http://stackoverflow.com/comment/36373338
type: Comment
has text: Excetly means this weight is fix 75,75,74 etx..not <75 and <75 right?
type: QuestionComment
comment on: http://stackoverflow.com/q/23676297
score: 0

http://stackoverflow.com/a/23707913
score: 1
has body: This is what i understood. You want to create a jar(which includes some of your utility classes) When you take maven as a tool you don't have jars present in your project lib, they are present in your local repository (~/.m2) hence ant is not able find your third party jar. doing it with maven would be one of the approach. find your solution here here CHEERS !
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36434161
answers question: http://stackoverflow.com/q/23707607
downvote count: 0

http://stackoverflow.com/q/23634161
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: Hibernate Interceptor - Try-Catch T-SQL
score: 1
tagged with: java
tagged with: hibernate
tagged with: t-sql
type: Question
tagged with: sql-server
upvote count: 1
downvote count: 0
has body: I have the requirement to ignore primary key violations from SQL Server in my inserts. While there are several ways to accomplish this task, many of them have performance implications or are not feasible. I need to batch insert into a table and there is a possibility of duplicates. To accomplish the task, I've written a Hibernate interceptor that intercepts onPrepareStatement and wraps the Hibernate generated SQL in a t-SQL TRY CATCH construct. The TRY CATCH looks for primary key violations and silences them. Below is my code for the interceptor. private static final String FORMAT_TRY_CATCH = "BEGIN TRY %s END TRY\r\n" + "BEGIN CATCH\r\n" + "\r\n" + "DECLARE @ErrorMessage NVARCHAR(4000),\r\n" + " @ErrorNumber INT,\r\n" + " @ErrorSeverity INT,\r\n" + " @ErrorState INT,\r\n" + " @ErrorLine INT,\r\n" + " @ErrorProcedure NVARCHAR(200) ;\r\n" + "\r\n" + "SELECT @ErrorNumber = ERROR_NUMBER(), @ErrorSeverity = ERROR_SEVERITY(),\r\n" + " @ErrorState = ERROR_STATE(), @ErrorLine = ERROR_LINE(),\r\n" + " @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-') ;\r\n" + "\r\n" + "SELECT @ErrorMessage = N'Error %%d, Level %%d, State %%d, Procedure %%s, Line %%d, ' +\r\n" + " 'Message: ' + ERROR_MESSAGE() ;\r\n" + " IF @ErrorNumber &lt;&gt; 2627\r\n" + " BEGIN\r\n" + "RAISERROR (@ErrorMessage, @ErrorSeverity, 1, @ErrorNumber, -- parameter: original error number.\r\n" + " @ErrorSeverity, -- parameter: original error severity.\r\n" + " @ErrorState, -- parameter: original error state.\r\n" + " @ErrorProcedure, -- parameter: original error procedure name.\r\n" + " @ErrorLine-- parameter: original error line number.\r\n" + " ) ;\r\n" + " END\r\n" + "END CATCH;"; @Override public String onPrepareStatement(String sql) { if (sql.toLowerCase().startsWith("insert")) { return String.format(FORMAT_TRY_CATCH, sql); } return sql; } The interceptor works except that when there is a primary key constraint violation the statement returns 0 affected rows. Hibernate has a check that throws an exception if …

http://stackoverflow.com/a/23703410
accepted answer of: http://stackoverflow.com/q/23683732
answers question: http://stackoverflow.com/q/23683732
score: 0
type: AcceptedAnswer
has body: In reference to your last comment, try the following code: &lt;cfset demo_pdf = CreateObject("java", "aspose.pdf.Pdf").init() &gt; &lt;cfset section = CreateObject("java", "aspose.pdf.Section").init() &gt; &lt;cfset sec1 = demo_pdf.getSections().add() &gt; &lt;cfset text = CreateObject("java", "aspose.pdf.Text").init("Κατά τη συζήτηση") &gt; &lt;cfset text.getTextInfo().setFontName("Arial Unicode MS")&gt; &lt;cfset sec1.getParagraphs().add(text)&gt; &lt;cfset demo_pdf.setUnicode()&gt; &lt;cfset demo_pdf.save("c:\HelloWorld.pdf")&gt;
type: Answer

http://stackoverflow.com/a/23625039
upvote count: 2
has body: A call to notify wakes up one thread that is currently waiting on the object's condition queue which then tries to reaquire the lock which is still held by the calling thread at that point of time. So the situation is comparable to a thread that wants to enter a synchronized block that is currently executed by another thread. The thread is not doing a busy-wait, it is just blocked until it can aquire the lock. When the thread that called notify releases its lock, the other thread can be unblocked and continue to work. The same is true for notifyAll, but it wakes up all threads that are waiting on the object's condition queue. As only one of them can acquire the lock, the others stay blocked until they get the lock - one after the other. This and because thread-awaking signals may happen spontaneous it is required to always call wait within a conditional loop: synchronized (lockObject) { // ... while (!condition) { lockObject.wait(); } // object is now in desired state } See also: Java Concurrency in Practice, Chapter 14.2
answers question: http://stackoverflow.com/q/23623339
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/23753377
has body: I fond an error on my first steps into struts framework. Could anyone give me some hints based on that stacktrace? java.lang.ClassCastException: Cannot cast org.springframework.web.SpringServletContainerInitializer to javax.servlet.ServletContainerInitializer java.io.IOException: java.lang.ClassCastException: Cannot cast org.springframework.web.SpringServletContainerInitializer to javax.servlet.ServletContainerInitializer
score: -3
has title: How to solve java.lang.ClassCastException
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36520306
tagged with: java
tagged with: servlets
type: Question
answer count: 1
tagged with: struts2
has answer: http://stackoverflow.com/a/23753777
accepted answer: http://stackoverflow.com/a/23753777
upvote count: 1
downvote count: 4
favorite count: 0

http://stackoverflow.com/comment/36533033
score: 0
type: Comment
has text: @user3654191 you mean adding a Button with VBA functionality to your Excel Sheet and get data from the selected row and save it to a pdf file? That has nothing to do with Java, therefor you need to work on your VBA script.
comment on: http://stackoverflow.com/a/23748784
type: AnswerComment

http://stackoverflow.com/q/23623196
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36270456
has comment: http://stackoverflow.com/comment/36270713
favorite count: 0
has comment: http://stackoverflow.com/comment/36270408
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36270470
has comment: http://stackoverflow.com/comment/36270610
has answer: http://stackoverflow.com/a/23623538
has comment: http://stackoverflow.com/comment/36270527
has title: How to use data from a txt file and run it in a method that a user picks?
tagged with: java
has body: So I have program that determines the number of creatures called Tribbles in a generation. I have two methods that uses two different ways of getting the solution, a recursive method and an iterative method. My methods are created so that for generation n: if N<2 then 1 tribble exists. if N=2 then 2 tribble exists. if N=3 then 4 tribble exists. if N>3 then gen(n-1)+gen(n-2)+gen(n-3)+gen(n-4) Now with that said, I have a data1.txt file that have random numbers for example: 8 0 1 2 3 4 5 30 67 My question is how do I ask a question to the user for a file name and also ask them what type of algorithm to use (im only working on option 1 & 2 so far) and get the integers from the file and print out the number of tribbles exist for each generation. For example for the numbers above it should print: 1 1 2 4 8 15 201061985 and so on. Thanks in advance and please I would definitely like your help! PS. For my readfile im placing all my data I get from the file in an array and for my options I'm using those data in the array and use one of my solution methods. public class TribbleAnalysis { //Fields public static long n; public static String fileName; //Methods public long genRec(){ return genRec(n); } private static long genRec(long n){ if(n < 2) return 1; else if( n == 2) return 2; else if( n == 3) return 4; else return genRec(n-1)+genRec(n-2)+genRec(n-3)+genRec(n-4); } public static long genIter(int n){ long[] myArray = new long[67]; myArray[0] = 1; myArray[1] = 1; myArray[2] = 2; myArray[3] = 4; for(int i=4; i <= n; i++){ myArray[i] = myArray[i-1]+myArray[i-2]+myArray[i-3]+myArray[i-4]; } return myArray[n]; } public static void optionOne(String fileName){ List<Integer> myNumbers = readFile(fileName); for (int i=0; i<myNumbers.size(); i++){ System.out.println(genRec(i)); } } public static void optionTwo(String fileName){ List<Integer> myNumbers = readFile(fileName); for (int i=0; i<myNumbers.size(); i++){ System.out.println(genIter(i)); } } public static void optionThree(Str…
has comment: http://stackoverflow.com/comment/36270781
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36270744
has comment: http://stackoverflow.com/comment/36270343
has comment: http://stackoverflow.com/comment/36270366
has comment: http://stackoverflow.com/comment/36270488
score: -1
has comment: http://stackoverflow.com/comment/36270794
has comment: http://stackoverflow.com/comment/36270401
has comment: http://stackoverflow.com/comment/36270413
has comment: http://stackoverflow.com/comment/36270758

http://stackoverflow.com/comment/36574825
has text: 'ne' is just a variable. Just like you took 'justcheckin a'.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23774308
type: Comment

http://stackoverflow.com/q/23646186
has answer: http://stackoverflow.com/a/23646843
has answer: http://stackoverflow.com/a/24966130
has comment: http://stackoverflow.com/comment/36327816
has comment: http://stackoverflow.com/comment/36323700
upvote count: 10
has comment: http://stackoverflow.com/comment/36314989
tagged with: multimap
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/711618
has body: I have a multimap (like that provided by Guava): Multimap&lt;K, V&gt; which could be seen logically as: Map&lt;K, Set&lt;V&gt;&gt; The data in my multimap, has unique keys AND unique values. i.e. There can never be the same value assigned to more than one key. Aside from maintaining two Map structures, does anyone know of an existing class/api that might give me fast lookup by either key or value. e.g. Collection&lt;V&gt; get(K) ...and... K getKeyByValue(V) BTW, the Map MUST be mutable, i.e. my data is changing all the time. (For immutable Maps, Guava provides an ImmutableMultimap.inverse() which would solve this problem if my Map could be immutable.) Any help would be apprecated.
has comment: http://stackoverflow.com/comment/36314938
tagged with: guava
downvote count: 0
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/36315230
has comment: http://stackoverflow.com/comment/36327228
has comment: http://stackoverflow.com/comment/36330145
type: Question
answer count: 2
has title: A Java multimap which allows fast lookup of key by value
has comment: http://stackoverflow.com/comment/36372332
favorite count: 0

http://stackoverflow.com/a/23703024
upvote count: 1
type: Answer
has body: This is correct. Those are the characters for the codes that you provided. If you change your byte array to this, you'll see characters a-f: byte[] arr = { 97, 98, 99, 100, 101, 102 };
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23702926

http://stackoverflow.com/comment/36276461
type: QuestionComment
comment on: http://stackoverflow.com/q/23626225
score: 0
type: Comment
has text: One Video and two audio. i have tried another one. where do i specify the target format in xuggler?

http://stackoverflow.com/a/23717196
has body: I don't know much about java but with C++ you are primarily concerned about dynamic memory management and overloading in starting and shutting it off... I can say that in terms of optimization if the methodology of the algorithm will slow the progress of the system, then you are referring to asymetrics... However, my concern is that you are right in questioning overloading, but if there are other forms of asking the same question in your program doesn't best uses (best practices) teach that is the way to write to the results for preventing errors...
type: Answer
downvote count: 1
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/23716987

series
tag name: series
type: Tag
tags question: http://stackoverflow.com/q/23707966

http://stackoverflow.com/a/23722033
downvote count: 0
has body: If I were to use an ArrayList I believe checking for the existence of some specified string would iterate through all items until a matching string is found Correct, checking a list for an item is linear in the number of entries of the list. However, I am not keen on filling a HashMap where the value is completely arbitrary You don't have to: Java provides a HashSet&lt;T&gt; class, which is very much like a HashMap without the value part. You can put all your strings there, and then check for presence or absence of other strings in constant time; Set&lt;String&gt; knownStrings = new HashSet&lt;String&gt;(); ... // Fill the set with strings if (knownString.contains(myString)) { ... }
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/23722011
answers question: http://stackoverflow.com/q/23722011
score: 8
type: AcceptedAnswer

http://stackoverflow.com/comment/36547394
type: QuestionComment
comment on: http://stackoverflow.com/q/23766576
score: 1
has text: For any non-array class, `TheClassName.class.getName()` will return the full dot-separated name as a String. `someObj.getClass().getName()` will return the class name of an object. `someObj.getClass().getSuperclass().getName()` will return the name of the superclass.
type: Comment

http://stackoverflow.com/a/23620224
has comment: http://stackoverflow.com/comment/36264899
upvote count: 3
has comment: http://stackoverflow.com/comment/36264844
downvote count: 0
has comment: http://stackoverflow.com/comment/36264980
type: AcceptedAnswer
has body: The problem is in your main thread. It starts in a paused state, will get unpaused ONCE, then remain stuck for ever in while (true) { if (!paused) { ... GAME STUFF ... } } If pause becomes true again, you will just actively loop without ever doing the GAME STUFF. The thread is not sleeping (which is why it is very active without doing anything), so this if statement is never executed if (mainThread.getState() == Thread.State.WAITING) { paused = false; notify(); } pause will remain true. You can fix like this: mainThread = new Thread() {public void run() { while (true) { if (!paused) { //... GAME STUFF ... } else synchronized (this) { try { paused = false; wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }; Also, change the notify() to: synchronized (mainThread) {mainThread.notify();} The wait and notify methods must be called on the same object (inside your thread)
accepted answer of: http://stackoverflow.com/q/23620112
has comment: http://stackoverflow.com/comment/36265045
type: Answer
answers question: http://stackoverflow.com/q/23620112
score: 3

http://stackoverflow.com/comment/36387139
comment on: http://stackoverflow.com/q/23683287
score: 0
has text: Related: http://stackoverflow.com/questions/12923302/good-practices-for-java-exceptions-handling
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23753283
has comment: http://stackoverflow.com/comment/36571223
upvote count: 1
answers question: http://stackoverflow.com/q/23753215
score: 1
downvote count: 0
has body: Just call list() to get all the URLs, and then for each URL call lookup() to get the corresponding stub.
type: Answer
has comment: http://stackoverflow.com/comment/36523163

http://stackoverflow.com/q/23625921
type: Question
tagged with: resources
tagged with: gwt
has comment: http://stackoverflow.com/comment/36276883
has comment: http://stackoverflow.com/comment/36276150
has title: ClientBundle and Images GWT Exception
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23626356
has comment: http://stackoverflow.com/comment/36275909
has comment: http://stackoverflow.com/comment/36276291
has answer: http://stackoverflow.com/a/23626356
accepted answer: http://stackoverflow.com/a/23626353
type: AnsweredQuestion
tagged with: java
tagged with: clientbundle
has answer: http://stackoverflow.com/a/23626353
has body: I am trying to use ClientBundle in GWT To load messages. Here is my code: gwt.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;module rename-to='StockWatcher'&gt; &lt;!-- Inherit the core Web Toolkit stuff. --&gt; &lt;inherits name='com.google.gwt.user.User'/&gt; &lt;!-- We need the JUnit module in the main module, --&gt; &lt;!-- otherwise eclipse complains (Google plugin bug?) --&gt; &lt;inherits name='com.google.gwt.junit.JUnit'/&gt; &lt;!-- Inherit the default GWT style sheet. You can change --&gt; &lt;!-- the theme of your GWT application by uncommenting --&gt; &lt;!-- any one of the following lines. --&gt; &lt;inherits name='com.google.gwt.user.theme.standard.Standard'/&gt; &lt;!-- &lt;inherits name='com.google.gwt.user.theme.chrome.Chrome'/&gt; --&gt; &lt;!-- &lt;inherits name='com.google.gwt.user.theme.dark.Dark'/&gt; --&gt; &lt;!-- Other module inherits --&gt; &lt;!-- Specify the app entry point class. --&gt; &lt;entry-point class='ro.gebs.master.client.StockWatcher'/&gt; &lt;!-- Specify the paths for translatable code --&gt; &lt;source path='client'/&gt; &lt;source path='shared'/&gt; &lt;source path='resources'/&gt; &lt;/module&gt; The interface that extends ClientBundle: public interface Resources extends ClientBundle { Resources IMPL = (Resources) GWT.create(Resources.class); @Source("ro/gebs/master/resources/blogger.png") ImageResource blogger(); @Source("ro/gebs/master/resources/delicious.png") ImageResource delicious(); @Source("ro/gebs/master/resources/facebook.png") ImageResource facebook(); } Here i try to use the images in my EntryPoint class: ImageResource[] icons = new ImageResource[]{ Resources.IMPL.blogger(), Resources.IMPL.delicious(), Resources.IMPL.facebook() }; And the error i get: Exception while loading module ro.gebs.master.client.StockWatcher. See Development Mode for details. java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Nati…

http://stackoverflow.com/comment/36723651
type: AnswerComment
has text: Exactly you are right. But if i use same button for start-stop action i must use if condition inside ButtonAction you know. How i stop current timer outside if clause ?
type: Comment
comment on: http://stackoverflow.com/a/23755915
score: 0

http://stackoverflow.com/comment/36489077
has text: check for the keyword `extends` in the potential subclass.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23737074
score: 1

http://stackoverflow.com/q/23663946
type: Question
accepted answer: http://stackoverflow.com/a/23664267
tagged with: apache
tagged with: entities
has body: We are using solr to make a custom searcch engine, but we have a problem, characters like accents letters give us problem with post.jar. We solved the "&amp;" problem using &amp; Is there a way to use entities like &egrave;or other? Can anyone help us?
has comment: http://stackoverflow.com/comment/36350174
downvote count: 0
answer count: 1
favorite count: 0
has title: How to index with post.jar in solr characters like accented letter
has answer: http://stackoverflow.com/a/23664267
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: solr
tagged with: special-characters

http://stackoverflow.com/q/23633523
tagged with: named-query
tagged with: jpa
linked to: http://stackoverflow.com/q/2772305
score: 4
has comment: http://stackoverflow.com/comment/36309135
tagged with: eclipselink
tagged with: sql
answer count: 1
has title: Search keywords in database
favorite count: 0
has comment: http://stackoverflow.com/comment/36305037
accepted answer: http://stackoverflow.com/a/23640806
upvote count: 4
has comment: http://stackoverflow.com/comment/36317049
type: AnsweredQuestion
has body: I'm using Eclipselink and have a tricky problem regarding JPA NamedQueries. My database table contains a column which is from type VARCHAR and stores a comma separated list of keywords as one String. How can I create a NamedQuery in JPA to search theese keywords? I'd like to give a list of Strings as a parameter and as a result I'd like to have a list of objects which keyword list contain one of the Strings from the parameter list. Maybe like the following: List&lt;String&gt; keywordList = new ArrayList&lt;String&gt;(); keywordList.add("test"); keywordList.add("car"); List&lt;Object&gt; result = em.createNamedQuery("findObjectByKeywords", Object.class) .setParameter("keywords", keywordList) .getResultList(); Unfortunately I'm not such a big database/SQL expert. Maybe someone of you can help me? I hope you understand my problem. Edit: I am developing on Weblogic 10.3.6, which means I am not able to use JPA 2.0 features. Edit2: I managed to activate JPA 2.0 in my Weblogic Server with the help of Oracle Enterprise Pack for Eclipse. Problem solved, I think.
downvote count: 0
has answer: http://stackoverflow.com/a/23640806
tagged with: java
has comment: http://stackoverflow.com/comment/36291246
has comment: http://stackoverflow.com/comment/36292025
type: Question

http://stackoverflow.com/comment/36322098
comment on: http://stackoverflow.com/q/23649668
type: QuestionComment
type: Comment
score: 1
has text: can you please post your questions.xml code ?

http://stackoverflow.com/comment/36330351
has text: @Cerbrus .. so what could we use in java script to make it utf8 compliant. is there any library we have to use for this task ..
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23654187

http://stackoverflow.com/q/23664743
tagged with: archlinux
has body: why can't I run a jar from a shellscript when double clicking it? Failed to execute child process "~/start.sh" (Permission denied) #!/bin/bash java -jar test.jar I'm running on Arch linux x64
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36352073
has title: Can run jar from command line but not from shell script + permission denied
accepted answer: http://stackoverflow.com/a/23664772
score: 0
has answer: http://stackoverflow.com/a/23664772
tagged with: permission-denied
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/36373058
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23676155
type: Comment
has text: Maybe this can help you: http://stackoverflow.com/questions/12251424/mocking-getclass-method-with-powermockito

http://stackoverflow.com/comment/36429976
has text: Once you close an input stream you can't open it again. Closing the scanner closes the underlying input stream, which in this case is `System.in`.
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/23705961

http://stackoverflow.com/comment/36484824
type: QuestionComment
comment on: http://stackoverflow.com/q/23734393
score: 1
has text: This benchmark could interest you : https://code.google.com/p/java-matrix-benchmark/wiki/RuntimePerformanceBenchmark
type: Comment

http://stackoverflow.com/q/23728518
answer count: 0
has body: I am not a pro so please bear with me! I rent a server (Linux, Debian) with 24Gb RAM with Glassfish 3.1 running on it (nothing else installed). The app deployed on GlassFish runs very computationally intensive methods. How can I set the memory settings of GlassFish (and the JDK??) so that my app can utilize the 24Gb if necessary?
tagged with: java
linked to: http://stackoverflow.com/q/10992294
has comment: http://stackoverflow.com/comment/36516817
type: Question
has comment: http://stackoverflow.com/comment/36474795
duplicate of: http://stackoverflow.com/q/10992294
has comment: http://stackoverflow.com/comment/36479271
tagged with: glassfish
has comment: http://stackoverflow.com/comment/36479487
score: 0
has comment: http://stackoverflow.com/comment/36475666
has comment: http://stackoverflow.com/comment/36475623
has comment: http://stackoverflow.com/comment/36478483
has comment: http://stackoverflow.com/comment/36474121
tagged with: jvm
has title: How to allocate the maximum available RAM to GlassFish?
tagged with: linux
has comment: http://stackoverflow.com/comment/36478442
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36801614
linked to: http://stackoverflow.com/q/17468189
tagged with: memory-management

http://stackoverflow.com/comment/36351596
comment on: http://stackoverflow.com/q/23664487
has text: @KeelenBerkenkotter Solace got it there. I thought APCS taught you abstract classes though... As for additional warnings, I was going off of the compiler warning said. How are you compiling your code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23665219
has comment: http://stackoverflow.com/comment/36353034
score: 0
answer count: 2
has body: I got problem with my first Android application. Just after running, my app crashes in emulator with "Unfortunately has stopped." message. I checked many threads on Stack and I read pretty much of official documentation and I really do not know what's a cause... I use AVD with Android 4.4.2, API Level 19. CPU/ABI - ARM. Use Host GPU - checked (without this one emulator works very slowly). My app should play a song after pressing the button. I would be really grateful for any ideas. Cheers. Java file: import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.os.Build; import android.media.MediaPlayer; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } Button one = (Button) findViewById(R.id.button1); final MediaPlayer mediaPlayer1 = MediaPlayer.create(this, R.raw.elements6); one.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mediaPlayer1.start(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } retu…
tagged with: button
has title: Android application crashes after launch. Button issue?
tagged with: android
has comment: http://stackoverflow.com/comment/36353547
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23665602
has comment: http://stackoverflow.com/comment/36353213
has answer: http://stackoverflow.com/a/23665602
tagged with: java
has answer: http://stackoverflow.com/a/23665489
has comment: http://stackoverflow.com/comment/36353280
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36352774
type: Question
tagged with: crash
accepted answer: http://stackoverflow.com/a/23665489

http://stackoverflow.com/q/23622842
has comment: http://stackoverflow.com/comment/36355702
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36274643
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23632741
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36269865
has body: The application is supposed to update a table whenever a request is made. I have the following code to receive notifications from server. When I run the application it shows followings in alert boxes, seems it is connected but when I call 'send' method of the notification class it does not change anything. Alert 1) windowfunction connect() { wsocket = new WebSocket("ws://localhost:8080/Notifications"); alert("got connected"); document.getElementById("foo").innerHTML = "arraypv[0]"; wsocket.onmessage = onMessage; } Alert 2) got connected JavaScript Code @ServerEndpoint("/Notifications") public class Notifications { /* Queue for all open WebSocket sessions */ static Queue<Session> queue = new ConcurrentLinkedQueue(); public static void send() { System.err.println("send"); String msg = "Here is the message"; try { /* Send updates to all open WebSocket sessions */ for (Session session : queue) { session.getBasicRemote().sendText(msg); } } catch (IOException e) { e.printStackTrace(); } } @OnOpen public void openConnection(Session session) { System.err.println("in open connection"); queue.add(session); } @OnClose public void closedConnection(Session session) { System.err.println("in closed connection"); queue.remove(session); } @OnError public void error(Session session, Throwable t) { System.err.println("in error"); queue.remove(session); } } Maven javax.websocket javax.websocket-api 1.0-b08 To send a message I use following code in one of my functions Notifications.send(); Console just shows SEVERE: send When I trace the connection using FireBug it shows Firefox can't establish a connection to the server at ws://localhost:8080/Notifications.
has title: Can not establish a WebSocket connection from JavaScript
tagged with: javascript
tagged with: struts2
downvote count: 0
answer count: 1
tagged with: websocket
favorite count: 0

http://stackoverflow.com/a/23757598
score: 0
has body: I would implement a method in the BinaryTree class like this: /** * * Search and returns the first node in the tree whose id match the passed id * * @param id of the searched person * * @return Person the found person * or the special value Person#UNKOWN_PERSON if no matching id found */ public Person findById(int id) { // ... } In you main code, you would have: Person p = MyTree.findById(user_input.nextInt()); Here is the definition of UNKNOWN_PERSON: public class Person { public static final Person UNKNOWN_PERSON = new Person(...); // ... }
answers question: http://stackoverflow.com/q/23757131
type: Answer

http://stackoverflow.com/comment/36526258
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23742422
type: AnswerComment
has text: I don't even know how the spring and servlet-api dependencies come into the lib folder. How could i avoid having those jars there? The gwt-config in the pom.xml is from the official gwtproject page.

http://stackoverflow.com/comment/36407110
has text: @Transactional did not fix this problem. I had already tried it before posting this.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23662039

http://stackoverflow.com/a/23766751
downvote count: 0
has comment: http://stackoverflow.com/comment/36546507
upvote count: 2
has body: I'll try to annotate a possible execution flow for both threads in (number). Main Thread: Thread t = new Thread(sleeper); t.start(); &lt;&lt;&lt; (1) your thread is started; its execution now runs in parallel to this thread Thread.sleep(500); &lt;&lt;&lt; (2) this thread is now sleeping; the "sleeper" thread is still running! t.interrupt(); &lt;&lt;&lt; (3) 500 milliseconds (0.5 second) later, trying to interrupt, but that thread is most likely already finished by now; this is a no-op sleeper Thread: public void run() { &lt;&lt;&lt; (1) this thread starting if (Thread.interrupted()) { &lt;&lt;&lt; (2.1) Am I interrupted? (Not yet, so no) System.out.println("Thread has been interrupted"); System.out.println(Thread.currentThread().isInterrupted()); &lt;&lt;&lt; (2.2) Finished executing. This thread is done. } }
has comment: http://stackoverflow.com/comment/36546143
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23766615
has comment: http://stackoverflow.com/comment/36546468
accepted answer of: http://stackoverflow.com/q/23766615
type: Answer
score: 2

architecture
tags question: http://stackoverflow.com/q/23709175
type: Tag
tags question: http://stackoverflow.com/q/23735461
tag name: architecture

http://stackoverflow.com/a/23963338
has body: This code skeleton works on your example but should be improved and tested with different scenarios. public class PojoTypeAdapaterFactory implements TypeAdapterFactory { @Override public &lt;T&gt; TypeAdapter&lt;T&gt; create(final Gson gson, final TypeToken&lt;T&gt; type) { // check types we support if (type.getRawType().isAssignableFrom(CustomMessage.class) || type.getRawType().isAssignableFrom(PayloadMessage.class)) { return new PojoTypeAdapter&lt;T&gt;(gson, type); } else return null; } private class PojoTypeAdapter&lt;T&gt; extends TypeAdapter&lt;T&gt; { private Gson gson; private TypeToken&lt;T&gt; type; private PojoTypeAdapter(final Gson gson, final TypeToken&lt;T&gt; type) { this.gson = gson; this.type = type; } public T read(JsonReader reader) throws IOException { final TypeAdapter&lt;T&gt; delegate = gson.getDelegateAdapter(PojoTypeAdapaterFactory.this, this.type); final TypeAdapter&lt;JsonElement&gt; elementAdapter = this.gson.getAdapter(JsonElement.class); JsonElement jsonElement = elementAdapter.read(reader); if (!jsonElement.isJsonObject()) { return (T) this.gson.getAdapter(JsonElement.class).fromJsonTree(jsonElement); } JsonObject jsonObject = jsonElement.getAsJsonObject(); JsonElement typeElement = jsonObject.get("$type"); if (typeElement == null) { return delegate.fromJsonTree(jsonElement); } try { final Class myClass = Class.forName(typeElement.getAsString()); final Object myInstance = myClass.newInstance(); final JsonObject jsonValue = jsonElement.getAsJsonObject().get("value").getAsJsonObject(); for (Map.Entry&lt;String, JsonElement&gt; jsonEntry : jsonValue.entrySet()) { final Field myField = myClass.getDeclaredField(jsonEntry.getKey()); myField.setAccessible(true); Object value = null; if (jsonEntry.getValue().isJsonArray()) { //value = ...; } else if (jsonEntry.getValue().isJsonPrimitive()) { final TypeAdapter fieldAdapter = this.gson.getAdapter(myField.getType()); value = fieldAdapter.fromJsonTree(jsonEntry.getValue()); } else if (jsonEntry.ge…
score: 0
answers question: http://stackoverflow.com/q/23695649
type: Answer

http://stackoverflow.com/a/23713815
type: AcceptedAnswer
downvote count: 0
has body: If you want to keep single spaces, but split on 2+ spaces, the expression looks like this: data= s.split("\\s*\\:\\s*|\\s{2,}"); This produces the output that you need (demo): My name is John Smith 13 75,5
type: Answer
accepted answer of: http://stackoverflow.com/q/23713756
answers question: http://stackoverflow.com/q/23713756
upvote count: 1
score: 1

unit-testing
tags question: http://stackoverflow.com/q/23632330
tags question: http://stackoverflow.com/q/23701616
tags question: http://stackoverflow.com/q/23618039
tags question: http://stackoverflow.com/q/23632169
tags question: http://stackoverflow.com/q/23686948
tags question: http://stackoverflow.com/q/23751744
tags question: http://stackoverflow.com/q/23737250
tags question: http://stackoverflow.com/q/23707983
tags question: http://stackoverflow.com/q/23702431
tags question: http://stackoverflow.com/q/23676719
tags question: http://stackoverflow.com/q/23722456
tags question: http://stackoverflow.com/q/23685499
tags question: http://stackoverflow.com/q/23654990
tags question: http://stackoverflow.com/q/23764386
tags question: http://stackoverflow.com/q/23656135
tags question: http://stackoverflow.com/q/23752048
type: Tag
tags question: http://stackoverflow.com/q/23616285
tag name: unit-testing
tags question: http://stackoverflow.com/q/23679391
tags question: http://stackoverflow.com/q/23656063
tags question: http://stackoverflow.com/q/23773340
tags question: http://stackoverflow.com/q/23762443
tags question: http://stackoverflow.com/q/23653583
tags question: http://stackoverflow.com/q/23624355
tags question: http://stackoverflow.com/q/23743630

http://stackoverflow.com/q/23688337
has answer: http://stackoverflow.com/a/23688427
has answer: http://stackoverflow.com/a/23688618
type: UnansweredQuestion
upvote count: 1
tagged with: primitive
has title: How to create an ArrayList of arrays of primitives
has comment: http://stackoverflow.com/comment/36396969
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36396966
has comment: http://stackoverflow.com/comment/36397039
type: Question
score: -2
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/23688402
tagged with: arraylist
has answer: http://stackoverflow.com/a/23688407
has answer: http://stackoverflow.com/a/23690053
answer count: 5
has body: This may sound confusing, but I'd like to make an ArrayList which contains int[]. Would an int[] be considered an object, or is it treated the same way as a primitive and require wrapping and unwrapping the values. For example: ArrayList&lt;int[]&gt; intArrays = new ArrayList&lt;int[]&gt;(); The reason I use an ArrayList is I'd like it does not have a set amount of members, and has an unknown amount of max values. Therefore, an int[][] wouldn't work. I just need to know if the above is valid.

http://stackoverflow.com/q/23673183
has comment: http://stackoverflow.com/comment/36401542
type: Question
has comment: http://stackoverflow.com/comment/36374687
has comment: http://stackoverflow.com/comment/36376056
has comment: http://stackoverflow.com/comment/36367647
has answer: http://stackoverflow.com/a/23673494
has comment: http://stackoverflow.com/comment/36367519
tagged with: postgresql
score: 0
has title: what is the correct mapping in JAVA for a Varchar DB column which holds numeric values?
answer count: 1
type: UnansweredQuestion
has body: I have a column defined in a table in postgres DB as: counterparty_company_number character varying(255) I have written a JAVA code to populate this table with values from corresponding columns of an excel file. In the sample excel file, this column has 8 rows,out of which some are blank,like: counterparty_company_number blank 234567 345678 456789 567890 1.03E+09 blank blank In my model class,I have defined the attribute for this column as: private String counterparty_company_number; In my code, I replaced blank values with empty String while saving.After reading the data from excel and saving in DB,the values in corresponding column of DB table appear as: "" "234567.0" "345678.0" "456789.0" "567890.0" "1.0304388E9" "" "" This is the snippet from the code that reads the excel file and populates the table in DB: .. //reads excel file and stores values in a list FileInputStream file = new FileInputStream(new File(filepath)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet xssfSheet = workbook.getSheetAt(0); if (xssfSheet.getLastRowNum() != 0) { for (int i = 1; i &lt;= xssfSheet.getLastRowNum(); i++) { Row row = xssfSheet.getRow(i); for (int j = 0; j &lt; row.getLastCellNum(); j++) { Cell cell = row.getCell(j); if (cell != null) { valueHolder.add(cell.toString()); } else {valueHolder.add(""); } } } } .. //sets attribute values in model class if (!valueHolder.isEmpty() &amp;&amp; valueHolder != null) { for (int i = 0; i &lt; valueHolder.size(); i += 10) { CardsCounterparty ccp = new CardsCounterparty(); .. ccp.setCounterparty_company_number(valueHolder.get(i+3).toString()); .. counterpartyList.add(ccp);//counterpartyList is a list of counterparty objects } } return counterpartyList;//this list is passed to the code that will save the objects in DB table } .. //code to persist in DB Configuration c = new Configuration(); c.configure("/hibernate.cfg.xml"); SessionFactory sf = c.buildSessionFactory(); Session s = sf.openSession(); Transaction tx = s.beginTransact…
tagged with: excel
has comment: http://stackoverflow.com/comment/36375816
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/23764966
type: Answer
has body: String[] array = aaa; aaa is a Taxi object so it makes no sense to set a String[] object to a Taxi object. What you want is: String[] array = aaa.aaa;
answers question: http://stackoverflow.com/q/23764029
score: 0

http://stackoverflow.com/comment/53549494
type: Comment
has text: Awesome! Very very clear in almost all respects, but confusing because you mix up decimal and and binary powers. Since you're calculating mebibytes rather than megabytes, you should change `"%.2f M"` to `"%.2f MiB"` as discussed at https://en.wikipedia.org/wiki/Binary_prefix
comment on: http://stackoverflow.com/a/23702224
type: AnswerComment
score: 0

http://stackoverflow.com/a/42631131
answers question: http://stackoverflow.com/q/23673743
score: 1
upvote count: 1
has body: This is certainly possible. Once you've got the hang of it the setup is easy - just a config class in the library and an @Import in the consuming application. Note: I've only tested this so far with JPA and autowiring, I believe it should work with most common Spring features but can't confirm this yet. So in your library in the src/main/etc.. @Configuration @EntityScan(basePackages = "uk.co.company.name.models") @ComponentScan(basePackages = { "uk.co.company.name" }) @EnableJpaRepositories("uk.co.company.name") public class LibraryNameConfig { } Then in src/test @SpringBootApplication @Import({ LibraryNameConfig.class}) public class FakeTestApp { public static void blah() {} } And test as normal @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = FakeTestApp.class) public class TestTestModelWiredUp { @Autowired TestModelService testModelService; @Test public void contextLoads() { } } That should work nicely with a standard gradle/mvn to produce a tested jar. Then to use it in another Spring Boot application include the jar as a dependency as you would standardly To make it work in the application you just need to @Import it again as above. I've set up both my application and libraries in the same way with a Configuration Class that's imported. There appear to be dozens of ways to configure things in Spring Boot with annotations, this setup works for me. @SpringBootApplication @Import({ LibraryNameConfig.class, RealAppConfig.class}) public class SpringBootApp { public static void aFunction() {} } You'll need an application.properties in the Library for testing, but it will use the applications ones when included as a library.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36547504
type: Comment
type: QuestionComment
score: 0
has text: So they can access the log but not the property file?
comment on: http://stackoverflow.com/q/23761089

http://stackoverflow.com/q/23750741
tagged with: transparent
has title: How to set semi-transparent image to Shell background?
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23869213
answer count: 1
favorite count: 0
has body: I am developping an SWT application, and I want to give the application a background png,but setBackgroundImage is not support transparent. Is there any way to solve the problem? There are some semi-transparent pixels , I wish to see desktop on these positions. ps the shell is no-trim style
type: UnansweredQuestion
tagged with: swt
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/a/23663447
has comment: http://stackoverflow.com/comment/36349333
type: Answer
has comment: http://stackoverflow.com/comment/36349145
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23663295
has comment: http://stackoverflow.com/comment/36349075
answers question: http://stackoverflow.com/q/23663295
score: 1
has body: If you are only looking for a variant then how the following - public String method(Number n) throws RuntimeException or, public &lt;T extends Number&gt; String method(T n) throws RuntimeException Also, the other that don't apply in case of String, because it's final, is that the overriding methods are allowed return a subtype of return type in the parent.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23666177
downvote count: 2
has comment: http://stackoverflow.com/comment/36354443
upvote count: 1
has answer: http://stackoverflow.com/a/23666185
answer count: 1
has comment: http://stackoverflow.com/comment/36355221
favorite count: 0
has comment: http://stackoverflow.com/comment/36355152
has comment: http://stackoverflow.com/comment/36355220
has comment: http://stackoverflow.com/comment/36355052
has comment: http://stackoverflow.com/comment/36355228
has title: Can't find symbol in setText
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36354379
has body: private void jToggleButton3MouseClicked(java.awt.event.MouseEvent evt) { Chaine=jTextField1.getText(); jTextAreal.setText("Bonjour Monsieur"+Chaine); } I have error : cannot find symbol in setText ??
tagged with: java
has comment: http://stackoverflow.com/comment/36354786
score: -1
has comment: http://stackoverflow.com/comment/36355258
type: Question

http://stackoverflow.com/comment/36515959
comment on: http://stackoverflow.com/q/23751093
has text: @MagnusCaligo, Add `public ` in front of the `Block()` constructor.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23651074
has comment: http://stackoverflow.com/comment/36325842
has title: How to retrieve mysql data using Java multi-threading
type: UnansweredQuestion
score: 1
tagged with: multithreading
has answer: http://stackoverflow.com/a/23651764
has body: I have around 50 millions of records in my mysql table. When i retrieve it using java it takes more than 20 hrs. And recently i am facing communication link failure error after processing 500,000 records. (Question) Can some one please tell me, how to access these records using multi-threading in java. After retrieving each record i need to perform some pre-processing and then store the result in a text file. Thanks.
upvote count: 1
has comment: http://stackoverflow.com/comment/36325110
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/36325575
type: Question
has comment: http://stackoverflow.com/comment/36325750
has comment: http://stackoverflow.com/comment/36325273
has comment: http://stackoverflow.com/comment/36324328
has comment: http://stackoverflow.com/comment/36324712
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36325352
has comment: http://stackoverflow.com/comment/36324973
has comment: http://stackoverflow.com/comment/36325217

http://stackoverflow.com/q/23648495
has title: Java: Binding the XML Schema itself to classes
has answer: http://stackoverflow.com/a/23648586
accepted answer: http://stackoverflow.com/a/23648586
tagged with: http://stackoverflow.com/tag/xml
has body: i know that you can generate Java classes from an XSD file with JAXB or similar methods and then use them with your resulting XML files. That's not what i'm looking for though. I was wondering if it is possible to generate a generic Java representation of the XSD itself and if there are programs that parse any random XSD and fill the Java classes with it. For example, let's take this short excerpt from an XSD: &lt;xs:complexType name="pc-type"&gt; &lt;xs:sequence&gt; &lt;xs:element name="name" type="xs:string"/&gt; &lt;xs:element name="manufacturer" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="id" type="xs:integer"/&gt; &lt;/xs:complexType&gt; A Java representation could be something like: public class ComplexType{ String name; List&lt;Attribute&gt; attributes; List&lt;Element&gt; elements; ... } Does something like this exist?
upvote count: 2
tagged with: xsd
score: 2
type: AnsweredQuestion
tagged with: schema
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23633015
score: 3
type: AcceptedAnswer
has body: My first reaction when I see a question like this (and I ask these questions too) is to look for the hidden assumptions. It seems to me that there's an implicit assumption here that creating these short lived objects just to do a lookup is a pretty expensive operation. So, I wrote up a quick little benchmark where I made two caches, one based on a custom complex key, and the other with string concatenation. Each had 1,000,000 entries. For the actual tests, then, I did 1,000,000 lookups. What I found was that the results were pretty close, around 500ms on my machine, with the string concatenation being on average about 7.5% slower. I also added a third test in which I did the lookups by a complex key, but reused the same object, only mutating the values. I found this to be very comparable, at about 3.5% fast than creating new objects for each lookup. My benchmark may not be hugely rigorous, but I think it shows that these methods are close enough that I would not shy away from creating a small, short-live object for the purpose of performing a lookup.
accepted answer of: http://stackoverflow.com/q/23629233
upvote count: 3
answers question: http://stackoverflow.com/q/23629233
type: Answer
downvote count: 0

http://stackoverflow.com/q/23659829
answer count: 3
score: 5
favorite count: 0
has body: I am running jUnit4 tests, built with Maven, on a Jenkins box. My goal is to restore a test database before executing the tests. It looks like exec-maven-plugin is the way to go, but I cannot get it running. Any pointers? Although there are lots of examples, the doc on the mojo site is pretty thin. The class I need to run currently lives at: MyProject.src.test.java._tools.BuildTestEnvironment.java My pom.xml includes: maven-compiler-plugin 2.3.2 1.6 1.6 org.codehaus.mojo exec-maven-plugin 1.3 build-test-environment generate-test-resources java src.test.java._tools.BuildTestEnvironment Run this in Jenkins, nothing really happens. If I run it locally, I get Things I have tried, without success: Run the build in Jenkins: Nothing really happens. The project builds and starts running tests, but my class is not run. Run the build locally: Same result as in Jenkins. No surprise there. Run generate-test-resources locally: ClassNotFoundException. ie: mvn exec:java generate-test-resources java.lang.ClassNotFoundException: src.test.java._tools.BuildTestEnvironment Compile the class into a jar, and add that to my pom. Update: After reading @ppuskar's comments, I tried moving my buildxxx class around a bit. After moving it to src.main.java._tools.BuildTestEnvironment, I still get a similar message. Here is my build log, in case that helps: [DEBUG] Invoking : test.java._tools.BuildTestEnvironment.main() [DEBUG] Plugin Dependencies will be excluded. [DEBUG] Project Dependencies will be included. [DEBUG] Collected project artifacts [joda-time:joda-time:jar:2.3:compile, net.sf.jt400:jt400:jar:6.7:compile, junit:junit:jar:4.11:compile, org.hamcrest:hamcrest-core:jar:1.3:compile, com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile, com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile, com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile, org.hamcrest:hamcrest-all:jar:1.3:compile, org.apache.logging.log4j:log4j-api:jar:2.0-rc1:compile, org.apache.logging.log4…
upvote count: 5
has answer: http://stackoverflow.com/a/23660994
accepted answer: http://stackoverflow.com/a/23660994
tagged with: maven
possible better answer: http://stackoverflow.com/a/31318448
tagged with: exec-maven-plugin
has answer: http://stackoverflow.com/a/49427727
has title: Maven run class before test phase: exec-maven-plugin exec:java not executing class
type: AnsweredQuestion
downvote count: 0
tagged with: jenkins
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36447090
has answer: http://stackoverflow.com/a/31318448

conflict
tag name: conflict
tags question: http://stackoverflow.com/q/23731626
type: Tag

http://stackoverflow.com/comment/36522637
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23754138
has text: btw, you have to call the .next() function in the loop, so you will actually go to the next element. Otherwise you will produce infinite loop

http://stackoverflow.com/q/23674914
downvote count: 1
has answer: http://stackoverflow.com/a/23674966
has body: As we know, static members has shared memory, they have no concern with object: class TestStatic { public static int a = 10; } class Main{ public static void main(//){ TestStatic obj1 = new TestObj//; obj1.a=15; TestStatic obj2 = new TestObj//; // obj2.a equals 15 too } } Suppose we have following scenario: class TestStatic { public static class InnerClass { } public static void main(//) { TestStatic.InnerClass classobj1 = new TestStatic.InnerClass(); TestStatic.InnerClass classobj2 = new TestStatic.InnerClass(); } } How Java treats classobj1 and classobj2? Allocates two different memory locations or a shared one? If different memory locations, what is the reason?
type: Question
has title: static inner class treated as static member or normal class?
answer count: 1
accepted answer: http://stackoverflow.com/a/23674966
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36370723
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/36494075
type: QuestionComment
score: 1
has text: Show stacktrace of error
comment on: http://stackoverflow.com/q/23739788
type: Comment

http://stackoverflow.com/a/23730690
score: 1
has comment: http://stackoverflow.com/comment/36477543
upvote count: 1
has comment: http://stackoverflow.com/comment/36477728
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23730583
has comment: http://stackoverflow.com/comment/36477766
answers question: http://stackoverflow.com/q/23730583
has comment: http://stackoverflow.com/comment/36477640
type: Answer
has body: Based on the sparse information available, the complexity for the worst case is probably along the order of O(con1 * con2 * con3 * con4 * con5( 2*con6 + con3 + con4))

http://stackoverflow.com/q/23650730
type: AnsweredQuestion
tagged with: android
has body: I am writing a little App that controls the I/O of a network camera with the camera's HTTP API. Basically you turn a port on with an url like "hostname.com/io/virtualinput.cgi?action=6:/" and turn it off with "hostname.com/io/virtualinput.cgi?action=6:\" When I call these URLS in Browser they work flawless. However when i do it in the App, I can only turn it on. I have replaced the Backslash in the String with \ but it still doesn't work. Is this the right way to do it? return new HttpGet("http://hostname.com/io/virtualinput.cgi?action=6:\\");
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23650792
tagged with: syntax
has title: Android: cannot request a URL that ends with Backslash
score: 0
tagged with: java
tagged with: backslash
tagged with: string
has answer: http://stackoverflow.com/a/23650792

http://stackoverflow.com/q/23763819
tagged with: android-activity
has comment: http://stackoverflow.com/comment/36539981
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
has body: Here is ss_birth.xml: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/SSB_Tv" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android:layout_marginTop="130dp" android:text="@string/SSB_Tv" android:gravity="center_horizontal" android:textSize="25sp"/> And SSBirthActivity.java: package ru.abcdefg.abcd; import android.app.Activity; import android.os.Bundle; public class SSBirthActivity extends Activity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ss_birth); } } And here is an activity. From it I want to start SSBirthActivity: public class MenuActivity extends Activity { String TAG = "Days"; int firstTimeCheck = 0; // 0 = 1st time; 1 = not 1st time @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.w(TAG, "--- MenuActivity ---"); Log.i(TAG, "Starting first time check"); firstTimeCheck = 0; // TEST OPTION [Make first time] if (firstTimeCheck == 0) { Log.w(TAG, "First time. Starting SSBirthActivity"); Intent intent = new Intent(this, SSBirthActivity.class); firstTimeCheck = 1; startActivity(intent); } } } Android manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> But when this activity starts there is just a white screen. By the way, when this activity starts, title changing. So activity starts, but shows nothing. Any ideas? Thanks in advance, SergaRUS
possible better answer: http://stackoverflow.com/a/23764087
has title: Activity don't show xml file
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23764087
has answer: http://stackoverflow.com/a/23764315
tagged with: java
score: -1
type: Question
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/36540146
has answer: http://stackoverflow.com/a/23763985
accepted answer: http://stackoverflow.com/a/23763985
favorite count: 0
tagged with: android

http://stackoverflow.com/q/23622686
type: AnsweredQuestion
has body: I have a json weather API that forecasts five days every three hours. I put part of the json with two forcasts since it is too long and repetitive: { "cod": "200", "message": 0.4194, "city": { "id": 1851632, "name": "Shuzenji", "coord": { "lon": 138.933334, "lat": 34.966671 }, "country": "JP", "population": 0 }, "cnt": 40, "list": [ { "dt": 1399950000, "main": { "temp": 287.82, "temp_min": 287.82, "temp_max": 287.82, "pressure": 923.74, "sea_level": 1018.93, "grnd_level": 923.74, "humidity": 100, "temp_kf": 0 }, "weather": [ { "id": 501, "main": "Rain", "description": "moderate rain", "icon": "10d" } ], "clouds": { "all": 92 }, "wind": { "speed": 0.51, "deg": 226.005 }, "rain": { "3h": 6 }, "sys": { "pod": "d" }, "dt_txt": "2014-05-13 03:00:00" }, { "dt": 1399960800, "main": { "temp": 291.36, "temp_min": 291.358, "temp_max": 291.36, "pressure": 921.65, "sea_level": 1016.09, "grnd_level": 921.65, "humidity": 87, "temp_kf": 0 }, "weather": [ { "id": 500, "main": "Rain", "description": "light rain", "icon": "10d" } ], "clouds": { "all": 20 }, "wind": { "speed": 0.87, "deg": 12.0018 }, "rain": { "3h": 0.5 }, "sys": { "pod": "d" }, "dt_txt": "2014-05-13 06:00:00" }, My problem is that I do not understand the logic of making java objects. I used jsongen for generating the java objects, but it seems it does not give me the right objects. by jsongen my java object classes are: public class Jweather { private Number cod; private Number message; private City city; private Number cnt; private myList list; ... } public class City{ private Coord coord; private String country; private Number id; private String name; private Number population; ... } public class Coord{ private Number lat; private Number lon; ... } public class myList{ List list = new ArrayList(); private Number clouds; private Number deg; private Number dt; private Number humidity; private Number pressure; private Number speed; private Temp temp; private List weather; ... } public class Temp{ private Number day; p…
has answer: http://stackoverflow.com/a/23622881
accepted answer: http://stackoverflow.com/a/23622881
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
answer count: 1
has title: convert Json object to java object: The logic

http://stackoverflow.com/comment/36369805
type: QuestionComment
comment on: http://stackoverflow.com/q/23674336
has text: Create a DataBase- words and Meanings. This can be static or be based on a web service or even a AI module. Once this DB is set up, you will have to provide the user with a search editText control. Next there are some cases you need to address like a Wrong spelling(If some one is finding a meaning to some word, it is possible that he spells it wrongly),then options like Populate suggestions as the user types and so on.
score: 0
type: Comment

http://stackoverflow.com/a/23795971
downvote count: 0
score: 1
has body: In the last two lines of your code change getContentPane().add(_pnl); // to setContentPane(_pnl) I got the same exception you did and changed the code to that. It works fine.
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23725697
answers question: http://stackoverflow.com/q/23725697

http://stackoverflow.com/a/23739704
has comment: http://stackoverflow.com/comment/36494235
has body: You're removing the filter after the first key press. Try something like this: public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); new Text(shell, SWT.NONE); display.addFilter(SWT.KeyDown, new Listener() { int i = 0; @Override public void handleEvent(Event arg0) { if (i &lt; 2) System.out.println("Press " + i); else { System.out.println("Press " + i); System.out.println("Remove"); if (!display.isDisposed()) display.removeFilter(SWT.KeyDown, this); } i++; } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { while (!display.readAndDispatch()) { display.sleep(); } } } It will remove the filter after the third key press event.
answers question: http://stackoverflow.com/q/23739246
score: 0
has comment: http://stackoverflow.com/comment/36494132
type: Answer
has comment: http://stackoverflow.com/comment/36494203

http://stackoverflow.com/a/23631331
answers question: http://stackoverflow.com/q/23631282
score: 0
type: AcceptedAnswer
has body: Add a null check inside your if condition. The condition is evaluated from left to right. If the left side of an and (&amp;&amp;) fails, the right side will not be executed. so you will not run into a NullPointerException if you order your checks right and do the != null checks in the first place. if(this.getAttribute() != null &amp;&amp; myobj.getAttribute() != null &amp;&amp; !this.getAttribute().compareTo(myobj.getAttribute())){ //changeLog to log the changes done from this object to myobj }
type: Answer
accepted answer of: http://stackoverflow.com/q/23631282

http://stackoverflow.com/q/23743949
type: Question
has answer: http://stackoverflow.com/a/23743969
linked to: http://stackoverflow.com/q/17889220
favorite count: 0
duplicate of: http://stackoverflow.com/q/17889220
tagged with: java-6
answer count: 1
accepted answer: http://stackoverflow.com/a/23743969
downvote count: 2
has body: The following program will print Hello world when compiled with JDK 1.6 or lower versions of JDK. public class A { static { System.out.println("Hello world"); System.exit(0); } } But JDK 1.7 or higher versions will generate a runtime error as follows when the above program is compiled. Error: Main method not found in class A, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application I would like to know if there is some way to compile and run a program without main() successfully in Java using JDK 1.7 or higher. Thanks in advance.
tagged with: java-8
has title: Is it possible to write a program in Java without main() using JDK 1.7 or higher?
type: AnsweredQuestion
score: 3
upvote count: 5
tagged with: java

http://stackoverflow.com/comment/36461721
score: 1
comment on: http://stackoverflow.com/q/23722456
type: QuestionComment
type: Comment
has text: (What Java *should* have done is not allow `==` between references, but require some other symbol (some languages use `===`) instead, so that using `==` would be a compile error. But that's water under the dam/over the bridge.)

http://stackoverflow.com/a/23731102
type: Answer
has body: If your posting the data to the server, then the json format will available in the body In order to read the body try to use getInputStream() in ServletRequest. After reading you can convert this InputStream to an object representation using GSON
answers question: http://stackoverflow.com/q/23730465
score: 0

http://stackoverflow.com/a/23747683
type: Answer
has body: resultPane is only defined in the scope of run(). If you want HandlerClass to have access to it you need to give it a definition.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23747620
downvote count: 0

http://stackoverflow.com/comment/36451078
comment on: http://stackoverflow.com/q/23717205
score: 3
has text: Ok, who wants to volunteer to ask for the logcat?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36286075
comment on: http://stackoverflow.com/a/23622045
type: Comment
has text: @Kon that is not an answer for this. it is only a suggestion
score: 0
type: AnswerComment

http://stackoverflow.com/q/23714217
tagged with: file
has comment: http://stackoverflow.com/comment/36446193
has comment: http://stackoverflow.com/comment/36446604
has answer: http://stackoverflow.com/a/23715134
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36445042
tagged with: directory
accepted answer: http://stackoverflow.com/a/23715134
has body: I would like to make a simple eclipse/java program which goes through a folder with many log files and renames each log file based on strings of text found inside the log file. The log files are all text files, but are named .log. Here is a screenshot of the folder containing the log files: Here is a screenshot of an individual log file. In this case, I would like this log file to be renamed "EFT Daily Activity Report," which shows up in each line. The problem is I don't know how to go through folders in eclipse/java to access each of the files. EDIT: Why doesn't this work? Am I missing something with the directory? Sorry, I'm new to local directories in java :)
tagged with: each
tagged with: logging
has title: Renaming Log Files Program [Beginner]
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36445320
score: 0
tagged with: java

http://stackoverflow.com/a/23619711
answers question: http://stackoverflow.com/q/23619474
type: AcceptedAnswer
downvote count: 0
has body: You need to create your own ClassLoader, give a look at How to use URLClassLoader to load a *.class file? Here is an example (from http://www.programcreek.com/java-api-examples/index.php?api=java.net.URLClassLoader, there is others with hosted urls): private void invokeClass(String path, String name, String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, MalformedURLException, InterruptedException, IllegalAccessException { File f = new File(path); URLClassLoader u = new URLClassLoader(new URL[]{f.toURI().toURL()}); Class c = u.loadClass(name); Method m = c.getMethod("main", new Class[]{args.getClass()}); m.setAccessible(true); int mods = m.getModifiers(); if (m.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) { throw new NoSuchMethodException("main"); } m.invoke(null, new Object[]{args}); m = null; System.gc(); // uh-oh }
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23619474

http://stackoverflow.com/q/23763272
has title: How to get Apache XML-RPC 3.1.3 compliance (ISO date format along with time zone) in Java 1.6
tagged with: xml-rpc
tagged with: eclipse
has body: We are using Apache XML-RPC 3.1.3 to communicate with Air billing solution. In documentation its mentioned that apache xml-rpc follow date format as java.util.Date '19980717T14:08:55' but our vendor implemented date as 'yyyyMMdd'T'HH:mm:ssZ' addition with time zone :( After reviewing documentation we come to know that, we need to develop custom data type to work with ISO different date format. http://ws.apache.org/xmlrpc/faq.html#nonstandard_date_format We tried to continue with provided example but end up with two errors 1 - pFormat variable not found in MyTypeFactory.java class 2 - no constructor found while pointing these changes in client class client.setTypeFactory(new MyTypeFactory()); Can someone please correct us if we are missing anything or share any other way to implement custom datatypes in Apache XML-RPC 3.1.3 Our client class code is XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://10.x.x.x:1234/Air")); config.setEnabledForExceptions(true); config.setBasicUserName("myUser"); config.setBasicPassword("myPassword"); config.setEncoding(XmlRpcClientConfigImpl.UTF8_ENCODING); config.setReplyTimeout(3 * 1000); config.setUserAgent("ITIVR/4.3/1.0"); //3.1 or 4.3 client.setConfig(config); XmlRpcClient client = new XmlRpcClient(); XmlRpcSunHttpTransport http = (XmlRpcSunHttpTransport) new XmlRpcSunHttpTransportFactory(client).getTransport(); Hashtable request = new Hashtable(); request.put("originNodeType", new String("IVR")); request.put("originHostName", new String("ITIVR")); request.put("originTransactionID", new String(new SimpleDateFormat("ddMMyyyyHHmmss").format(new Date()))); request.put("originTimeStamp", new Date()); request.put("subscriberNumber", "0111111111"); Vector v = new Vector(); v.add(request); HashMap o = (HashMap) http.sendRequest(new XmlRpcClientRequestImpl(config, "GetBalanceAndDate", v)); In this code we are getting error 'Data out of bounds' because we are not passing date in invalid format.
tagged with: java-6
score: 2
tagged with: apache
has answer: http://stackoverflow.com/a/23996098
downvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23996098
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/23636594
has answer: http://stackoverflow.com/a/23639049
tagged with: sql-server
type: Question
score: 1
favorite count: 0
tagged with: spring-jdbc
tagged with: multi-tenant
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36299445
has comment: http://stackoverflow.com/comment/36296647
tagged with: java
has title: multi-user jdbc connection pool ( Spring-jdbc )
has body: We are using MS SQL Server 2012 and having a multi-tenant DB architecture for our cloud based solution. Multi-tenancy is designed as below 1.We have created views over our DB tables and as new organization registers into our application. 2.We create a database user and grants access to that user on view. The problem here is, we are supposed to support 5000 organizations. Right now we have spring-jdbc and c3p0 connection pool. Each JVM creates organization-wise data sources, each data source pools minimum of 5 connections and maximum of 20 connections. Assuming we on-board all 5000 organizations, we might end-up short on connections or opening too many connections to the SQL server. One of possible solution is to pool connections not based on organization user. But c3p0 internally stores user based pools. I also looked at UserCredentialsDataSourceAdapter but this won't suffice my need. Please share your thoughts and solutions Thanks in advance!!
downvote count: 0
type: UnansweredQuestion

named-query
type: Tag
tags question: http://stackoverflow.com/q/23656332
tag name: named-query
tags question: http://stackoverflow.com/q/23633523
tags question: http://stackoverflow.com/q/23617271

http://stackoverflow.com/comment/36321012
score: 0
type: AnswerComment
has text: Ohh... that's disappointing. Now I either have to create a new class that deals with this or re-write all the affected views into sprocs. Neither is ideal, but I'm leaning towards the second solution. Cheers.
type: Comment
comment on: http://stackoverflow.com/a/23649258

http://stackoverflow.com/comment/36379848
type: AnswerComment
has text: Hi,Thank you so much.I have another doubt here.If the key value mathced in the index position of list then I have to get the the corresponding list for the key in Map Since Map contains key as indexposition and value is the List.Can you please guide me?
type: Comment
comment on: http://stackoverflow.com/a/23678788
score: 0

http://stackoverflow.com/q/23717410
answer count: 4
score: 2
upvote count: 2
has body: I have a subject code e.g: ABC123 that is a string I need to ensure that it is of length 6, the first 3 characters are letters and the last 3 are numbers. I would like to try and do it all in an if statement? I can work the length but cannot figure out the numeric and letter part of things. e.g: public void isValidCode(String subjectCode2){ str = subjectCode2; if (str.length() == 6 &amp;&amp; """"NEED TO TEST OTHERS HERE??""" ) { System.out.println("The code is valid"); } else { System.out.println("The code is not valid"); }
has answer: http://stackoverflow.com/a/23717438
has comment: http://stackoverflow.com/comment/36451494
has title: Java - validating a subject Code
has answer: http://stackoverflow.com/a/23717414
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23717438
tagged with: java
possible better answer: http://stackoverflow.com/a/23717428
has answer: http://stackoverflow.com/a/23717533
has answer: http://stackoverflow.com/a/23717428
type: Question
tagged with: validation
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23683281
has comment: http://stackoverflow.com/comment/74835745
has body: Is it possible to save a reference to an object in a bundle? Not the whole object, only the reference? For example, Bundle class has method to get an object but I can't find the put or set method. I need it because in an activity, I create an instance of my timer class, and then I start the timer: myTimer.start() If I have to restart the activity, I want to restore the timer to it's previous value.
possible better answer: http://stackoverflow.com/a/23683373
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/23683702
linked to: http://stackoverflow.com/q/8814551
accepted answer: http://stackoverflow.com/a/23683702
has answer: http://stackoverflow.com/a/23683373
tagged with: android
score: 6
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/48742597
downvote count: 2
has title: Save object reference to Bundle in Android
type: Question
has answer: http://stackoverflow.com/a/24335272

http://stackoverflow.com/comment/36364105
type: AnswerComment
score: 0
type: Comment
has text: After running Netbeans , Netbeans IDE process is taking 560MB space and CPU Usage is 100 % and PF Usage is 2.70GB. After killing Netbeans CPU Usage is in b/w 55-70 and PF Usage is 2.21GB.
comment on: http://stackoverflow.com/a/23670249

http://stackoverflow.com/q/23719558
has comment: http://stackoverflow.com/comment/36455864
has title: DateFormat and Base64
has comment: http://stackoverflow.com/comment/36456200
tagged with: java
has comment: http://stackoverflow.com/comment/36455998
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1
has body: I trying to encode the date using following code. String[] anArray = {"Value1","Value2" DateFormat.getDateTimeInstance.format(new Date())}; StringBuilder strBulder = new StringBuilder("tracker="); strBuilder.append(new String(Base64.encode(anArray[0].getBytes()))) .append("&amp;param1=") .append(new String(Base64.encode(anArray[1].getBytes()))) .append("&amp;timestamp=") .append(new String(Base64.encode(anArray[2].getBytes()))).toString(); The problem I am facing that encoded timestamp always remains same.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36455743
has answer: http://stackoverflow.com/a/23720064

parent-child
tags question: http://stackoverflow.com/q/23735217
type: Tag
tag name: parent-child
tags question: http://stackoverflow.com/q/23658623

http://stackoverflow.com/q/23679007
type: Question
has title: Lists - RemoveFirst gets NullPointerException
tagged with: java
answer count: 3
upvote count: 1
has body: I'm trying to do a removeFirst() using lists that removes the first node of the list and returns the value removed. Here's what I've got: public E removeFirst() { E value=first.val; first=first.next; size--; return value; } public void addLast(E v) { last = new Node(v,last); size++; } Other classes: class Cliente { String nome; int tchegada; int np; Cliente(String n, int tc, int p) { nome = n; tchegada = tc; np = p; } } The list: class List&lt;E&gt; { private int size; private Node first; private Node last; public boolean isEmpty() {return (size == 0);} public int size() {return size;} // construtor de lista vazia List() { size = 0; first = last = null; } // um no da lista private class Node { E val; Node next; Node(E v, Node n) { val = v; next = n; } } (...) Main: class Prob106_v0 { public static void main(String args[]) { Scanner in = new Scanner(System.in); // Read the flag int flag = in.nextInt(); // Read the boxes to an array int n = in.nextInt(); Caixa caixas[] = new Caixa[n]; for (int i=0; i&lt;n; i++) { int k = in.nextInt(); caixas[i] = new Caixa(k); } // Read the clients to a list of objects int c = in.nextInt(); List&lt;Cliente&gt; clientes= new List&lt;Cliente&gt;(); for (int i=0; i&lt;c; i++) { String nome = in.next(); int tempo_chegada = in.nextInt(); int num_produtos = in.nextInt(); clientes.addLast(new Cliente(nome, tempo_chegada, num_produtos)); } // Flag 0 - Remove each client and write the name of the one just removed if(flag == 0) { while(!clientes.isEmpty()) { Cliente cli = clientes.removeFirst(); System.out.println(cli.nome); } } else { // This doesn't matter, it's another part of the program I haven't finished. Subtarefas.resolve(flag, n, caixas, clientes); } } } Resuming, I am supposed to remove the first element of the list 'clientes' and return what I just removed, in this case the client name (cliente.nome), until there is nothing to remove (null). But I'm getting NullPointException Exception in thread "main" java.lang.NullPointerException …
has answer: http://stackoverflow.com/a/23679488
has answer: http://stackoverflow.com/a/23679095
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23679111
downvote count: 0
accepted answer: http://stackoverflow.com/a/23679095
score: 1
has answer: http://stackoverflow.com/a/23679111
favorite count: 0

http://stackoverflow.com/comment/36619688
score: 0
has text: @codermaster do you mean you now get the result you need?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23683475

http://stackoverflow.com/comment/36344080
has text: Thanks Eric.It worked could you point me to some tutorial where i can learn about these modules ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23660339
type: Comment

http://stackoverflow.com/comment/36372664
type: Comment
has text: I have now a brand new dll project in my solution and the code from above is working. This new dll is simple, no referenced assembly in it... I think that this is the root cause, I need to do something more for handling references...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23675398

http://stackoverflow.com/comment/36444444
type: AnswerComment
has text: @PML Oh, that's a possibility too? Didn't realize that... In that case, his/her answer is correct. You shouldn't need to substitute anything for that answer.
comment on: http://stackoverflow.com/a/23713822
type: Comment
score: 0

http://stackoverflow.com/comment/36309631
type: Comment
comment on: http://stackoverflow.com/q/23643243
score: 3
has text: `I want to parse Date from StringBuilder without conversion to String.` Why?
type: QuestionComment

http://stackoverflow.com/comment/36529418
type: Comment
has text: just found out SCAN command. Don't know whether Spring Data Redis supports it currently
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23738325

ubuntu
tags question: http://stackoverflow.com/q/23774811
tags question: http://stackoverflow.com/q/23767458
tags question: http://stackoverflow.com/q/23762999
tags question: http://stackoverflow.com/q/23716448
tags question: http://stackoverflow.com/q/23763070
tags question: http://stackoverflow.com/q/23767495
tag name: ubuntu
type: Tag
tags question: http://stackoverflow.com/q/23625352

http://stackoverflow.com/q/23760958
tagged with: numbers
has answer: http://stackoverflow.com/a/23761472
accepted answer: http://stackoverflow.com/a/23761472
score: -2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23763151
downvote count: 2
possible better answer: http://stackoverflow.com/a/23761561
favorite count: 0
answer count: 3
tagged with: regex
has answer: http://stackoverflow.com/a/23761561
has comment: http://stackoverflow.com/comment/36534523
has body: I have a string with values of [7^^http://www.w3.org/2001/XMLSchema#integer,...] which are derriving from a sparql query. I need a regex to extract only the first numbers next to ^^ everytime for the pattern-matcher. Can anyone help? Thank you in advance
has title: Regex to extract a number inside a node format
upvote count: 0
has comment: http://stackoverflow.com/comment/36534959
type: AnsweredQuestion

http://stackoverflow.com/comment/88189195
type: AnswerComment
score: 0
has text: @MikeRylander For sequential, you can check https://github.com/camiloribeiro/cucumber-gradle-parallel/blob/master/build.gradle#L80
type: Comment
comment on: http://stackoverflow.com/a/44666698

http://stackoverflow.com/comment/36413974
type: AnswerComment
has text: Thanks for the response, but what is Incoming(), it's on line 111 and gives me an error ? The program does not seem to work without it. It looks like this: frame.add(new Incoming());
score: 0
comment on: http://stackoverflow.com/a/23691552
type: Comment

http://stackoverflow.com/a/23756895
has body: Is this what you want? (note that, even though I have put DOT as decimal separator, in the output, you will get COMMA as decimal deparator, because Java decides at runtime based on the locale.) static String doubleToPrice(double dbl,char currency) { Locale locale =null; if(currency=='€') { locale = new Locale("fr", "FR"); }else { locale = new Locale("en", "EN"); }//Add locales as per need. DecimalFormatSymbols sym = new DecimalFormatSymbols(locale); sym.setGroupingSeparator('.'); DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale); decimalFormat.applyPattern(currency+"##,###.00"); decimalFormat.setDecimalFormatSymbols(sym); return decimalFormat.format(dbl); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23756488
accepted answer of: http://stackoverflow.com/q/23756488
has comment: http://stackoverflow.com/comment/36530665
type: Answer
has comment: http://stackoverflow.com/comment/36530217
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36533201

http://stackoverflow.com/comment/36366864
comment on: http://stackoverflow.com/q/23672876
score: 0
type: Comment
has text: What class has a list of `FilterParams` and a numeric value called `limit`? That's the class you need to be deserializing to in the `mapper.readValue(json, ?.class);` The only part of your json that maps to a FilterParams class is `{"type":"string","value":"sdadsadsa","field":"groupName"}`
type: QuestionComment

http://stackoverflow.com/comment/93602121
type: Comment
comment on: http://stackoverflow.com/a/47454813
has text: I want to ask a question about the answer. I use the solution in the answer. What I want to ask; How do I apply the Enum type in the hierarchy. For example, ROLE_ADMIN> ROLE_USER
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36489360
type: Comment
type: QuestionComment
has text: This does not appear to be a question.
score: 1
comment on: http://stackoverflow.com/q/23736772

http://stackoverflow.com/comment/36473534
has text: @user3580294 I think already did a catch for that at the bottom of my code, scroll down. I don't know why its freaking out over that.
comment on: http://stackoverflow.com/q/23728493
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23622703
has comment: http://stackoverflow.com/comment/36301429
upvote count: 7
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36314464
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/36271036
has comment: http://stackoverflow.com/comment/36328030
type: Question
has answer: http://stackoverflow.com/a/23644379
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/27576575
has body: I'm using a ListView control in a JavaFX application. It is set for MULTIPLE selection mode. I know as a user, I can Ctrl-Click an item to deselect it, but this is not intuitive enough for my users. I want a way to click a second time to deselect it. In other words click once - select; click selected item and it becomes unselected. I've tried using both a ChangeListener and an onMouseClicked event. Neither works very well. Below are code snippets of each. ChangeListener: effect - first item in the list is NEVER selected. I click on it and it stays unclicked. No effect on items 2..n listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener&lt;SpecificAlgorithmData&gt;() { @Override public void changed(final ObservableValue observableValue, final SpecificAlgorithmData oldData, final SpecificAlgorithmData newData) { //if already selected then deselect it int selectedIndex = listView.getSelectionModel().getSelectedIndex(); System.out.println("selected " + selectedIndex); System.out.println("all selected" + listView.getSelectionModel().getSelectedIndices()); if (!selecting &amp;&amp; !listView.getSelectionModel().getSelectedIndices().contains(selectedIndex)){ Iterator &lt;Integer&gt; iterator = listView.getSelectionModel().getSelectedIndices().iterator(); selecting = true; listView.getSelectionModel().select(-1);//deselect all while (iterator.hasNext()){ int index = iterator.next(); if (index!= selectedIndex){ listView.getSelectionModel().select(index); } } selecting = false; } } } onClick: No effect, since I'm not sure how to get the index of the one I just clicked. Being hard coded, this simply disallows of ever selecting item 2. listView.setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(final MouseEvent mouseEvent) { int selectedItem = 2; //FIXME: How to I get the index of clicked item? if (listView.getSelectionModel().isSelected(selectedItem)){ listView.getSelectionModel().clearSelection(selectedItem); } } …
has title: Deselect an item on an javafx ListView on click
accepted answer: http://stackoverflow.com/a/23644379
tagged with: javafx-2
tagged with: javafx

http://stackoverflow.com/comment/36436756
has text: [elasticsearch-head](https://github.com/mobz/elasticsearch-head) is a web front end for an Elasticseach cluster. It shows cluster health and allocated shards, etc
comment on: http://stackoverflow.com/q/23700676
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36288154
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23632587
has text: It shows the insights of your android device like what are the threads running, your app's heap size and yes the logcat and a lot of other things that I don't know.

http://stackoverflow.com/a/23680623
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23680536
downvote count: 0
answers question: http://stackoverflow.com/q/23680536
has body: It should be src/test/resources Not src/test/resource
upvote count: 2

http://stackoverflow.com/comment/36444382
type: Comment
comment on: http://stackoverflow.com/a/23713451
has text: @EwenW. updated awnser. I looked into doing something similar with Processing but couldnt find anything. Let me know if that helps, I have never used Processing so i'm just shooting in the dark if this works.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23621929
upvote count: 2
has body: "I want to pass the graphics component to a panel to be displayed." No, you don't. You need to see how to Perform Custom Painting. You're going to need a paintComponent method in your panel @Override protected void paintComponent(Graphic s) { super.paintComponent(g); // draw here } You don't explicitly call paint like you are doing here die1P.paint(drawDie.dieSwitch If you want to be able to set what is being painted, you can have a Die object that you use to draw. Something like class Die { public void draw(Graphics g) { // draw die here } } Then in your panel class have a setter for the Die object, that will repaint the new Die. You will probably want to have a way to differentiate each die. Pass some arguments to a constructor to do that. Then paint the one die. public class DiePanel extends JPanel { private Die die; public void setDie(Die die) { this.die = die; repaint(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (die != null) { die.draw(g); } } } You may also, instead, want to make Die an interface, so you can implement difference Die objects, like DieOne, DieTwo, etc. Something like public interface Die { void Draw(Grapchis g); } public class DieOne { @Override public void draw(Graphics g) { // draw die one } } When you call setDie(), you can pass a specific Die, like DieOne dieOne = new DieOne(); ... diePanel.setDie(dieOne);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23620472
accepted answer of: http://stackoverflow.com/q/23620472
type: Answer
score: 2

http://stackoverflow.com/comment/36489082
type: QuestionComment
comment on: http://stackoverflow.com/q/23736986
has text: It doesn't help you when you don't share what you have tried that 'did not work'. I can't believe that you try different resources and they ALL provide wrong information, there is something that you are missing yourself here. Are you even sure that your remote server allows connections to be made on the port you are setting up?
score: 0
type: Comment

http://stackoverflow.com/a/23629374
type: Answer
answers question: http://stackoverflow.com/q/23628687
has body: What you want to be doing is to pause the task when the Activity is in the background. The code below adds the pause functionality to the AsyncTask. class AsyncImageDecoder extends AsyncTask&lt;String, Void, Bitmap&gt; { private String END = "End-Of-File"; private final WeakReference&lt;ImageView&gt; imageViewReference; float rotation = 0; boolean resume = true; boolean pause = false; private String WATCH_DOG = "griffin"; public AsyncImageDecoder(ImageView frame) { imageViewReference = new WeakReference&lt;ImageView&gt;(frame); } @Override protected Bitmap doInBackground(String... imageName) { Log.i(TAG, "AsyncImageDecoder::doInBackground() image -&gt; " + imageName[0]); Bitmap bitmap; while(resume){ try { bitmap = downloadImage(imageName[0]); mCache.put(String.valueOf(imageName[0]), bitmap); // rotation = getCameraPhotoOrientation(imagePath); return bitmap; } catch (IOException e) { e.printStackTrace(); } if(pause){ //This checks if the task has been paused and sleeps it till it has been notified to wake up syncronized(WATCH_DOG){ try{ WATCH_DOG.wait(); } catch (InterruptedException e){e.printStackTrace();} pause = false; } } } return null; } public void pauseTask(){ pause = true; } public void wakeUp(){ synchronized(WATCH_DOG){ WATCH_DOG.notify(); } } @Override protected void onPostExecute(Bitmap image) { if (imageViewReference != null &amp;&amp; image != null) { final ImageView imageView = (ImageView) imageViewReference .get(); if (imageView != null) { /* * if(image.getHeight() &lt; image.getWidth()) * imageView.setRotation(90); */ imageView.setImageBitmap(image); } } } private Bitmap downloadImage(String path) throws IOException { Bitmap thumb = null; Socket socket = new Socket(); socket.connect(server.getServerAddress()); DataOutputStream out = new DataOutputStream( socket.getOutputStream()); DataInputStream input = new DataInputStream(socket.getInputStream()); JSONObject header = new JSONObject(); JSONObject inner = new JSONObject(); try { inner.put("command",…
score: 0

http://stackoverflow.com/q/23651376
type: Question
has comment: http://stackoverflow.com/comment/36325741
answer count: 1
has comment: http://stackoverflow.com/comment/36325111
has body: How can I use regex for finding a format? I can find a specific word but I want to search for something like this: a?t*(this should be a match to art, attetion - ? means one letter and * n letters but can only be placed at the ending of the word). So how should I do this? I don't know how to put this for you to understand. I want to search for a word using a format like w?rd(this suppose to match word, or ward). What I was looking for was something like this: public boolean regexChecker(String theRegex, String str2Check){ // You define your regular expression (REGEX) using Pattern Pattern checkRegex = Pattern.compile(theRegex); // Creates a Matcher object that searches the String for // anything that matches the REGEX Matcher regexMatcher = checkRegex.matcher( str2Check ); // Cycle through the positive matches and print them to screen // Make sure string isn't empty and trim off any whitespace while ( regexMatcher.find() ){ if (regexMatcher.group().length() == str2Check.length()){ System.out.println( regexMatcher.group().trim() ); // You can get the starting and ending indexs System.out.println( "Start Index: " + regexMatcher.start()); System.out.println( "Start Index: " + regexMatcher.end()); return true; } } System.out.println(); return false; } public String regexReplace(String str2Replace){ Pattern replace = Pattern.compile("\\?"); Matcher regexMatcher = replace.matcher(str2Replace.trim()); return regexMatcher.replaceAll("[A-Za-z]"); } public String regexReplace2(String str2Replace){ Pattern replace = Pattern.compile("\\*"); Matcher regexMatcher = replace.matcher(str2Replace.trim()); return regexMatcher.replaceAll("[A-Za-z]+");}
has comment: http://stackoverflow.com/comment/36324898
tagged with: regex
downvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/36324848
upvote count: 0
has comment: http://stackoverflow.com/comment/36325614
has title: Searching in a dictionary. Using Regex
has comment: http://stackoverflow.com/comment/36325469
score: -4
has answer: http://stackoverflow.com/a/23654085
accepted answer: http://stackoverflow.com/a/23654085
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36327340
tagged with: java

http://stackoverflow.com/a/23781289
has body: As per the valuable comment of Gagravarr, I have changed the code: Row rowhead= sheet.createRow((short)0); Font f = wb.createFont(); f.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cs = wb.createCellStyle(); cs.setFont(f); Cell cell; cell = rowhead.createCell((short) 0); cell.setCellValue("SRNum"); cell.setCellStyle(cs); cell = rowhead.createCell((short) 1); cell.setCellValue("Name"); cell.setCellStyle(cs);
score: 8
has comment: http://stackoverflow.com/comment/106409779
type: Answer
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/23778189
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23778189

http://stackoverflow.com/q/23630951
type: UnansweredQuestion
tagged with: php
has answer: http://stackoverflow.com/a/23631023
linked to: http://stackoverflow.com/q/109383
has body: I have a PHP code: $array['cows'] = 4; $array['horses'] = 7; $array['cats'] = 9; $array['dogs'] = 2; arsort($array); How to do it in Java? Sorted (from max) output of 'print_r($array);' is: Array ( [cats] =&gt; 9 [horses] =&gt; 7 [cows] =&gt; 4 [dogs] =&gt; 2 )
score: 0
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/36285940
has title: How to imitate PHP's sorting of associative array in Java?
answer count: 1

http://stackoverflow.com/q/23623187
tagged with: bind-variables
tagged with: plsql
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
linked to: http://stackoverflow.com/q/4724957
has body: In my java code I have a Prepared statement ps_temp. PreparedStatement ps_temp; // loop ps_temp.setString(1,'abc'); .... .... ps_temp.addBatch(); // end loop ps_temp.executeBatch(); Now one of the records in the batch created a Unique Index constraint, which eventually lead to the whole ps_temp.executeBatch() to fail. Not even the good records in the batch are inserted into the table. So, is it possible that if my Batch has some good and some bad records(which can cause integrity constraint), THEN AT LEAST THE GOOD RECORDS GETS INSERTED INTO THE TABLE ? Thanks in advance !! Noman
score: 1
has title: How to get Preparedstatement.executeBatch() to work for the good records if one record fails to insert
tagged with: java
has answer: http://stackoverflow.com/a/23623342
upvote count: 1
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/36270476
type: Question

http://stackoverflow.com/q/23643600
type: Question
has comment: http://stackoverflow.com/comment/36310629
score: -2
has comment: http://stackoverflow.com/comment/36310400
has comment: http://stackoverflow.com/comment/36310784
has comment: http://stackoverflow.com/comment/36310345
has comment: http://stackoverflow.com/comment/36310279
has comment: http://stackoverflow.com/comment/36310378
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23643906
has title: Java - Online game, should the game happen in the server or the client?
favorite count: 0
has body: I'm implementing a multiplayer option for a chess game I made, but I'm starting from zero to do both client and server. A friend said to me to make the game happen in the server, and the client only gets the data and shows in the GUI. Does this means that I have to implement the game in the server (without GUI); and in the client project, just the GUI, actionListeners and stuff, so that, for example, when I click on a piece and then click where I want it to go, the server will "make" the move (set new position etc) and then send this information back to the client so that it can print? Is this the best approach? By the way, my server can (will) host several games (each time 2 sockets connect it creates a game thread). Oh and also, after finishing the game, I want to implement a little chat in-game. Don't know if this information changes something...
accepted answer: http://stackoverflow.com/a/23643906
downvote count: 2
tagged with: sockets
tagged with: swing
has comment: http://stackoverflow.com/comment/36310628
has comment: http://stackoverflow.com/comment/36310362
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36310833

http://stackoverflow.com/a/23727672
downvote count: 1
has comment: http://stackoverflow.com/comment/36471702
type: Answer
has comment: http://stackoverflow.com/comment/36471677
has body: Perhaps this could be useful for you // File (or directory) with old name File file = new File("oldname"); // File (or directory) with new name File file2 = new File("newname"); if(file2.exists()) throw new java.io.IOException("file exists"); // Rename file (or directory) boolean success = file.renameTo(file2); if (!success) { // File was not successfully renamed } This is extracted from a similar question Rename a file using Java
score: 1
answers question: http://stackoverflow.com/q/23727648
upvote count: 2

http://stackoverflow.com/comment/36429002
comment on: http://stackoverflow.com/a/23698281
type: Comment
has text: I would like to see the fully qualified class name. Just change the log output pattern. For example with log4j : `log4j.appender.stdout.layout.ConversionPattern` and add %c:%L
score: 0
type: AnswerComment

http://stackoverflow.com/q/23704436
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36445643
type: Question
tagged with: java
has title: Control is stuck with first instance of threads
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23714557
tagged with: processbuilder
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36427132
has body: I'm starting this thread which basically executes a system call using ProcessBuilder. Runnable threadJob = new MyRunnable(); new Thread(threadJob).start(); This thread executes following Process Builder using its run() method: ProcessBuilder pb = new ProcessBuilder(commands); pb.redirectErrorStream(true); Process process = pb.start(); // Read output StringBuilder out = new StringBuilder(); BufferedReader brin = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null, previous = null; while ((line = brin.readLine()) != null) { if (!line.equals(previous)) { previous = line; out.append(line).append('\n'); } } When this thread is successfully executed, I start a different thread inside it to launch xterm using ProcessBuilder: if (process.waitFor() == 0) { Runnable threadJob2 = new XRunnable(); new Thread(threadJob2).start(); } Xterm is started successfully using following code in run() method of XRunnable(): ProcessBuilder pb = new ProcessBuilder(commands); pb.redirectErrorStream(true); Process process = pb.start(); // Read output StringBuilder out = new StringBuilder(); BufferedReader brin = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null, previous = null; while ((line = brin.readLine()) != null) { if (!line.equals(previous)) { previous = line; out.append(line).append('\n'); } } if (process.waitFor() == 0) { System.out.println("Xterm killed") } Issue I'm facing is that control is always stuck at this Xterm. If I launch another Xterm using same thread then it won't get control and I can't type anything in new Xterm window until previous one is killed. I think issue is that it is stuck at reading input stream of first Xterm and doesn't create a new input stream to read second Xterm. That's why I can type something once first Xterm is killed. Can anybody suggest ideas to resolve this issue ? I want to type something in each Xterm window I open using same thread code many times.

http://stackoverflow.com/a/23642730
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23642607
has comment: http://stackoverflow.com/comment/36309240
score: 2
has comment: http://stackoverflow.com/comment/36308860
has body: If you're getting NotBoundException with this code, you're looking up the wrong host. If the server is running on another host, you need to use that hostname in the lookup URL. But not in the bind URL. That is always 'localhost'. If you're getting another exception, you could always consider telling us what it is. EDIT If you're getting ClassNotFoundException, there are three cases. You got it when exporting your remote object. Generate the stub, or call super(0) instead of super() in your remote object constructor so you don't need one. If your remote object doesn't extend UnicastRemoteObject, use UnicastRemoteObject.exportObject() with a port number, even zero, for the same reason. You got it when binding. The Registry doesn't have the class named on its CLASSPATH. Either fix that or start the Registry from inside your server JVM, with LocateRegistry.createRegistry(), taking care to store the result in a static variable. You got it when looking up. The client doesn't have the class named on its CLASSPATH. You forgot to include it in the client JAR file, or you did something invalid like duplicating it into a different package for the client part of the project: it has to be the same class, same package, and preferably the same object code.
has comment: http://stackoverflow.com/comment/36309272
has comment: http://stackoverflow.com/comment/36308888
has comment: http://stackoverflow.com/comment/36309480

http://stackoverflow.com/comment/36519951
has text: Can you please quote few lines of implementation. i am coding in Java but unable to find any code snippet.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23744623
type: Comment

http://stackoverflow.com/q/23720976
has answer: http://stackoverflow.com/a/23721099
has body: I am writing a parser for expressions, which include tokens ),(,|,*,+,-,/, variables and constants. So far my code works with *,/,-,+,(,), but I do not know how to deal with absolute values. With parentheses, I start with ( and end with ), which is very simple, but how do I determine which "|" is an opening and which is a closing one? For parsing I use two stacks and the shunting yard algorithm (or at least the way I understood and wrote it).
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36459362
tagged with: expression
tagged with: java
accepted answer: http://stackoverflow.com/a/23721099
type: Question
tagged with: shunting-yard
answer count: 1
score: 0
has title: Understanding absolute values in expression parsing to binary tree?
has comment: http://stackoverflow.com/comment/36458313
tagged with: parsing
has comment: http://stackoverflow.com/comment/36458603

http://stackoverflow.com/comment/36544328
comment on: http://stackoverflow.com/q/23765921
score: 0
has text: @KevinWorkman I'll try to delete the unnecessary things.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23727502
has comment: http://stackoverflow.com/comment/36471543
type: Answer
has body: Read inline comments for more info. while (file.hasNextLine()) { // Read line by line and make it lowercase String line = file.nextLine().toLowerCase(); // get all the character of the line for (char c : line.toCharArray()) { if (c &gt;= 'a' &amp;&amp; c &lt;= 'z'){ // check for character only inventory[c - 'a']++; // Increment the occurrence of the Character } } }
answers question: http://stackoverflow.com/q/23727346
has comment: http://stackoverflow.com/comment/36476837
score: 0

http://stackoverflow.com/q/23674157
type: UnansweredQuestion
upvote count: 2
tagged with: java
downvote count: 1
type: Question
has body: hi i am implementing program which fetch data from database in java with ajax. but unfortunately it is not retireving output here is my code. program is running succesfully but not able to display database data from it. index.jsp AJAX JsonArray Example AJAX Retrieve Data from Database in Servlet and JSP using JSONArray Code Name Continent Region Population Capital FetchData.jsp /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import Countries.Countries; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Properties; public class FetchData { private static Connection connection = null; public static Connection getConnection() { if (connection != null) return connection; else { try { Properties prop = new Properties(); InputStream inputStream = FetchData.class.getClassLoader().getResourceAsStream("/db.properties"); prop.load(inputStream); String driver = prop.getProperty("jdbc:mysql:"); String url = prop.getProperty("localhost:3306/country_db"); String user = prop.getProperty("root"); String password = prop.getProperty(""); Class.forName(driver); connection = DriverManager.getConnection("localhost:3306/country_db", "root", ""); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return connection; } } public static ArrayList<Countries> getAllCountries() { connection = FetchData.getConnection(); ArrayList<Countries> countryList = new ArrayList<Countries>(); try { Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("sele…
has title: Not able to fetch data from database by using ajax in java
tagged with: javascript
tagged with: servlets
answer count: 1
tagged with: jsp
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36378091
tagged with: ajax
has answer: http://stackoverflow.com/a/23994954

http://stackoverflow.com/a/23641391
has comment: http://stackoverflow.com/comment/36307600
has body: First find the tr, that has p tag with the appropriate text, and then go down to the desired input: //tr[.//p[contains(., "QA GM 05132014 1038 Item 1 Model Number")]]/td/input[@id="CountryAuthorizationYES0_0"] Just note that there are certainly multiple ways to write the xpath here. Hope this one works for you.
has comment: http://stackoverflow.com/comment/36307200
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23641263
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23641263

http://stackoverflow.com/a/23776874
type: Answer
has comment: http://stackoverflow.com/comment/36569638
answers question: http://stackoverflow.com/q/23776644
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/36565153
has body: It scans all jar files under lib directory and class files in classes directory of your web application deployment, gets classes using code like clazz = Class.forName(theClassName), then calls clazz.getDeclaredAnnotations() or clazz.getAnnotation(WebServlet.class). Than it reads the annotation's attribute to extract the servlet mapping. This way container finds all servlets, filters etc and their URL mappings. This is one of the reasons that when this annotation based API was introduced the application deployments takes more time. Obviously the code is not as simple as I explained. It for example loads classes in context of proprietary class loader of the web application. It also does not really call Class.forName() but rather loads the class as byte array and passes it to the classloader.
has comment: http://stackoverflow.com/comment/36565588
downvote count: 1
has comment: http://stackoverflow.com/comment/36565125

http://stackoverflow.com/q/23732721
score: 0
has answer: http://stackoverflow.com/a/23733380
accepted answer: http://stackoverflow.com/a/23733380
answer count: 1
tagged with: jsp
has body: I have a form which suppose to diplay errors in case of unsuccessful validation by Spring. I think I have ModelMap passed back to dslr view but for some reason no errors are being displayed. How to fix it? Controller: @RequestMapping(value = "/s", method = RequestMethod.POST) public String showHTMLResponsePOST(@Valid @ModelAttribute ("dslrForm") DSLR dslrForm, BindingResult result, ModelMap model){ if(!result.hasErrors()){ DSLRDAO planedao = new DSLRDAO(); planedao.update(dslrForm); return "redirect:s?id="+dslrForm.getDslrId(); } else { return "dslr"; } } View: <%@ page import="java.util.List" %> <%@ page pageEncoding="UTF-8" %> <%@page contentType="text/html;charset=UTF-8" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ page isELIgnored="false" %> DSLRs <!--[if lt IE 9]> <![endif]--> servlet | log.txt <form:form action="s?action=save" method="POST" comandName="dslr"> <form:errors path="*" cssClass="errorblock" element="div" /> <c:if test="${errors.size() > 0}"> Can't save, input contains errors! </c:if> id: ${dslrForm.dslrId} model: <form:errors path="model" cssClass="error" ></form:errors> price: <form:errors path="price" cssClass="error" ></form:errors> description: <form:errors path="description" cssClass="error" ></form:errors> </form:form>
has title: Cannot persist validation result to display in a view
tagged with: spring
has comment: http://stackoverflow.com/comment/36481116
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36481916
tagged with: java
linked to: http://stackoverflow.com/q/9896917
has comment: http://stackoverflow.com/comment/36482160
has comment: http://stackoverflow.com/comment/36481947
type: Question
has comment: http://stackoverflow.com/comment/36482011

http://stackoverflow.com/comment/36302020
type: Comment
comment on: http://stackoverflow.com/a/23639422
score: 0
type: AnswerComment
has text: Now tell me what you want. as per your code you are restricting the user interaction. If it's selected then you are problematically setting it back to false. Isn't it?

modal-dialog
tag name: modal-dialog
type: Tag
tags question: http://stackoverflow.com/q/23722858

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/23681308
tag name: android-cursoradapter

http://stackoverflow.com/a/33963796
has body: import org.skife.jdbi.v2.sqlobject.customizers.Define; import org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator; @UseStringTemplate3StatementLocator public interface CreateTableDAO { @SqlUpdate("create table if not exists (" + "startTime TimeStamp not null," + "stopTime TimeStamp not null," + "uuid varchar(255)" + ")") public void createTable(@Define("table") String table); } Don't forget to add the dependency for UseStringTemplate3StatementLocator annotation org.antlr stringtemplate 3.2
upvote count: 5
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23622183
type: Answer

http://stackoverflow.com/a/23725795
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36482311
has comment: http://stackoverflow.com/comment/36505053
answers question: http://stackoverflow.com/q/23676373
has comment: http://stackoverflow.com/comment/38426055
accepted answer of: http://stackoverflow.com/q/23676373
has comment: http://stackoverflow.com/comment/36508660
type: AcceptedAnswer
downvote count: 0
has body: @XmlRootElement public class Book { // TODO: getters/setters public String author; public String title; } Assuming you want to process data as strongly typed objects you can combine StAX and JAXB using utility types: class ContentFinder implements StreamFilter { private boolean capture = false; @Override public boolean accept(XMLStreamReader xml) { if (xml.isStartElement() &amp;&amp; "book".equals(xml.getLocalName())) { capture = true; } else if (xml.isEndElement() &amp;&amp; "book".equals(xml.getLocalName())) { capture = false; return true; } return capture; } } class Limiter extends StreamReaderDelegate { Limiter(XMLStreamReader xml) { super(xml); } @Override public boolean hasNext() throws XMLStreamException { return !(getParent().isEndElement() &amp;&amp; "book".equals(getParent().getLocalName())); } } Usage: XMLInputFactory inFactory = XMLInputFactory.newFactory(); XMLStreamReader reader = inFactory.createXMLStreamReader(inputStream); reader = inFactory.createFilteredReader(reader, new ContentFinder()); Unmarshaller unmar = JAXBContext.newInstance(Book.class) .createUnmarshaller(); Transformer tformer = TransformerFactory.newInstance().newTransformer(); while (reader.hasNext()) { XMLStreamReader limiter = new Limiter(reader); Source src = new StAXSource(limiter); DOMResult res = new DOMResult(); tformer.transform(src, res); Book book = (Book) unmar.unmarshal(res.getNode()); System.out.println(book.title); }
type: Answer

sublimetext2
tags question: http://stackoverflow.com/q/23772636
type: Tag
tag name: sublimetext2

http://stackoverflow.com/q/23710681
answer count: 1
has title: JavaFX Parameter passing
favorite count: 0
has comment: http://stackoverflow.com/comment/36440830
linked to: http://stackoverflow.com/q/14187963
tagged with: javafx-2
type: AnsweredQuestion
tagged with: fxml
upvote count: 0
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23712293
accepted answer: http://stackoverflow.com/a/23712293
tagged with: parameter-passing
downvote count: 1
type: Question
has body: I've been endlessly struggling with this code, I'm trying to send the values of 2 strings to another "window" to perform a function on them but I keep getting all sorts of errors. I've thoroughly read the Dependancy Injection thread and the main problem with it was with the (Pane) cast in the 10th line. Also, I've read this one as well and the answer and the code is just plain chaotic. What I am really trying to do is this: I have lets say Main document and I'm trying to send one of its values to its CHILD: My code is like this for the MAINcontroller: @FXML void initialize() throws MalformedURLException { parameterSender.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { Parent root; try { root = FXMLLoader.load(getClass().getClassLoader().getResource("filetree/childWindow.fxml"),resources); Stage stage = new Stage(); stage.setTitle("Child"); stage.setScene(new Scene(root, 500, 500)); FXMLLoader loader = FXMLLoader(getClass().getClassLoader().getResource("filetree/childWindow.fxml"), resources); //I fixed this, thank you very much, Uchiha Itachi childWindowController controller = loader.&lt;childWindowController&gt;getController(); controller.firstParameter = getFirstField(); //this is the getter of the firstTextAreaField controller.secondParameter = getSecondField();//this is the getter of the secondTextAreaField stage.show(); } catch (IOException e) { e.printStackTrace(); }//End of Catch }//End of Initialize And for the CHILDcontroller: @FXML void testAcquiredParametersFromParent(MouseEvent event) { System.out.println(firstParameter + " " + secondParameter); } When I run this code I get this exception on runtime: java.lang.ClassCastException: javafx.scene.layout.AnchorPane cannot be cast to javafx.fxml.FXMLLoader at filetree.FXMLDocumentController$5.handle(FXMLDocumentController.java:17) at filetree.FXMLDocumentController$5.handle(FXMLDocumentController.java:3) at com.sun.javafx.event.CompositeEventHandler.dispatc…
score: -1
duplicate of: http://stackoverflow.com/q/14187963

http://stackoverflow.com/comment/60334037
type: AnswerComment
has text: For me it's vice versa: - Given a OpenSSL CaCert With Subject (CN=..., O=..., OU=..., DC=..., DC=..., DC=...). (1) cacert.getSubjectX500Principal().getEncoded(); reverses the order and (2) cacert.getSubjectX500Principal().getName(); reflects the correct order. But (2) both have the problem, that spaces before the key are stripped of, so that the string comparison in some validators fails again for issuer-dn and cacert subject-dn
comment on: http://stackoverflow.com/a/23746169
type: Comment
score: 1

http://stackoverflow.com/comment/36557604
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23730207
has text: I already tried putting the queue in a wrapper class; any object that contains an ArrayBlockingQueue will run into the same issue when it's persisted. Having a wrapper just means the exception gets thrown for the wrapper class instead of the main class.
score: 0

http://stackoverflow.com/comment/36531710
type: QuestionComment
score: 0
has text: I think you meant this: http://jd.bukkit.org/rb/apidocs/org/bukkit/entity/Damageable.html#getHealth() http://jd.bukkit.org/rb/apidocs/org/bukkit/entity/Player.html (The second one is the doc of Player, but the two methods are just listed in Damageable (first link)) But I think these can't help you with the problem.
comment on: http://stackoverflow.com/q/23758710
type: Comment

http://stackoverflow.com/q/23712510
has title: Using only one servlet
tagged with: servlets
type: Question
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/36441931
has comment: http://stackoverflow.com/comment/36441833
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23712552
has body: I'am making a web page with a login system and backoffice page. The problem is, both use the method "doPost" (the login use to autenticate and the backoffice use to insert data in db). How can I use only one servlet for both? I'am asking this because both use doPost, so I made two servlet's.
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23716153
has answer: http://stackoverflow.com/a/23712578
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/a/23757650
score: 0
type: Answer
has body: Given that you guys need to implement version control, one important aspect of co-operating together is to keep your codebase IDE-agnostic. Thankfully, with java and maven there is an easy way to do this. Firstly, commit to building your project with a build tool such as maven. Therefore, using this example, the pom.xml is the master configuration file for your project. In contrast, your "project" files (either your .idea folder for intellij or your .project, .classpath and related files for eclipse) should not be checked into version control at all. You can then add "ignores" to your VCS so that IDE-specific configuration files are not checked in - this way you won't interfere with each other with IDE-specific things. Then, it is relatively easy for both of you to share a maven (pom.xml) based project with each other, and to configure your IDE independently from each other (i.e.: locally).
answers question: http://stackoverflow.com/q/23739029

http://stackoverflow.com/q/23661963
has comment: http://stackoverflow.com/comment/36346320
has answer: http://stackoverflow.com/a/23662112
has comment: http://stackoverflow.com/comment/36346146
score: -2
has comment: http://stackoverflow.com/comment/36347217
tagged with: java
has answer: http://stackoverflow.com/a/23662371
has comment: http://stackoverflow.com/comment/36346102
downvote count: 4
has title: Making a variable out of a interface (good or bad)?
has comment: http://stackoverflow.com/comment/36349144
has comment: http://stackoverflow.com/comment/36346098
type: Question
has comment: http://stackoverflow.com/comment/36347847
type: AnsweredQuestion
has body: I was reading in a book a while back that it is better to create your variables in your class by making them a type of the interface that your class extends. I am finding out that you can do this but if I try and call a method from the interface variable I receive and error that is listed below. Why do the method names show up in the smart window but then I cannot use them to call the method that I have defined? Why is the benefit of creating a interface variable? Does it save time later if you have to add in more methods. If you add them to the interface to the class then you would just have to call them from the variable. Code: package testpak; import java.io.Serializable; public class TestInterfaces implements iMyTest, iMyOwn { private static final long serialVersionUID = 1L; @Override public void run() { } @Override public void myMethod() { } @Override public void meth1() { System.out.println("method 1"); } @Override public void meth2() { } @Override public void meth3() { } public static void main(String[] p) { iMyOwn temp = null; temp.meth1(); } } interface iMyTest extends Serializable, Runnable { public void myMethod(); } interface iMyOwn { public void meth1(); public void meth2(); public void meth3(); } Error: Exception in thread "main" java.lang.NullPointerException at testpak.TestInterfaces.main(TestInterfaces.java:31) New Code: package testpak; import java.io.Serializable; public class TestInterfaces implements iMyTest, iMyOwn { private static final long serialVersionUID = 1L; @Override public void run() { } @Override public void myMethod() { } @Override public void meth1() { System.out.println("method 1"); } @Override public void meth2() { } @Override public void meth3() { } public static void main(String[] p) { iMyOwn temp = new TestInterfaces(); temp.meth1(); } } interface iMyTest extends Serializable, Runnable { public void myMethod(); } interface iMyOwn { public void meth1(); public void meth2(); public void meth3(); } I see what your saying now. But …
accepted answer: http://stackoverflow.com/a/23662371
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/23662112
answer count: 2

http://stackoverflow.com/a/23751080
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23750565
has body: You already have "bonded" a byte[] buffer to an input stream with this line: DataInputStream dis = new DataInputStream(new ByteArrayInputStream(readBuf)); That should work with dis.readInt(); just fine. Loop over it for as many int's as you expect to be in the buffer. I can't tell you what's going to happen with readBytes() and writeBytes() since you haven't defined them. The name i_ReadLength seems to mean something completely different than what I'd expect a method named readBytes() to return. Your compiler won't care but us humans do. If you're hoping to be able to look inside readBuf and tell how many int's have been added to it you're likely going to be disappointed. A byte array of int's is not going to be null terminated like a string would be. You MUST keep track of how much of the readBuf has been initialized with integers somewhere or you will end up reading garbage (data that was never written and could have any value). What you could do is make the first int in the byte array the count of all the other int's in the array. Once you read that you know how many times to loop. Make sure to set it to the correct value when you write it. Also don't write in to many int's and overflow the byte array. Remember byte's and int's are different sizes. If that's what you've done don't reinvent the wheel. Do it like this: byte[] readBuf = getSizePrefixedByteArrayOfInts(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(readBuf)); //writeBytes( UartCmd[1] ); //Seriously, I've no idea what this does int i_ReadLength = dis.readInt(); int[] readInts = new int[i_ReadLength]; for(int i = 0; i &lt; i_ReadLength; i++) { readInts[i] = dis.readInt(); } Critical to understand here is that this code expects the length counter itself to NOT be counted. If the counter is the only int initialized in the buffer then it's value should be zero. So here's test some code that does that: private byte[] getSizePrefixedByteArrayOfInts() { ByteArrayOutputStream baos = null…

http://stackoverflow.com/a/23757812
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/36528686
type: Answer
upvote count: 0
has body: for(int column = 1; column &lt;= 9; column++) { for(int row = 1; row &lt;= 9; row++) { if(column &lt;= row) { System.out.print(row); } else { System.out.print(" "); } } System.out.println(); // println will create a newline }
answers question: http://stackoverflow.com/q/23757707

http://stackoverflow.com/a/23753080
score: 0
answers question: http://stackoverflow.com/q/23752943
has body: Generics are meant to improve re-utilization of your classes and/or methods when the object class being specified in the "template" has nothing or little to do with the functionality that the class class or the method itself provides. The best example of this are data structures where your generic types are black boxes. You don't care about them, just aggregate them in some way and what is important is how you index,sort,find,traverse,... this objects. The case you're proposing (return (E) "test";) is against that principle because you are building one of these objects and for that you need to know its class details. Imagine you want to provide a class to represent pairs of objects. You don't care at all about the nature of these objects, you just want to provide a way of grouping to objects references. This is a typical case of use of generic types: public class Pair&lt;T,S&gt; { public T getFirst() { return first; } public void setFirst(T first) { this.first = first; } public S getSecond() { return second; } public void setSecond(S second) { this.second = second; } private T first; private S second; } Pair has nothing to do with first or second beyond aggregating them.
type: Answer

http://stackoverflow.com/comment/36289712
comment on: http://stackoverflow.com/a/23632983
type: Comment
has text: Did a small change in the code that you have provided me `newPanel.add(image);` to `newPanel.add(imgLabel);` because there is no method to add buffered image to a panel and even then I did not work
score: 0
type: AnswerComment

http://stackoverflow.com/a/23713453
has comment: http://stackoverflow.com/comment/36444145
upvote count: 1
has comment: http://stackoverflow.com/comment/36446911
has comment: http://stackoverflow.com/comment/36444309
has comment: http://stackoverflow.com/comment/36444272
has comment: http://stackoverflow.com/comment/36444505
has comment: http://stackoverflow.com/comment/36443679
has comment: http://stackoverflow.com/comment/36444336
has comment: http://stackoverflow.com/comment/36444363
answers question: http://stackoverflow.com/q/23713350
has comment: http://stackoverflow.com/comment/36444200
has comment: http://stackoverflow.com/comment/36446945
downvote count: 0
has comment: http://stackoverflow.com/comment/36444017
has comment: http://stackoverflow.com/comment/36444240
has comment: http://stackoverflow.com/comment/36444461
has body: E[] snapshot = list.toArray(); list.toArray() returns Object[] instead of E[]. So you need an explicit cast there. But the presence of the explicit (or dynamic) cast like that means that compiler could not guarantee the type-safety there. Instead your are telling the compiler that everything is fine and it will actually be an E[] at runtime. So, it gives you a warning about it saying - unchecked cast. Note, that if the compiler was able to guarantee the type-safety there, then it would be a static/checked cast (performed implicitly by the compiler itself) there, instead.
type: Answer
has comment: http://stackoverflow.com/comment/36444418
score: 1
has comment: http://stackoverflow.com/comment/36444295

http://stackoverflow.com/a/23722738
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36462020
type: Answer
answers question: http://stackoverflow.com/q/23722712
has comment: http://stackoverflow.com/comment/36462070
upvote count: 1
has body: the publicationYear has to be part of the key. to sort based on that.
score: 1
accepted answer of: http://stackoverflow.com/q/23722712

http://stackoverflow.com/comment/36441380
score: 0
type: AnswerComment
has text: Yes , after "where java" , result is C:\Windows\System32\java.exe
type: Comment
comment on: http://stackoverflow.com/a/23712261

tabs
type: Tag
tags question: http://stackoverflow.com/q/23648646
tags question: http://stackoverflow.com/q/23726389
tags question: http://stackoverflow.com/q/23642842
tag name: tabs

http://stackoverflow.com/q/23756343
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36527218
tagged with: mysql
has comment: http://stackoverflow.com/comment/36525883
type: Question
has body: java.sql.SQLException: Statement parameter 4 not set. insert upto 3rd parameter perfectly.. My Code: String values[]=request.getParameterValues("Values"); for(String category: values){ ps.setString(3, category); ps.execute(); }
has comment: http://stackoverflow.com/comment/36527155
has title: how to insert multiple checkbox values into a single column using java
tagged with: java
accepted answer: http://stackoverflow.com/a/23757764
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36527019
has answer: http://stackoverflow.com/a/23757764
has comment: http://stackoverflow.com/comment/36525864
has comment: http://stackoverflow.com/comment/36526544

http://stackoverflow.com/comment/90915377
comment on: http://stackoverflow.com/a/30617814
has text: Your solution works great ! I get the error message and I can modify it also, If possible can you please help me that how can I get the field because of which error has occurred ? I want to append the field name in the error message
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36339544
type: Comment
has text: This is the kind of the answer that I am looking for. Thanks for the second time Jonathan.
type: AnswerComment
comment on: http://stackoverflow.com/a/23658736
score: 0

http://stackoverflow.com/q/23733758
has title: Sorting by parent entity using Specifications
upvote count: 2
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/24748426
tagged with: sql
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I’m dealing with an issue which to my understanding looks unsupported on Spring Data JPA. I got a grid (using JqGrid plugin for jQuery) on the view which sends parameters to the server, they are parsed and then a dynamic query generated through Specifications is executed. The issue comes when I want to order a column which doesn’t belong to the root entity. Eg. Transaction, Card and Account are my entities and grid displays last4digits as a way for the user to identify the card. As you can imagine last4digits belongs to Card. I query transactions per account. Using specifications I can filter by that attribute, joining tables and so on but sorting fails as findAll() implementation assumes properties from Sort class belongs to the root entity. Code example: JQGridRule panFirst6DigitsRule = FilterUtils.findSearchOrFilterRule(settings, Card_.panFirst6Digits.getName()); JQGridRule panLast4DigitsRule = FilterUtils.findSearchOrFilterRule(settings, Card_.panLast4Digits.getName()); if(panFirst6DigitsRule != null) { filterPan1 = TransactionSpecs.withPanFirst6Digits(panFirst6DigitsRule.getData(), panFirst6DigitsRule.getOp(), gridGroupOp); } if(panLast4DigitsRule != null) { filterPan2 = TransactionSpecs.withPanLast4Digits(panLast4DigitsRule.getData(), panLast4DigitsRule.getOp(), gridGroupOp); } Specification&lt;Transaction&gt; joinSpec = TransactionSpecs.withAccountId(account.getAccountId()); Specification&lt;Transaction&gt; activeSpec = BaseSpecs.withEntityStatus(true); Page&lt;Transaction&gt; results = transactionRepository.findAll( Specifications.where(joinSpec).and(filterSpec).and(filterPan1).and(filterPan2).and(activeSpec), springPageable); springPageable variable contains a Sort for last4Digits column generated this way*: List&lt;Order&gt; sortOrders = new ArrayList&lt;Order&gt;(); Order sortOrder = new Order(Direction.ASC, "panLast4Digits"); sortOrders.add(sortOrder); sort = new Sort(sortOrders); *There are missing code parsing parameters and creating more Order objects…
linked to: http://stackoverflow.com/q/24649590
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa

http://stackoverflow.com/comment/36483400
comment on: http://stackoverflow.com/q/23733953
score: 0
type: Comment
type: QuestionComment
has text: @fxm-I added the class to the server of course.

http://stackoverflow.com/comment/36430195
has text: @KarimElSheikh, `Although I had to put the GUI code outside the run() body` - that is not correct. You still don't understand the problem. All updates to the GUI code MUST be done on the EDT. The long running task should NOT be on the EDT. Read the link I gave you.
type: Comment
comment on: http://stackoverflow.com/a/23703860
score: 0
type: AnswerComment

http://stackoverflow.com/q/23636963
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23637252
has answer: http://stackoverflow.com/a/23637017
type: UnansweredQuestion
has title: need a way to print a string in binary format?
has comment: http://stackoverflow.com/comment/36296724
tagged with: java
has body: I have a string. It contains some blank space. I don't know what's these blank space. They might be a space, or be a tab.. or sth else. So I just want to print a string in binary format. Also, how to use String.replace() to filter out some characters in binary format? Or I need to use some other kind of API to filter out the special characters in binary format. for example, how to filter out chr(10) in a string. ( chr(10) means a Chang Line) Just find out its reason: I use these line to print what's this whitespace: for (char ch : MyString.toCharArray()) { System.out.format("%H ", ch); } I got it's result. It's "3000". I checked UTF-8 table and found 3000 really looks a blank space. Then I just use this code to remove this blank space: MyString = MyString.replaceAll("\u3000", ""); Now everything become ok. Thanks a lot for everyone's help!!
type: Question

http://stackoverflow.com/q/23728778
score: -2
has answer: http://stackoverflow.com/a/23728787
answer count: 2
upvote count: 0
has title: Substring and white space
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36474394
type: UnansweredQuestion
downvote count: 2
has body: This is probably a simple question. I'm reading in from file a 1645 character string. Everything is broken up into specific sized substrings. So let's say I have an 18, 30, and 1 character substrings. They loop through that way till the end of the the string. Sometimes there isn't anything in that 1 character substring, which is fine because there won't always be. How do I skip the white space and continue on with the loop? Right now when my loops gets to the 1 character substring if there's white space there it errors out and says out of bounds. try{ //open input stream for reading the text file InputStream is = new FileInputStream("try34.txt"); //create new input stream reader InputStreamReader instrm = new InputStreamReader(is); // create object of bufferReader object BufferedReader br = new BufferedReader(instrm); //Read one line at a time while((strLine = br.readLine()) !=null) { System.out.println(strLine); //prints full string of what was read in parcelNumber = strLine.substring(0,14); //gets 15 character parcel number System.out.printf("parcel number %s\n",parcelNumber); //prints parcel number width = Integer.parseInt(strLine.substring(13,19)); //gets width from strLine string height = Integer.parseInt(strLine.substring(19,24)); //gets height from strLine string System.out.printf("width %05d\n", width); //prints width System.out.printf("height %05d\n", height); //prints height String getR; //variable to hold string to count how many rectangles there are getR = strLine.substring(24,1645); //starts at position 58 to find "R" for rectangle String strippedR = getR.replaceAll("\\s+", ""); //removes spaces in the getR string. If white space was left it would stop at non rectangle buildings System.out.println(strippedR); //this loop goes through only substring 24 to 1645 to look for "R" and counts how many there are for(char ch: getR.toCharArray()){ if(ch == 'R'){ count++; } } System.out.println(count); //prints how many R's were found String first; //1621 characte…
tagged with: java
has comment: http://stackoverflow.com/comment/36474249
type: Question
has answer: http://stackoverflow.com/a/23728810

http://stackoverflow.com/a/23720256
has comment: http://stackoverflow.com/comment/36458035
has body: Put sep=; at the first line of CSV file that will instruct the Excel to split the cell based on semicolon. Use ; as separator instead of \t for each value when writing into CSV file. Don't forget to enclose the value inside double quotes. Here is the sample code: sep=; "ReferenceId";"TYPE";"VALUE";"ENABLED" "1";"T1";"V1","true" "2";"T2";"V2","true" "3";"T3";"V3","false"
has comment: http://stackoverflow.com/comment/36457398
score: 0
has comment: http://stackoverflow.com/comment/36457456
type: Answer
answers question: http://stackoverflow.com/q/23720112
accepted answer of: http://stackoverflow.com/q/23720112
type: AcceptedAnswer

http://stackoverflow.com/comment/36552165
has text: Instead of assuming you know what the problem is, can you just **read the error message and look at the line** which triggered the error?
comment on: http://stackoverflow.com/q/23769486
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23759731
favorite count: 0
type: AnsweredQuestion
tagged with: opengl
tagged with: java
upvote count: 1
downvote count: 1
has body: I am using libGDX and have created my own Sprite-class and renderer (which uses libGDX's SpriteBatch under the hood). The renderer is quite "smart", it sorts the sprites by layer/shader/texture/blend, and the sprites can contain children. Now I am trying to add support for FrameBuffers and I have a little problem. I am trying to add multiple post-processing effects via shaders, to the "root" sprite in my game. render the root Sprite into an FBO, (the background and all the entities) render a "swirl"-effect to the same FBO render a bloom-effect to the same FBO render a horizontal blur to the same FBO render a vertical blur to the same FBO render the final result of the FBO into the screen via a Sprite This all is achieved quite simply, each effect has its own Sprite-object. They are layered via setLayer(int), and textures/FBOs/shaders are set via setTexture(Texture) / setTarget(Texture) / setShader(Shader). I attempted and want to use the SAME Texture as a result and a target. e.g.: Texture fbo = Video.newTarget(); ... bloom.setTexture(fbo); bloom.setTarget(fbo); blurH.setTexture(fbo); blurH.setTarget(fbo); .... If I use the same FBO in this way, I can see some strange artifacts in the final image that are hard to describe. I either get some strange lines somewhere in the texture, or simply some weird distortions. If I create a separate FBO for each effect, everything works just fine. e.g: Texture fbo1, fbo2, fbo3, fbo4; ... bloom.setTexture(fbo1); bloom.setTarget(fbo2); blurH.setTexture(fbo2); blurH.setTarget(fbo3); ... I'd really like to avoid this if possible, as it leads to messy code, and hurts performance. I am really not that well-versed in OpenGL/GLSL (I don't even quite understand the rendering pipeline... :), however, does anyone have any ideas what might cause these artifacts from my explanation? I also thought of having two FBOs and "ping-pong" between them, but for some reason all I see is black.. for now.. :) I'll have to experiment more with that.
type: Question
has answer: http://stackoverflow.com/a/23760239
has title: Using a single FrameBuffer for multiple Shader effects leads to artifacts
tagged with: libgdx
has comment: http://stackoverflow.com/comment/36546334
has answer: http://stackoverflow.com/a/23760247
has answer: http://stackoverflow.com/a/71527487
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23760247
accepted answer: http://stackoverflow.com/a/23760239

http://stackoverflow.com/comment/36560686
type: Comment
has text: Yeah, nothing is inverted, its just the inverse side of the mapping
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23773508

http://stackoverflow.com/comment/36450861
has text: @snukrabill My guess is that there would be extremely limited use in having integer arguments, as overflow would quickly become a problem, and doing checks to see whether promotion should occur could be more costly than just assuming the arguments are doubles. Even having `pow(double, int)` would defeat the purpose of overloading as you're still operating on a double. I'd imagine if the performance issues were that bad C++ would have overloaded their standard library, so I can't imagine them not overloading out of laziness or something.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23716987

http://stackoverflow.com/q/23657820
duplicate of: http://stackoverflow.com/q/2464222
has answer: http://stackoverflow.com/a/23657865
duplicate of: http://stackoverflow.com/q/9097338
has answer: http://stackoverflow.com/a/23657875
has title: Overriding a variable in Java?
score: 1
tagged with: java
type: Question
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/2464222
linked to: http://stackoverflow.com/q/9097338
has body: I have to implement class Vase which has different types of flowers. Every type of flower has specified weight. public class Vase { int weight=0; void Put (Flower a) { weight+=a.w; } void Remove (Flower a) { weight-=a.w; } int getTotalPrice() { return weight; } } public abstract class Flower { int w =10; } public class Rose extends Flower{ int w =3; } public class Tulip extends Flower{ int w =1; } I am obliged to use inheritance. Then when i do this: Vase vase1= new Vase(); Rose rose1=new Rose(); Rose rose2=new Rose(); Tulip tulip1=new Tulip(); firstv.Put(rose1); firstv.Put(rose2); firstv.Put(tulip1); System.out.println(vase1.getTotalPrice()); I get 30 not 7? How to change the code to make getTotalPrice count the weight of Rose not Flower?
has comment: http://stackoverflow.com/comment/36338002
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/36337656
type: UnansweredQuestion

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/23624330
tags question: http://stackoverflow.com/q/23733947
tag name: nosuchmethoderror

http://stackoverflow.com/comment/36462000
type: Comment
has text: @fge this is just experiment, so i can restrain the size. Do you have any better suggestion?
type: AnswerComment
comment on: http://stackoverflow.com/a/23721905
score: 0

http://stackoverflow.com/comment/41716689
comment on: http://stackoverflow.com/q/23757887
score: 0
type: QuestionComment
type: Comment
has text: can you show related code?

http://stackoverflow.com/q/23691925
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36404893
linked to: http://stackoverflow.com/q/21505858
has answer: http://stackoverflow.com/a/23691971
accepted answer: http://stackoverflow.com/a/23691971
has comment: http://stackoverflow.com/comment/36404177
has title: Failed to concisely convert String with milliseconds to Date type in Java
tagged with: datetime
downvote count: 1
has comment: http://stackoverflow.com/comment/36404266
favorite count: 0
has answer: http://stackoverflow.com/a/23693892
upvote count: 0
has body: Please find the following codes: @RunWith(JUnit4.class) public class TestTimestamp { private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSSSSS"); private final static SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); @Test public void test() throws ParseException { getTimestamp("20140512 16:13:09.493166 +0800", sdf); getTimestamp("20140515 15:04:42.690873 +0800", sdf); getTimestamp("20140515 15:04:45.159977 +0800", sdf); getTimestamp("20140512 16:13:09.493166 +0800", df); getTimestamp("20140515 15:04:42.690873 +0800", df); getTimestamp("20140515 15:04:45.159977 +0800", df); } private void getTimestamp(String time, SimpleDateFormat sdf) throws ParseException { System.out.println("Time to convert: " + time); String[] tmp = time.split("\\+"); String str = tmp[0].trim(); System.out.println(str); System.out.println(sdf.parse(str)); System.out.println(); } } The output with sdf is very strange and the output with df is correct: //Wrong result with sdf Time to convert: 20140512 16:13:09.493166 +0800 20140512 16:13:09.493166 Mon May 12 16:21:22 CST 2014 Time to convert: 20140515 15:04:42.690873 +0800 20140515 15:04:42.690873 Thu May 15 15:16:12 CST 2014 Time to convert: 20140515 15:04:45.159977 +0800 20140515 15:04:45.159977 Thu May 15 15:07:24 CST 2014 //Correct result with df Time to convert: 20140512 16:13:09.493166 +0800 20140512 16:13:09.493166 Mon May 12 16:13:09 CST 2014 Time to convert: 20140515 15:04:42.690873 +0800 20140515 15:04:42.690873 Thu May 15 15:04:42 CST 2014 Time to convert: 20140515 15:04:45.159977 +0800 20140515 15:04:45.159977 Thu May 15 15:04:45 CST 2014 Could you please help me out?
possible better answer: http://stackoverflow.com/a/23693892
tagged with: date-conversion
type: AnsweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/a/58700745
has body: With Spring-boot-2.0.3.REALEASE / spring-web-5.0.7, I've come up with below code working for @Async Class that holds the ThreadLocal context. import java.util.Map; public class ThreadContextHolder { private ThreadContextHolder() {} private static final ThreadLocal&lt;Map&lt;String, Object&gt;&gt; ctx = new ThreadLocal&lt;&gt;(); public static Map&lt;String, Object&gt; getContext() { return ctx.get(); } public static void setContext(Map&lt;String, Object&gt; attrs) { ctx.set(attrs); } public static void removeContext() { ctx.remove(); } } Async config : @Bean public Executor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); ... ... executor.setTaskDecorator( runnable -&gt; { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); // or currentRequestAttributes() if you want to fall back to JSF context. Map&lt;String, Object&gt; map = Arrays.stream(requestAttributes.getAttributeNames(0)) .collect(Collectors.toMap(r -&gt; r, r -&gt; requestAttributes.getAttribute(r, 0))); return () -&gt; { try { ThreadContextHolder.setContext(map); runnable.run(); } finally { ThreadContextHolder.removeContext(); } }; }); executor.initialize(); return executor; } And from the async method : @Async public void asyncMethod() { logger.info("{}", ThreadContextHolder.getContext().get("key")); }
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23732089

http://stackoverflow.com/a/55260949
type: Answer
answers question: http://stackoverflow.com/q/23753214
score: 0
has body: This is probably an obvious but if you're using spring framework make sure you add the spring library to the build path as well. Download spring library such as spring-framework-4.1.6.RELEASE-dist.zip - unzip to a folder on your laptop - C:\springLib\ Then add a User Library to the build path and point to this lib

http://stackoverflow.com/a/45309776
score: 10
upvote count: 10
answers question: http://stackoverflow.com/q/23766446
has body: I solved this issue by naming the method as localeResolver using the solution provided here Spring 4 i18n &amp; l10n (Cannot change HTTP accept header) @Bean public LocaleResolver localeResolver() { final SessionLocaleResolver localeResolver = new SessionLocaleResolver(); localeResolver.setDefaultLocale(new Locale("en", "US")); return localeResolver; }
downvote count: 0
has comment: http://stackoverflow.com/comment/89702226
type: Answer

http://stackoverflow.com/comment/36347827
type: QuestionComment
comment on: http://stackoverflow.com/q/23662835
score: 0
has text: Approximate wait time for what? What would you need to be waiting for, and what is the criteria (what would need to happen) for which the game should stop waiting and proceed?
type: Comment

http://stackoverflow.com/comment/36546408
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23734203
type: Comment
has text: Hi gerry, thank you for your reply, that's not the problem. You can access a map using three different ways: (1) map.get(key) (2) map.key (3) map[key]. The problem comes up when I try to access using a key that's been generated dynamically within the vm. I think something is being rendered wrongly, maybe related to precedence. Notice that the key is a variable that's been previously generated with the iteration variable of the #foreach

http://stackoverflow.com/q/23749317
type: Question
score: 0
tagged with: graphics2d
answer count: 1
tagged with: fontmetrics
has title: Java: Graphics aligning Strings
has answer: http://stackoverflow.com/a/23749625
tagged with: java-canvas
type: UnansweredQuestion
has body: I'm currently trying to create a rolling text method, in which will take an argument of a String. Soon, it will start to draw, from left to right, and go onto new lines over time so it doesn't draw off of the screen. I am using the FontMetrics to try to achieve my goal. I pass arguments to my RollingText.render(Graphics g, int x, int y) from my render method in my main class. From within my render method, I start settings the Graphics font, and color, and grabbing all of the FontMetrics, and I start grabbing different stuff from the FontMetrics. As well, I go into a for loop for drawing the text to the string. public void render(Graphics g, int x, int y) { // text is the field that a grab the index of the string from // the index is the max part of the string I'm grabbing from, // increments using the update() method String str = text.substring(0, index); String[] words = str.split(" "); Font f = new Font(g.getFont().getName(), 0, 24); FontMetrics fmetrics = g.getFontMetrics(f); g.setColor(Color.white); g.setFont(f); int line = 1; int charsDrawn = 0; int wordsDrawn = 0; int charWidth = fmetrics.charWidth('a'); int fontHeight = fmetrics.getHeight(); for (int i = 0; i &lt; words.length; i++) { int wordWidth = fmetrics.stringWidth(words[i]); if (wordWidth* wordsDrawn + charWidth * charsDrawn &gt; game.getWidth()) { line++; charsDrawn = 0; wordsDrawn = 0; } g.drawString(words[i], x * charsDrawn + charWidth, y + fontHeight * line); charsDrawn += words[i].length(); wordsDrawn += 1; } } Currently, at this point everything will work fine, but the problem left is that the spaces between each word in the drawString method is heavily exaggerated, like so: The line: g.drawString(words[i], x * charsDrawn + charWidth, y + fontHeight * line); The only problem I'm currently having is finding the correct way to do the math for the x position. Currently, it is spaced heavily and dynamically depending on word length, and I cannot figure out how to get it to look at least normal. I've …
tagged with: fonts
tagged with: java

http://stackoverflow.com/comment/36263803
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23617590
has text: Why do you think you need another thread? Servlets are already multi-threaded.

http://stackoverflow.com/q/23616448
tagged with: trie
upvote count: 0
answer count: 1
has title: Search Trie implementation
favorite count: 0
linked to: http://stackoverflow.com/q/9319354
tagged with: generics
has body: I have written a code StringTrie.java implemented through interface Trie.java: package il.ac.tau.cs.sw1.trie; import java.util.Set; /** * Represents a generic trie data structure, where K is the type of keys that * are saved in the trie, and V is the type of values that can be saved for each * key. */ public interface Trie&lt;K, V&gt; { /** * Adds the input key to the data structure with the given value. If the key * is invalid for this trie (implementation-dependent) an exception is * thrown. */ void addKey(K key, V value); /** * Searches all the keys in the trie structure with the given prefix. If * there are no such keys - an empty Set is returned. Otherwise, all the values saved * for these keys are added to the output value set. If the prefix is invalid for this * trie (implementation-dependent) an exception is thrown. * * @post the return value is not null */ Set&lt;V&gt; searchByPrefix(K prefix); } along with StringTrieNode.java implemented through TrieNode.java: package il.ac.tau.cs.sw1.trie; import java.util.List; import java.util.Set; /** * Represents a node in a generic trie, where K is the type of keys that are * saved in the trie, and V is the type of values that can be saved for each * key. */ public interface TrieNode&lt;K, V&gt; { /** * Adds the key suffix to this trie node, with the given value, by * recursively adding the suffix of this suffix to the relevant child node. * * @pre suffix is a valid suffix for this trie (implementation-dependent) * @post if the key ends in this trie node, the input value is added to the * set of values returned by getValues(). */ void addSuffix(K suffix, V value); /** * Returns the set of values for keys that end in this node */ Set&lt;V&gt; getValues(); /** * Returns the child trie node such that the input suffix is saved in it or * in its descendant * * @pre suffix is a valid suffix for this trie (implementation-dependent) * @post if no key with such a suffix exists in the trie, or if suffix ends * in the current n…
has answer: http://stackoverflow.com/a/23616806
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36257361
type: Question
score: -2
tagged with: java

http://stackoverflow.com/comment/36397193
comment on: http://stackoverflow.com/q/23688362
score: 0
type: QuestionComment
type: Comment
has text: Where is the query? In the body or in the URL?

http://stackoverflow.com/comment/36460200
type: QuestionComment
comment on: http://stackoverflow.com/q/23721908
has text: @NewWorld "I am making an application to show data. But it won't. I just show some weird String, it said jeremy.ItemsData@33f1ca93 and another table cell show jeremy.ItemsData@427a9389. Here is my code. I got the code from somewhere and I modify it because I dont want my application look like that."
score: 0
type: Comment

http://stackoverflow.com/a/23712408
answers question: http://stackoverflow.com/q/23712288
type: AcceptedAnswer
score: 0
has body: You can combine with the resizeDimen(int, int) with one of the options like centerCrop() or centerInside() or fit() for instance. Example: Picasso.with(context) .load("http://10.0.2.2:3009/buffet_items/".trim()+resultp.get("item_image").trim()) .resizeDimen(R.dimen.wanted_size,R.dimen.wanted_size) .centerCrop().into(flag);
type: Answer
accepted answer of: http://stackoverflow.com/q/23712288

http://stackoverflow.com/q/23736457
has title: XML DOM parsing, getting NULL on every getNodeValue()
tagged with: java
accepted answer: http://stackoverflow.com/a/23737024
tagged with: dom
tagged with: xml-parsing
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I'm trying to parse an XML file using DOM. But I'm getting NULL values from the nodes, even though, as you can see in the XML file, they all have values... I've been trying for a while but can't find a solution to this issue. I'm quite a newbie to java programming, so it's probably a newbie error, but i'm getting quite frustrated now... This is the XML i'm parsing: &lt;root&gt; &lt;seguro&gt; &lt;seg_tipo&gt;cocacola&lt;/seg_tipo&gt; &lt;seg_subtipo&gt;cocacola&lt;/seg_subtipo&gt; &lt;seg_title&gt;cocacola&lt;/seg_title&gt; &lt;seg_descr&gt;cocacola&lt;/seg_descr&gt; &lt;seg_carac_title&gt;cocacola&lt;/seg_carac_title&gt; &lt;seg_carac&gt;cocacola&lt;/seg_carac&gt; &lt;/seguro&gt; &lt;seguro&gt; &lt;seg_tipo&gt;fantanaranja&lt;/seg_tipo&gt; &lt;seg_subtipo&gt;fantanaranja&lt;/seg_subtipo&gt; &lt;seg_title&gt;fantanaranja&lt;/seg_title&gt; &lt;seg_descr&gt;fantanaranja&lt;/seg_descr&gt; &lt;seg_carac_title&gt;fantanaranja&lt;/seg_carac_title&gt; &lt;seg_carac&gt;fantanaranja&lt;/seg_carac&gt; &lt;/seguro&gt; &lt;/root&gt; I've set some System.out.println() to tell me the name of the node an the value, and this is what i get: seg_tipo -- null seg_subtipo -- null seg_title -- null seg_descr -- null seg_carac_title -- null seg_carac -- null /n-------------------------------------/n seg_tipo -- null seg_subtipo -- null seg_title -- null seg_descr -- null seg_carac_title -- null seg_carac -- null /n-------------------------------------/n I can't get it working... this is the code that parses he XML: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); File fileXML = new File("seguros.xml"); Document document = builder.parse(fileXML); Element root = document.getDocumentElement(); NodeList items = root.getElementsByTagName("seguro"); // System.out.println(items.getLength()); // System.out.println(items.item(1).getNodeName()); for (int i = 0; i &lt; items.getLength(); i++) { Seguro seguroActual = new S…
has answer: http://stackoverflow.com/a/23737024
tagged with: http://stackoverflow.com/tag/xml
upvote count: 1
answer count: 1

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/23704505
tags question: http://stackoverflow.com/q/23772011
type: Tag

http://stackoverflow.com/comment/36371400
has text: Which doesn't seem to be the case here...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23674953
type: AnswerComment

http://stackoverflow.com/q/23653258
has comment: http://stackoverflow.com/comment/36328843
upvote count: 5
accepted answer: http://stackoverflow.com/a/23653694
has comment: http://stackoverflow.com/comment/70043992
type: AnsweredQuestion
downvote count: 0
tagged with: string
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/23653469
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/23653469
has body: I had a question about the control characters. I have to found them in a string and delete them. Made some research and found useful tips. I wrote this: output.toString().replaceAll("[\\p{Cntrl}\\p{Cc}]","") But I was asked if this method can find the control characters if they are written in bytes. To be honest, I have no idea. Try to look on the net, but don't know how I can test it. Thanks
has answer: http://stackoverflow.com/a/23653694
tagged with: java
tagged with: control-characters
has title: Find Control Characters written in bytes in Java

itemlistener
tags question: http://stackoverflow.com/q/23734947
type: Tag
tag name: itemlistener

http://stackoverflow.com/comment/36314293
type: Comment
has text: wireshark is the tool you would want to use.
type: QuestionComment
comment on: http://stackoverflow.com/q/23645700
score: 1

http://stackoverflow.com/q/23637417
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: android-service
has answer: http://stackoverflow.com/a/23638652
has title: Services for Android 3
has body: My main problem is "When i click start button but It did not change TextView". I am trying Service.I use Handler object for calling broadcast then it show textView.But it did not work what problem i can not understand.please help me. MainActivity.java package com.example.service_ahsanul; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { Button btnStart, btnStop; TextView txtOutput; private ServiceResponseReceiver myreceiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnStart = (Button) findViewById(R.id.btnStart); btnStop = (Button) findViewById(R.id.btnStop); txtOutput = (TextView) findViewById(R.id.txtOutput); btnStart.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, MyServices.class); startService(intent); } }); btnStop.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, MyServices.class); stopService(intent); } }); } @Override protected void onResume() { super.onResume(); // Register broadcast port theke if (myreceiver == null) { myreceiver = new ServiceResponseReceiver(); IntentFilter filter = new IntentFilter("service_action"); registerReceiver(myreceiver, filter); } } @Override protected void onPause() { super.onPause(); // unregister broadcast port theke if (myreceiver != null) { unregisterReceiver(myreceiver); } } class ServiceResponseReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equalsIgnoreCase("service_ac…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36299268
has comment: http://stackoverflow.com/comment/36299230
tagged with: android-handler
accepted answer: http://stackoverflow.com/a/23638652
has comment: http://stackoverflow.com/comment/36298763
tagged with: android-broadcast
possible better answer: http://stackoverflow.com/a/23638343
tagged with: android
has answer: http://stackoverflow.com/a/23638343

http://stackoverflow.com/q/23739683
accepted answer: http://stackoverflow.com/a/23739906
type: AnsweredQuestion
has body: I have a consultation table for doctors and when I log in with a doctors account I only want to display the consultations for that specific doctor. In my jsp page I tried the following, but with no luck: <c:forEach var="consultation" items="${consultations}"> <c:if test = "${consultation.user.lastName == '${user.lastName}'}"> <c:out value="${consultation.patient.name}" /> <c:out value="${consultation.user.lastName} ${consultation.user.firstName}" /> <c:out value="${consultation.date}" /> <c:out value="${consultation.time}" /> <c:out value="${consultation.details}" /> <c:out value="${consultation.prescription}" /> </c:if> </c:forEach> But the comparison is not working. How can I do such a test?
has answer: http://stackoverflow.com/a/23739906
tagged with: java
type: Question
tagged with: jstl
score: 0
has title: JSTL string comparison when both strings are taken from the database
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/23648327
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23636748
type: Answer
accepted answer of: http://stackoverflow.com/q/23636748
has body: You can call GLContext.getCurrentGL() to get the GL instance but your method must be called when the OpenGL context is current. Look at the source code of Ardor3D JOGL renderer to see how I use it. Why not using GL2ES2 and GL2ES1 where it is possible so that your code has a chance to work with OpenGL-ES too? Your source code would be easier to read if your variables weren't named in French and without respecting Java code conventions. Finally, the official JogAmp forum is a better place to ask questions about JOGL.
score: 0

http://stackoverflow.com/comment/36259873
comment on: http://stackoverflow.com/q/23617672
type: Comment
type: QuestionComment
score: 4
has text: @djechlin This guy had tried something so lets try and help him out in his way

http://stackoverflow.com/q/23768997
tagged with: android
tagged with: facebook
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26490710
has title: Android Facebook SDK, requesting publish permission "manage_pages" isn't updating session permissions list
has body: I am using Parse and Facebook SDKs on Android. I'm trying to request for the permission "manage_pages" after the facebook account is linked. But whenever I make the request it does NOT add to the list of permissions in Session.getPermissions(). However, the Facebook dialog popup asking for the "manage_pages" permission appears, and it is listed in my Facebook Apps settings on facebook.com. In MainActivity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.e(TAG, "Receiving activity result with requestCode: " + requestCode + " resultcode: " + resultCode); if (requestCode == 32665) // Code for when facebook is NOT linked ParseFacebookUtils.finishAuthentication(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); } In FacebookFragment's onCreateView(): connectBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (user == null) { Log.d(TAG, "User is null."); return; } if (!ParseFacebookUtils.isLinked(user)) { ParseFacebookUtils.link(user, FacebookFragment.this.getActivity(), new SaveCallback() { @Override public void done(ParseException ex) { if (ParseFacebookUtils.isLinked(user)) { Log.d(TAG, "Woohoo, user logged in with Facebook!"); user.add(ParseConstants.USER_ARRAY_NETWORKS, ParseConstants.NETWORK_CODE_FACEBOOK); user.saveInBackground(); Session session = Session.getActiveSession(); // Check for publish permissions List&lt;String&gt; permissions = session.getPermissions(); if (!permissions .contains(Permissions.Page.MANAGE_PAGES)) { Log.e(TAG, "We don't have hte permission: " + Permissions.Page.MANAGE_PAGES + "... we have " + Arrays.toString(permissions.toArray())); Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest( getActivity(), "manage_pages"); newPermissionsRequest.setRequestCode(23232); newPermissionsRequest.setCallback(new St…
answer count: 2
score: 2
downvote count: 0
favorite count: 0
tagged with: parse-platform
has answer: http://stackoverflow.com/a/28034157
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/23692585
tagged with: gradle
tagged with: classpath
has title: Gradle: verify list of classes are in classpath on build
tagged with: java
type: UnansweredQuestion
tagged with: groovy
has answer: http://stackoverflow.com/a/23694034
downvote count: 0
score: 1
favorite count: 0
has body: I have a multi-project build that contains dozens of XML files and my issue is that you specify in certain XML files a full Class Name (E.g. com.myproject.CheckItem) but there is no check at any point to verify that what you typed is correct during the build process. You can only see if what you typed is correct by going to the area of the app that utilizes the XML to see if it works or not. What I would like to do is that at some point during the gradle build verify that the Class Names defined in these XML files are either one of my Classes or in one of the jars I have in a two lib folders added as compile dependencies. Where I am at right now is I have a Map&lt;String, List&lt;String&gt;&gt; that has all the keys being the Class Names and the value being a list of files that contain the key. So, it looks like this: com.myproject.CheckItem - C:\Development\my-app\app-core\src\main\resources\META-INF\Totally.xml - C:\Development\my-app\app-filter\src\main\resources\META-INF\Awesome.xml com.myproject.CheckSquare - C:\Development\my-app\app-core\src\main\resources\META-INF\FarOut.xml I've been fiddling around all night looking at the best way to go about this, and the easiest would be to do something like this: try { Class.forName("com.myproject.CheckItem", false, this.getClass().getClassLoader()); // it exists on the classpath } catch(ClassNotFoundException e) { // it does not exist on the classpath } However I haven't had luck on integrating this into the Gradle build process which is where I'd like it, ideally spun off intp my own Gradle Plugin. As an alternative I've thought about doing a parameterized unit test that does this since within the unit test it will have access to the classpath easily and I could do the above but would prefer doing it within the Gradle build process. Suggestions?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24026123
upvote count: 1

http://stackoverflow.com/comment/36279414
type: Comment
has text: are you using client in OSGI???
comment on: http://stackoverflow.com/q/23627769
score: 0
type: QuestionComment

http://stackoverflow.com/a/23636429
has body: If you put the file in eclipse project folder rather than source folder you could directly access it like File dbFile = new File("executive_db.accdb"); By default if you put a file in src folder eclipse will copy that to class folder while compiling and will be accessible. If this isn't the case you can copy the file to class folder and use ClassLoader to get the path. URL url = ClassLoader.getSystemResource("executive_db.accdb"); File dbFile = new File(url.getPath());
score: 0
answers question: http://stackoverflow.com/q/23635915
type: Answer

http://stackoverflow.com/q/23731262
has body: Trying to learn JPA, EJB, ManagedBeans, JSF etc but I'm getting an error trying to persist an entity. That is invoking the BlogManager save method through my facelet. Here is the JSF, ManagedBean, EJB and Entity. @Entity @Table(name = "BLOG") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Blog.findAll", query = "SELECT b FROM Blog b"), @NamedQuery(name = "Blog.findByBlogid", query = "SELECT b FROM Blog b WHERE b.blogid = :blogid"), @NamedQuery(name = "Blog.findByText", query = "SELECT b FROM Blog b WHERE b.text = :text"), @NamedQuery(name = "Blog.findByTimestamp", query = "SELECT b FROM Blog b WHERE b.timestamp = :timestamp")}) public class Blog implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Column(name = "BLOGID") private Integer blogid; @Size(max = 5000) @Column(name = "TEXT") private String text; @Column(name = "TIMESTAMP") @Temporal(TemporalType.TIMESTAMP) private Date timestamp; public Blog() { } public Blog(Integer blogid) { this.blogid = blogid; } Getters and Setters... EJB: @Stateless public class BlogFacade extends AbstractFacade&lt;Blog&gt; { @PersistenceContext(unitName = "MyBlogPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public BlogFacade() { super(Blog.class); } public List&lt;Blog&gt; getBlogs(){ em.createNativeQuery("USE Blog").executeUpdate(); Query query = em.createNamedQuery("Blog.findAll"); return query.getResultList(); } public void deleteBlog(int id){ Query query = em.createNativeQuery("DELETE FROM blog WHERE blogid = :blogid"); query.setParameter(":blogid", id); query.executeUpdate(); } } ManagedBean @Named("blogManager") @ManagedBean @SessionScoped public class BlogManager implements Serializable { private Blog BlogEntity; @EJB private BlogFacade BlogFacade; @PostConstruct public void init(){ BlogEntity = new Blog(); } public Blog getBlogEntity(){ return this.BlogEntity; } public void setBlogEntity(Blog BlogEntity){ th…
score: 0
has title: Can't persist entity. EJBException
has comment: http://stackoverflow.com/comment/36480052
type: AnsweredQuestion
tagged with: jsf
tagged with: java
accepted answer: http://stackoverflow.com/a/23732619
type: Question
tagged with: jakarta-ee
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/23732619

http://stackoverflow.com/comment/36802653
type: QuestionComment
comment on: http://stackoverflow.com/q/23728688
has text: @RomanC the full stacktrace is included in the question.
score: 0
type: Comment

http://stackoverflow.com/comment/36416239
has text: Script is your best bet. There is no such direct way of doing it.
score: 1
comment on: http://stackoverflow.com/q/23698936
type: Comment
type: QuestionComment

opengl-es-2.0
tag name: opengl-es-2.0
type: Tag
tags question: http://stackoverflow.com/q/23765894

performance
tags question: http://stackoverflow.com/q/23733955
tags question: http://stackoverflow.com/q/23704010
tags question: http://stackoverflow.com/q/23704635
tags question: http://stackoverflow.com/q/23734393
tags question: http://stackoverflow.com/q/23712410
tags question: http://stackoverflow.com/q/23768270
tags question: http://stackoverflow.com/q/23659502
tags question: http://stackoverflow.com/q/23766311
tags question: http://stackoverflow.com/q/23627511
tags question: http://stackoverflow.com/q/23679932
tags question: http://stackoverflow.com/q/23628774
tags question: http://stackoverflow.com/q/23706957
tags question: http://stackoverflow.com/q/23756966
tags question: http://stackoverflow.com/q/23659178
tags question: http://stackoverflow.com/q/23771022
tags question: http://stackoverflow.com/q/23757967
tags question: http://stackoverflow.com/q/23753718
tags question: http://stackoverflow.com/q/23769956
tags question: http://stackoverflow.com/q/23630597
tags question: http://stackoverflow.com/q/23628501
tag name: performance
tags question: http://stackoverflow.com/q/23697049
tags question: http://stackoverflow.com/q/23681416
type: Tag
tags question: http://stackoverflow.com/q/23725853
tags question: http://stackoverflow.com/q/23616817
tags question: http://stackoverflow.com/q/23647687
tags question: http://stackoverflow.com/q/23616561
tags question: http://stackoverflow.com/q/23629794

http://stackoverflow.com/comment/36517001
type: Comment
comment on: http://stackoverflow.com/a/23738325
type: AnswerComment
has text: So I'll have to use LIST or ZSET instead of SET and then use range() to fetch limited number of members so as not to overwhelm my heap size?
score: 0

http://stackoverflow.com/comment/36278751
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23627343
has text: @Darshana: Well now you're trying to return a variable which isn't even declared - that *won't* give the error message you described.

http://stackoverflow.com/a/23665037
type: Answer
answers question: http://stackoverflow.com/q/23664534
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/36352377
has body: This: JMenu menu = new JMenu(name); needs to change to: menu = new JMenu(name); where menu is an instance member of the class: private JMenu menu; Then in actionPerformed(...), simply call: menu.setText(current) instead of re-creating it.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23664534

http://stackoverflow.com/q/23670570
upvote count: 1
has title: curl url with post data, username and password and response as file
possible better answer: http://stackoverflow.com/a/23670656
answer count: 3
favorite count: 0
tagged with: curl
has answer: http://stackoverflow.com/a/24504092
accepted answer: http://stackoverflow.com/a/24504092
downvote count: 0
has body: I am using to call a url from command prompt of curl. The url contains post data, user name and password. Added to that the response should be a file if authenticates or shows generally 401 response. I have been trying to find out the solution for the last 2 hours, but cant able to do that. For example i want to send two values(x,y) using post and with that i am sending the username and password also, say for instance curl -u test@test.com:test http://www.example.com/mappingFile if i sending like this i am getting Error 405 Request method 'GET' not supported Error 405 Request method 'GET' not supported Please any body can help me.
has answer: http://stackoverflow.com/a/23670656
has answer: http://stackoverflow.com/a/23670662
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/23640512
tagged with: authentication
type: Question
tagged with: kerberos
tagged with: ntlm
tagged with: httpclient
has comment: http://stackoverflow.com/comment/36632869
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: testing NTLM\kerberos against a public url
has body: I am creating an open source Java package that makes it easy to connect with HttpClient 3.1 to resources that are protected by ntlm v1/v2 and kerberos. I need to test this tool against real world serves. are there any publicly available endpoints that are protected by ntlm or kerberos that I can get a user and password to test against? Basically I am looking for something like http://browserspy.dk/password-ok.php for ntlm \kerberos
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/36314616
tagged with: java

http://stackoverflow.com/comment/36382172
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23680537
has text: This causes an `NoSuchelementException` for the first list this is the same, but when the second list is printed, this causes the error.
type: AnswerComment

http://stackoverflow.com/comment/36288742
has text: possible duplicate of [Java: socket read time out exception](http://stackoverflow.com/questions/12406628/java-socket-read-time-out-exception)
score: 0
comment on: http://stackoverflow.com/q/23632950
type: Comment
type: QuestionComment

pointcut
tags question: http://stackoverflow.com/q/23702673
type: Tag
tag name: pointcut

http://stackoverflow.com/q/23715841
has answer: http://stackoverflow.com/a/23716186
type: AnsweredQuestion
favorite count: 0
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23716186
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36448267
downvote count: 1
has comment: http://stackoverflow.com/comment/36448902
has comment: http://stackoverflow.com/comment/36448974
has body: I am new to Java Programming and Hashmaps and I have a problem that I need help with. I have a Hashmap that stores a collection of objects: private HashMap &lt;String, Turtle&gt; turtles = new HashMap&lt;String, Turtle&gt;(); I also have a collection of shapes which I have added to the Turtle class: ArrayList&lt;String&gt; shapes = new ArrayList&lt;String&gt;(); What I am trying to do is find a way so that it adds the shape object with a specified name to the turtle object with a specified name by passing the parameters of String turtleName and String shapeName. I do not know how to go about this with a ArrayList and a Hashmap.
tagged with: hashmap
has title: Comparing a Hashmap with Array
tagged with: arrays
tagged with: arraylist

http://stackoverflow.com/a/23658515
has comment: http://stackoverflow.com/comment/36340478
has comment: http://stackoverflow.com/comment/36340159
type: Answer
has comment: http://stackoverflow.com/comment/36339530
has comment: http://stackoverflow.com/comment/36339372
has body: Do not use Null layout. Use a BorderLayout. All your search functionality should be in the center panel. add(mySearchPanel, BorderLayout.CENTER); Your results should be in the south panel. That way it will not shrink the center panel. add(myResultsPanel, BorderLayout.SOUTH); If there is nothing in the south panel, then it will shrink away making it seem like it is not there. So, going into a little more detail, your l0,l1, and b1 components should go into a panel (say myTopPanel), and be added to the center. Your scroll component should be added to the bottom panel. setTitle("Search Executive Reports "); setLayout(new BorderLayout()); myTopPanel.add(l0); myTopPanel.add(l1); myTopPanel.add(b1); add(myTopPanel, BorderLayout.CENTER) add(scroll, BorderLayout.CENTER)
answers question: http://stackoverflow.com/q/23658162
has comment: http://stackoverflow.com/comment/36340396
score: 0

http://stackoverflow.com/comment/36570819
has text: As that support forum entry suggests, marking an app for auto-start does not normally make it impossible to delete. There is something else going on. Try a sample app, make sure your OSes are suitable (compile using a JRE less than your device) and test that. Document your test completely here if it doesn't work, so we can replicate.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23765336

http://stackoverflow.com/a/23706953
has comment: http://stackoverflow.com/comment/36472186
has comment: http://stackoverflow.com/comment/36472219
has comment: http://stackoverflow.com/comment/36472261
answers question: http://stackoverflow.com/q/23691242
has body: Please make sure your RegionServer is running fine. Do a quick jps to verify that. Also, in a local setup setting zk host and port is not required. But using it won't do any harm. Use configuration.set("hbase.zookeeper.property.clientPort", "2181"); configuration.set("hbase.zookeeper.quorum", "localhost"); The third property is no longer required. If the problem still persists please show me your log files.
has comment: http://stackoverflow.com/comment/36472105
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36472334
has comment: http://stackoverflow.com/comment/36472235
has comment: http://stackoverflow.com/comment/36472142
has comment: http://stackoverflow.com/comment/36472247
has comment: http://stackoverflow.com/comment/36472126
has comment: http://stackoverflow.com/comment/36472223

http://stackoverflow.com/comment/36392691
type: QuestionComment
has text: Have a look at my updated code, i changed the `JFileChooser` to a `JComboBox` to select the files.
comment on: http://stackoverflow.com/q/23640667
score: 0
type: Comment

http://stackoverflow.com/a/23648906
upvote count: 1
has body: Doing output_harm[][] outputs = new output_harm[7][6] without initialize the values, all values will be set to default, which is null You need to add: outputs[0][0]=new output_harm(); then you can do: outputs[0][0].state[0] = 0;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23648841
score: 1

http://stackoverflow.com/a/48438557
has body: In addition to Alexis C's answer, If you are working with an array list, in which you are not sure whether the element you are searching for exists, use this. Integer a = list.stream() .peek(num -&gt; System.out.println("will filter " + num)) .filter(x -&gt; x &gt; 5) .findFirst() .orElse(null); Then you could simply check whether a is null.
type: Answer
has comment: http://stackoverflow.com/comment/84324454
upvote count: 25
downvote count: 2
score: 23
has comment: http://stackoverflow.com/comment/84251952
answers question: http://stackoverflow.com/q/23696317
has comment: http://stackoverflow.com/comment/125384558

http://stackoverflow.com/comment/36307467
comment on: http://stackoverflow.com/q/23642001
type: Comment
type: QuestionComment
score: 0
has text: nodeS is an object of type menuItems which I receive as an argument.

http://stackoverflow.com/q/23649868
answer count: 1
tagged with: rally
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23665230
tagged with: java
has title: Can I modify existing pages content in Rally
type: Question
has body: In rally when I select any release its start_date and end_date should be automatically populated, rather than selecting it again. So can I write code for that one and run it for our Rally instance. any suggestions. Thanks in advance
tagged with: javascript
score: 0

http://stackoverflow.com/a/23684472
has comment: http://stackoverflow.com/comment/36389826
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23684400
upvote count: 3
has body: This only applies to pointers. Expressions of class/struct type (references inclusive) use the more familiar dot notation: class Whatever { public: int x; void take(int n); }; class T { public: int x; }; void Whatever::take(int n) { T t; T *pt = &t; // pointer T &tr = t; // reference is basically just an alias pt->x = n; (*pt).x = n; // can dereference a pointer, then use like a reference tr.x = n; // Same for this. this->x = n; (*this).x = n; } What may seem odd to you is that this is a pointer in C++ as opposed to a reference. See also: Why 'this' is a pointer and not a reference? (Stroustrup introduces this before he created references in the language.)
has comment: http://stackoverflow.com/comment/36389917
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23684400

http://stackoverflow.com/a/23717701
score: 0
answers question: http://stackoverflow.com/q/23714726
has body: Try with this: public class MainActivity extends ListActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2" }; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, values); setListAdapter(adapter); } } If in doubt check this page: http://www.vogella.com/tutorials/AndroidListView/article.html#listactivit
type: Answer

http://stackoverflow.com/q/23740833
tagged with: spring
has title: Spring MVC form validation / accessing form fields in validator
has comment: http://stackoverflow.com/comment/36496493
tagged with: spring-mvc
has body: There is a form for which the phone number is sometimes required and sometimes it is not and the form is validated by validator class that spring calls. I would like that validator class to know if when the field is required and when it is ok if it's empty, but I am not sure about the correct approach to implement this. The controller and validation process looks like this: @RequestMapping(value = "my/url", method = RequestMethod.POST) public ModelAndView someMethod(@Valid T myForm, BindingResult bindingResult) { //Calling the validation... if (bindingResult.hasErrors()) { // didn't pass validation } else { // is ok! } } The form looks like this. The idea isI could add another field that would determine if phone number is required or not, if I would find a way to use it later when validating phone field. It has the @Phone annotation: public class MyForm implements Serializable { private static final long serialVersionUID = 1L; @Phone private String phone; public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } } The @Phone annotation specifies a class that will validate the data @Target({CONSTRUCTOR, FIELD, METHOD, PARAMETER}) @Retention(RUNTIME) @Documented @Constraint(validatedBy = ValidateField.class) public @interface Phone { String message() default "{default.phone.errormsg}"; int maxLength() default 64; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } Here is where the problem starts. The class that validates data looks like this and the thing is that I would like to be able to check if the phone is required this time or not in this form, but I don't see any way to pass other form fields in this class other than the phone number value and I can't access form object here anyway: public class PhoneValidator implements ConstraintValidator&lt;Phone, String&gt; { //... @Override public boolean isValid(String value, ConstraintValidatorContext context) { // I want to check if …
answer count: 0
has comment: http://stackoverflow.com/comment/36496506
tagged with: java
tagged with: forms
type: Question
linked to: http://stackoverflow.com/q/9284450
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23846099
type: Answer
accepted answer of: http://stackoverflow.com/q/23633823
answers question: http://stackoverflow.com/q/23633823
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: Have you taken a look at the schema? It looks like it has the same elements so it should be rather straightforward to create jboss-ejb3.xml using your existing jboss.xml as a starting point. Here's the jboss-ejb3.xml Reference. NOTE: I think the schemaLocation is not correct in the reference. It uses http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd, which does not exist. The correct schema location is http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd. I just created a discussion in the Wildfly group about the schema location problem. You don't mention where your jboss.xml is located so for completeness just a reminder that for Wildfly it should be in WEB-INF of a war, or META-INF of an EJB jar.
score: 4

http://stackoverflow.com/q/23644915
answer count: 1
has comment: http://stackoverflow.com/comment/36313468
favorite count: 0
has comment: http://stackoverflow.com/comment/36313358
has comment: http://stackoverflow.com/comment/36313434
tagged with: exception
has answer: http://stackoverflow.com/a/23645277
accepted answer: http://stackoverflow.com/a/23645277
downvote count: 0
has comment: http://stackoverflow.com/comment/36313302
tagged with: spring
has comment: http://stackoverflow.com/comment/36313692
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: spring-data
has body: Currently I am using Spring and Hibernate to access a MySQL database. When I get any SQL error's, it wraps with Spring Generic DataAccessException. I want to give a meaningful error messages to the user based on the Spring Data Exception. Can any body suggest, what is the best way to map Spring DataAccessExceptions to diffrent User Define error messages ? Eg: based on the following exception log,how we justify this is Primary Key Violation, If we had JDBCException, we can refer to the SQLErrorcode and map custom Error message to user. org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into Vehicle (vehicle_name, owner, remarks, next_license_date, next_insurance_date, inserted_date, updated_date, userid, vehicle_reg_no) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643) at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:392) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$Dynam…
has title: Catch DataAccessException and rethrow custom exception containing the SQL Errorcode
type: Question
upvote count: 1

http://stackoverflow.com/comment/36522854
type: QuestionComment
has text: @Amogh The linux-heavy parts of that answer relate to obtaining the certificate. I think you already have that, so you can just focus on the keytool part.
type: Comment
comment on: http://stackoverflow.com/q/23754081
score: 0

http://stackoverflow.com/q/23635055
has comment: http://stackoverflow.com/comment/36295690
tagged with: android-activity
has title: How do I open activity from java class running a seperate activity?
tagged with: android
tagged with: android-intent
type: UnansweredQuestion
has body: OK, so I have an activity that starts on launch (Activity One) This activity runs two other activities (Activity Two and Activity Three) which each run java classes then load into another activity (Activity Four) on touch event. Activity Four then opens Main Class. All of these parts work exactly as they should. The piece I am having issues with is starting a new activity (Activity Five) from Main Class and Activity Four. I have my intents, my XML layout file, and my manifest created correctly. Here is where it gets weird for me... 1) If I put Activity Five to start on touch event it works great (my touch events are in a switch case. It works if I put it in Main Class which registers touch events or Activity Four which handles touch events for Main Class). 2) If I put an if statement into the touch event, it fails with no error (handler acts like the event never happens), unless I put Activity Five to start in every "if" statement (this is the same whether I use just "if" or multiple, non-nested "if" statements, or "if/else if" statements. The result is always the same, handler acts like no touch event happened unless all if statements start Activity Five). 3) If I put Activity Five to start anywhere else in any Activity or the Main Class with any parameters at all I get an error saying I can't start the activity from a handler without Looper.prepare(). If I put Looper.prepare() into the intent call method it then errors saying null pointer exception at my startActivity(ActivityFive) call. Let me try and be 100% clear here... I don't change the intent call or startActivity() call at all. The only thing I change is the location and surrounding qualifiers (if statements). For some reason, the startActivity call only works if I put it in a touch event and start the activity no matter what qualifier registers as true. My other activities are all started from touch events or smooth auto-flow between each other. Activity Five needs to be started by either: 1) If statement…
tagged with: java
has answer: http://stackoverflow.com/a/23637444
type: Question
has comment: http://stackoverflow.com/comment/36293514
score: 0
answer count: 1
tagged with: events

http://stackoverflow.com/comment/36385889
type: QuestionComment
comment on: http://stackoverflow.com/q/23682663
score: 0
has text: Is your XLSX parser using Apache POI or is completely different and you want to benchmark your code against POI's execution time?
type: Comment

http://stackoverflow.com/comment/36402546
comment on: http://stackoverflow.com/q/23691035
has text: How does `countDocumentChangeLength` get updated?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36434766
has text: java.lang.ProcessBuilder.Redirect
comment on: http://stackoverflow.com/a/23708587
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23616907
type: Answer
has body: You Can Rewrite your code like this...see if this helps public void doGet(HttpRequest request,HttpResponse response)throws ServletException{ response.setContentType("image/jpeg;charset=UTF-8"); response.addHeader("content-disposition", "inline;filename=Default.jpeg"); try { URL url = new URL("https://abc/zhdhaG1z_bigger.jpeg"); InputStream stream = new BufferedInputStream(url.openStream()); ByteArrayOutputStream bos = new OutputStream(); byte buf[] = new byte[1024]; int n = 0; while(-1 != (n = stream.read(buf)) ) { bos.write(buf, 0, n); } } catch(Exception e){ e.printStackTarce(); } finally { out.close(); } }
has comment: http://stackoverflow.com/comment/36258085
has comment: http://stackoverflow.com/comment/36259180
score: 0
answers question: http://stackoverflow.com/q/23616540
has comment: http://stackoverflow.com/comment/36258898

http://stackoverflow.com/comment/49371400
type: AnswerComment
score: 1
type: Comment
has text: @StaxMan good point. I'm sure for most applications the best approach would be to inject the `ObjectMapper`, but like you said, for this example showing a single instantiation is an improvement.
comment on: http://stackoverflow.com/a/24024119

http://stackoverflow.com/q/23700460
has comment: http://stackoverflow.com/comment/36431135
has comment: http://stackoverflow.com/comment/36420971
type: UnansweredQuestion
tagged with: swing
answer count: 0
has title: When I add a column to a JTable, table.getColumnCount() doesn't change
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36420668
has comment: http://stackoverflow.com/comment/36421389
has body: I try to add a column to a JTable (named "table"): TableColumn newCol = new TableColumn(); newCol.setHeaderValue("Grant User"); table.addColumn(newCol); Before I add the new column, the method table.getColumnCount() returned 5 (I have 5 columns); after that, it still returns 5. Why?
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36420997

http://stackoverflow.com/comment/57755325
score: 0
type: Comment
type: QuestionComment
has text: Did you find the answer ? I have the same issue...
comment on: http://stackoverflow.com/q/23696711

http://stackoverflow.com/comment/36330142
comment on: http://stackoverflow.com/a/23645234
type: AnswerComment
has text: What if `first` instance contained other reference variables and lists, would doing first.clone() actually make clones of those too?
score: 0
type: Comment

http://stackoverflow.com/q/23682185
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: http://stackoverflow.com/tag/xls
tagged with: excel
tagged with: java
has title: Convert column from string to date using jxl
has body: I'm using jxl to read/write xls files. I need to convert an entire column which contains dates as string (dd/mm/yyyy) from string type to date type. I just need to convert cells preserving their content and format (dd/mm/yyy). Thanks a lot.
tagged with: jxl
type: Question
downvote count: 0

http://stackoverflow.com/comment/36488916
comment on: http://stackoverflow.com/q/23736142
type: Comment
type: QuestionComment
score: 1
has text: Puzzling. When you execute '/opt/oracle/7/jdk1.7.0_55/bin/java -version' without quotes you get a proper response?

http://stackoverflow.com/q/23733022
type: UnansweredQuestion
score: 1
tagged with: ejb
has answer: http://stackoverflow.com/a/23733121
tagged with: java
type: Question
upvote count: 1
answer count: 1
has title: InterruptedException: sleep interrupted
favorite count: 0
tagged with: singleton
has comment: http://stackoverflow.com/comment/36481605
tagged with: interrupted-exception
downvote count: 0
has body: I am delaying my application for sometime and sometimes I receive the following Exception: java.lang.InterruptedException: sleep interrupted I have been on this Exception for over one week and still no solution found. I have read a lot of forums and then mention that I need to either do the following: throw a RuntimeException Thread.currentThread().interrupt() by restoring the status of the Thread The problem is that this Exception only occurs after the following is executed in Glassfish: [#|2014-05-16T17:24:15.881+0100|WARNING|oracle-glassfish3.1.2|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=13;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: admin-thread-pool-4848(2).|#] I only have one Thread in the program and the program needs to continue to execute. Below is the code: @Startup @Singleton public class Listener { @PostConstruct public void init() { while(true) { try { Thread.sleep(TimeUnit.SECONDS.toMillis(1000)); // there are other codes that insert to the database and get information back from the database } catch(InterruptedException e) { e.printStackTrace(); if(Thread.currentThread().isInterrupted()) { Thread.currentThread().interrupt(); // restore interuppted status } } } } } This is what I get from the stacktrace: [#|2014-05-16T17:24:15.881+0100|WARNING|oracle-glassfish3.1.2|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=13;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: admin-thread-pool-4848(2).|#] [#|2014-05-16T17:24:15.881+0100|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=21;_ThreadName=Thread-2;|java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at com.screening.listener.Listener.init(Listener.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc…

http://stackoverflow.com/comment/36340511
has text: Thank you so much! It finally worked instead of using the label, I used the text pane and it formatted it very nicely! Thank you again.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23640811

http://stackoverflow.com/a/23774690
has body: Yes,the best way is to create your own properties.Here's sample code for the email that I have created:` //To define all the properties needed to make the rdf of the email package email; import com.hp.hpl.jena.rdf.model.*; public class EMAILRDF { //Create a default model private static Model m = ModelFactory.createDefaultModel(); //Subject of the mail public static final Property SUBJECT = m.createProperty("SUB:" ); //Sender of the mail public static final Property FROM = m.createProperty("FROM:" ); //Receiver of the mail public static final Property TO = m.createProperty("TO:" ); //Return path public static final Property RETURN_PATH = m.createProperty("RETURNPATH:" ); //main contents of the mail public static final Property CONTENT = m.createProperty("CONTENT:" ); //format of the mail public static final Property FORMAT = m.createProperty("FORMAT:" ); //content type like html etc public static final Property CONTENT_TYPE = m.createProperty("CONTENTTYPE:" ); //encoding in bits public static final Property ENCODING = m.createProperty("ENCODING:" ); //date of the email public static final Property DATE = m.createProperty("DATE:" ); }`
downvote count: 0
has comment: http://stackoverflow.com/comment/36607091
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23750840
type: Answer
answers question: http://stackoverflow.com/q/23750840

http://stackoverflow.com/a/25054458
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23682125
has body: We use codehaus jaxb2 plugin and it has encoding-option:: org.codehaus.mojo jaxb2-maven-plugin 1.5 xjc_qshgv generate-sources xjc ... ${file.encoding} ...
downvote count: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38972947
score: 1
answers question: http://stackoverflow.com/q/23682125

http://stackoverflow.com/comment/36544364
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23765364
has text: The code works on windows though, and it is the library that I am already using.

http://stackoverflow.com/q/23660919
tagged with: inputstream
upvote count: 2
tagged with: validation
possible better answer: http://stackoverflow.com/a/23785247
has answer: http://stackoverflow.com/a/30489497
favorite count: 0
has comment: http://stackoverflow.com/comment/36574456
has answer: http://stackoverflow.com/a/23711731
tagged with: xsd
accepted answer: http://stackoverflow.com/a/23711731
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36514464
downvote count: 0
has comment: http://stackoverflow.com/comment/36513442
has answer: http://stackoverflow.com/a/30489065
has body: i have a webservice which get an inputstream from a xml- file. Now, i want validate AND read it with the same inputstream. I use mark and reset for it. On Glassfish and Websphere it works fine. But when i run my integration tests with openEJB, the stream will be closed after validation. I can reproduce it in a simple example. How can i realize it better? The Validator Implementation is always the same. But every environment use another implementation of inputstream. public class XMLReader { public static void main(String[] args) { try { XMLReader reader = new XMLReader(); InputStream stream = new BufferedInputStream(new FileInputStream( new File("myXML.xml"))); reader.read(stream); } catch (Exception e) { e.printStackTrace(); } } public void read(InputStream xmlInputStream) throws SAXException, IOException { if (xmlInputStream.markSupported()) { xmlInputStream.mark(0); validateXML(xmlInputStream); xmlInputStream.reset(); readXML(xmlInputStream); } } private void readXML(InputStream xmlInputStream) { // READ xmInputStream with STAX, JAXB, etc. whatever } private void validateXML(InputStream xmlInputStream) throws SAXException, IOException { Source schemaFile = new StreamSource(new File("myXSD.xsd")); Source xmlFile = new StreamSource(xmlInputStream); SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaFile); Validator validator = schema.newValidator(); try { validator.validate(xmlFile); System.out.println("is valid"); } catch (SAXException e) { System.out.println("is NOT valid"); System.out.println("Reason: " + e.getLocalizedMessage()); } } } Exception: java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145) at java.io.BufferedInputStream.reset(BufferedInputStream.java:414) at xmltest.XMLReader.read(XMLReader.java:36) at xmltest.XMLReader.main(XMLReader.java:27)
type: Question
has title: Validate AND read with the same inputstream
tagged with: java
has answer: http://stackoverflow.com/a/23785247

http://stackoverflow.com/a/23664216
score: 0
answers question: http://stackoverflow.com/q/23663540
type: Answer
has comment: http://stackoverflow.com/comment/36351127
has comment: http://stackoverflow.com/comment/36350660
has comment: http://stackoverflow.com/comment/36350758
has body: I think you can use a PropertyChangeListener for this. You can create a class that extends from Thread, like this: public abstract class UIProcess extends Thread { private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); public void setStatus(int percentage) { pcs.firePropertyChange("status", 0, percentage); } public void addStatusChangeListener(PropertyChangeListener listener) { this.pcs.addPropertyChangeListener(listener); } } And then you can register your SwingWorker to listem for this events. Thread t = new UIProcess(...); t.addStatusChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { int newStatus = (Integer) evt.getNewValue(); //here you can update your progress bar, with a synchronized method if you think this is necessary } });
has comment: http://stackoverflow.com/comment/36350819

buildpath
type: Tag
tags question: http://stackoverflow.com/q/23714119
tag name: buildpath

http://stackoverflow.com/comment/36431724
type: QuestionComment
type: Comment
has text: What is the output of your logs ?
comment on: http://stackoverflow.com/q/23706957
score: 0

jdialog
type: Tag
tags question: http://stackoverflow.com/q/23722858
tags question: http://stackoverflow.com/q/23674458
tag name: jdialog

http://stackoverflow.com/comment/36370003
type: QuestionComment
type: Comment
has text: Would a class load breakpoint be a good thing here? See Run -> Add Class load breakpoint...
comment on: http://stackoverflow.com/q/23674507
score: 0

http://stackoverflow.com/comment/36418474
score: 0
type: Comment
type: QuestionComment
has text: I though "||" means "OR" and "&&" means "AND". But in my code it behaves exactly the other way around.
comment on: http://stackoverflow.com/q/23700287

http://stackoverflow.com/comment/36387692
type: QuestionComment
has text: Not entirely sure what to show
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23683591

http://stackoverflow.com/comment/36552003
type: QuestionComment
has text: Just an ugly ugly fix in a huge application.
score: 0
comment on: http://stackoverflow.com/q/23762702
type: Comment

http://stackoverflow.com/comment/125548324
type: AnswerComment
type: Comment
score: 1
has text: This makes no sense, why would you use asJson and then toString when there is asString?
comment on: http://stackoverflow.com/a/29038649

http://stackoverflow.com/comment/36285119
type: QuestionComment
comment on: http://stackoverflow.com/q/23630681
has text: Try to print JsonNode.toString() and let me know what it will show you...
score: 0
type: Comment

http://stackoverflow.com/comment/36542272
type: AnswerComment
score: 0
has text: Upvote! True, anyone could make that mistake. Interesting fact about Matlab.
type: Comment
comment on: http://stackoverflow.com/a/23749499

http://stackoverflow.com/a/23673082
has comment: http://stackoverflow.com/comment/36367205
downvote count: 0
has body: It should be a comment but I don't have enough reputation (still): Check the line 104 of Depas_jsp.java. There you can see where exactly the NullPointerException is happening.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23672827

http://stackoverflow.com/a/23719682
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23719655
has body: You should do createProject.setProjectName(input.nextLine()); What you have done is incorrect syntax. It will not even compile.

http://stackoverflow.com/q/23692943
type: Question
has title: toString method is returning random characters
has comment: http://stackoverflow.com/comment/36405853
has answer: http://stackoverflow.com/a/23692985
accepted answer: http://stackoverflow.com/a/23692985
has answer: http://stackoverflow.com/a/23693011
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36405860
tagged with: android
has comment: http://stackoverflow.com/comment/36405863
has body: for some reason when I run my app, instead of getting the name of the lecture, I get a bunch of random characters that show up. I'm not sure why though. Thanks in advance! public Lecture(String lecturename) { this.lecturename = lecturename; listofwork = new ArrayList&lt;Work&gt;(); } public String toString(Lecture lecture) { return lecture.lecturename; } /////////// IN ANOTHER ACTIVITY ///////////////////// Lecture test = new Lecture("TEST"); Toast.makeText(getApplicationContext(), test.toString(), Toast.LENGTH_LONG).show(); And instead of getting a toast saying "TEST", I get whatsmymark.Lecture@41abcf8. I have a feeling its returning the actual lecture object rather than the string. However, I can't find out why cause the code is so simple.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3615721
possible better answer: http://stackoverflow.com/a/23692987
tagged with: java
has answer: http://stackoverflow.com/a/23692987

http://stackoverflow.com/comment/36405919
type: QuestionComment
has text: Yes. Put delimiters in your data. Then, you can actually do proper splitting on it.
score: 0
comment on: http://stackoverflow.com/q/23692887
type: Comment

http://stackoverflow.com/q/23660334
accepted answer: http://stackoverflow.com/a/43931505
downvote count: 0
tagged with: deserialization
favorite count: 0
score: 13
has answer: http://stackoverflow.com/a/43931505
possible better answer: http://stackoverflow.com/a/23665622
has body: Is there any way the set methods of a given class, are used when using Gson's fromJson method? I would like to do this because for every String global variable of the target class a trim is made. Is there any GSON API annotation for this? I am aware that GSON provides the ability to write custom serializers/deserializers but I would like to know if there is another way to achieve this.
upvote count: 13
has answer: http://stackoverflow.com/a/23665622
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
answer count: 2
has title: Is possible to use setters when Gson deserializes a JSON?

http://stackoverflow.com/comment/36534498
type: QuestionComment
comment on: http://stackoverflow.com/q/23760676
score: 0
has text: Try [changing the layout](http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html)
type: Comment

http://stackoverflow.com/comment/36325350
comment on: http://stackoverflow.com/q/23651572
score: 0
type: Comment
has text: is it working fine in other browsers
type: QuestionComment

http://stackoverflow.com/comment/36261172
type: QuestionComment
type: Comment
has text: You have to say how you're reading the file, as a lot of methods like `readLine()` or `nextLine()` strip the newline characters, so if you just searched for it, you'd never find it.
score: 0
comment on: http://stackoverflow.com/q/23618409

http://stackoverflow.com/a/23753436
type: Answer
has comment: http://stackoverflow.com/comment/36520885
answers question: http://stackoverflow.com/q/23753214
has comment: http://stackoverflow.com/comment/36521289
upvote count: 1
has comment: http://stackoverflow.com/comment/36521246
has comment: http://stackoverflow.com/comment/36520629
score: 1
has comment: http://stackoverflow.com/comment/36520942
has comment: http://stackoverflow.com/comment/36521056
has comment: http://stackoverflow.com/comment/36520824
has comment: http://stackoverflow.com/comment/36522663
has body: Eclipse is based on OSGi. OSGi has a notion of "yes, you can see this class but you better don't use it." It's an extension of private classes. The general idea is that code from someone contains public API and it contains classes which are public because the Java compiler requires it but they aren't part of the public API. Examples are classes in the Java runtime which are in the com.sun package. Since only Oracle's version of Java contains them, it would be bad for you to use them. That's why Eclipse developers added the check to their compiler. In your case, the error message seems odd. junit.jar doesn't contain private API. My guess is that you somehow pulled in the wrong JUnit JAR (ie. one which Eclipse thinks is private and only accessible for the IDE). Try to use Built Path--&gt; Add Libraries to add "JUnit" to your project instead of manually adding a JAR. [EDIT] If you use Built Path--&gt; Add Libraries to add the JUnit JAR, then this error shouldn't happen. In fact, it shouldn't be an error in the first place - Access restrictions are warnings. Try to reset your compiler options to the default and try again.
has comment: http://stackoverflow.com/comment/36521240
has comment: http://stackoverflow.com/comment/36520509
downvote count: 0
has comment: http://stackoverflow.com/comment/36522706

http://stackoverflow.com/q/23739945
type: AnsweredQuestion
has body: I was reading through the source code of java.lang.String, specifically getBytes(): public byte[] getBytes(Charset charset) { if (charset == null) throw new NullPointerException(); return StringCoding.encode(charset, value, offset, count); } However, I couldn't find the StringCoding.encode() method in the Java API. I'd like to be able to compare it with java.nio.charset.CharsetEncoder.encode(), since that class/method is referenced as an alternative in the String.getBytes() javadoc. How do I find the StringCoding class, and it's source code? And what is the difference between the respective .encode() methods?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36494418
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36494367
has title: What's the difference between java.lang.String.getBytes() and java.nio.charset.CharsetEncoder.encode()?
has answer: http://stackoverflow.com/a/23740002
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23740002

http://stackoverflow.com/comment/36557982
has text: I am sorry to ask question but how do i do this could you point me to right direction is there any exercises or examples that look at.
type: AnswerComment
comment on: http://stackoverflow.com/a/23772869
score: 0
type: Comment

http://stackoverflow.com/q/23622274
has answer: http://stackoverflow.com/a/23622362
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23622362
tagged with: java
has comment: http://stackoverflow.com/comment/36268782
has title: Java Servlet to Create and Sort a MySQL DB using HTML Form
tagged with: mysql
has comment: http://stackoverflow.com/comment/36268704
type: Question
has body: I have a very beginner question as I'm just learning to work with DBs. I have a very simple HTML form with a textField for a name, an add button to add a name to a MySQL database, and a sort button to sort the names in the database and display them. I almost have it working, however when I hit the "add" or "sort" buttons I get the same messages that appear after a user clicks those buttons along with the sorted list of names. It looks like this when clicking the add button: Please go back and add a name or sort Bill Jones David G Debbie Downer Jane Doe Would someone be able to advise me on what I have to change on my code to make just the list show up by itself when the user clicks sort? I am not a programmer just someone trying to learn. Servlet code: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.*; @WebServlet("/Main") public class Main extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { static final long serialVersionUID = 1L; public Main() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String name = request.getParameter("name"); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager .getConnection("jdbc:mysql://localhost:3306/test?user=root&password=root"); Statement stmt = con.createStatement(); try { //stmt.execute("DROP TABLE simple"); stmt.execute("CREATE TABLE IF NOT EXISTS simple( name char(30))"); } catch (Exception e) { } if (name == "" || name == null) { out.print(" Please enter a name. "); } else if (name != null) { String s = "Insert into simple values(\'" + name + "\')"; stmt.execute(s); out.print(" Please go back and add a name or sort. "); } ResultSet rs = stmt.executeQue…
tagged with: sorting
tagged with: servlets
score: 0
answer count: 1

http://stackoverflow.com/comment/73026068
type: AnswerComment
comment on: http://stackoverflow.com/a/23625115
score: 0
type: Comment
has text: Hi, "factor out the data inserted by insertDataTest in a shared utility". Please explain more on this

http://stackoverflow.com/q/23733141
has comment: http://stackoverflow.com/comment/36481695
score: 0
has comment: http://stackoverflow.com/comment/36481843
has comment: http://stackoverflow.com/comment/36481685
type: UnansweredQuestion
has body: I have read some datas into a readbuf array from serial port. the buffer contains data structure like below: bytes[] readbuf = new byte[2048]; size = mInputStream.read(readbuf); transfer_data_des { for(n;n&lt;lenght;j++) { U16 xxx_index; U32 xxxdataLength; for(m;m&lt;xxxdataLength;m++) { U8 data; //contain hex data } } } The structure contains an int index, indicate what kind of data, and data is a char arrays. the buffer like below, [int]length[char arrays] | [index][length][data] | [index][length][data]|[...] how could I parse it to correct data from the bytes buffer? I am not very specialist in java, please give me some help, I would highly think you very much.
answer count: 0
tagged with: java
has title: Java read data structure from bytes array
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/23752899
tagged with: java
tagged with: broadleaf-commerce
type: Question
has answer: http://stackoverflow.com/a/23991417
score: 0
answer count: 1
has title: Unable to initialize POM pom.xml: Failed to validate POM
type: UnansweredQuestion
has body: while launching jetty-demo I'm facing below error. Could you please help me to resolve it ? My POM - <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany ecommerce-website 1.0 pom ecommerce http://www.blc-archetype.com <blc.version>3.1.2-GA</blc.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> My Company's eCommerce Website public snapshots public snapshots http://nexus.broadleafcommerce.org/nexus/content/repositories/snapshots/ public releases public releases http://nexus.broadleafcommerce.org/nexus/content/repositories/releases/ org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.zeroturnaround jrebel-maven-plugin [1.0,) generate org.apache.maven.plugins maven-antrun-plugin [1.3,) run org.codehaus.mojo build-helper-maven-plugin [1.7,) timestamp-property org.codehaus.mojo keytool-maven-plugin [1.2,) clean genkey </lifecycleMappingMetadata> org.apache.maven.plugins maven-compiler-plugin 2.0.2 1.6 1.6 org.zeroturnaround jrebel-maven-plugin 1.1.3 org.codehaus.mojo build-helper-maven-plugin 1.7 org.apache.maven.plugins maven-surefire-plugin 2.10 org.apache.maven.plugins maven-war-plugin 2.1.1 org.apache.maven.plugins maven-jar-plugin 2.3.2 maven-clean-plugin <excludeDefaultDirectories>true</excludeDefaultDirectories> target **/* com.mycompany core 1.0 jar compile org.broadleafcommerce broadleaf-common ${blc.version} jar compile org.broadleafcommerce broadleaf-profile ${blc.version} jar compile org.broadleafcommerce broadleaf-profile-web ${blc.version} jar compile org.broadleafcommerce broadleaf-framework ${blc.version} jar compile org.broadleafcommerce broadleaf-framework-web ${blc.version} jar compile org.broadleafcommerce broadleaf-admin-module ${blc.version} jar compile org.broadleafcommerce broadleaf-contentmanagement-module ${blc.version} jar compile org.broadleafcommerce broadleaf-open-admin-platform ${blc.version} jar compile org.broadleafcommerce integration ${blc.version} jar tests test org.hsqldb hsqldb 2.3.…
tagged with: maven
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36522067

http://stackoverflow.com/q/23741636
has answer: http://stackoverflow.com/a/23741757
has comment: http://stackoverflow.com/comment/36521294
has comment: http://stackoverflow.com/comment/36497742
downvote count: 0
answer count: 7
tagged with: string
has comment: http://stackoverflow.com/comment/36497506
favorite count: 0
has comment: http://stackoverflow.com/comment/36497758
has comment: http://stackoverflow.com/comment/36497626
has answer: http://stackoverflow.com/a/23741728
has body: I was asked this question today in an interview. Can someone explain me the right answer ? Here is the code. String s1= "hellow"; String s2= "Hellow again"; System.out.println(s1+s2); How many strings are created in the above code ? I think it will be 3.Any suggestions?
has comment: http://stackoverflow.com/comment/36497662
has comment: http://stackoverflow.com/comment/36497552
has comment: http://stackoverflow.com/comment/36521505
possible better answer: http://stackoverflow.com/a/23741954
has answer: http://stackoverflow.com/a/23741954
has answer: http://stackoverflow.com/a/23742379
upvote count: 1
has answer: http://stackoverflow.com/a/23741878
has answer: http://stackoverflow.com/a/23741815
has comment: http://stackoverflow.com/comment/36501149
accepted answer: http://stackoverflow.com/a/23741728
has answer: http://stackoverflow.com/a/23741708
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36497650
has title: Does System.out.println() create a String If we concatenate?
type: Question

http://stackoverflow.com/comment/36460827
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23722004
has text: Simply use box layout in that case. Take time and read more about it.
type: Comment

http://stackoverflow.com/a/72463001
has body: In c# public static string HMACSHA512(this string Key, string TextToHash) { string HmacHashed = ""; if (string.IsNullOrEmpty(Key)) throw new ArgumentNullException("HMACSHA512: Key", "Parameter cannot be empty."); if (string.IsNullOrEmpty(TextToHash)) throw new ArgumentNullException("HMACSHA512: TextToHash", "Parameter cannot be empty."); if (Key.Length % 2 != 0 || Key.Trim().Length < 2) { throw new ArgumentNullException("HMACSHA512: Key", "Parameter cannot be odd or less than 2 characters."); } try { using (var HMACSHA512 = new HMACSHA512(Encoding.ASCII.GetBytes(Key))) { HmacHashed = BitConverter.ToString(HMACSHA512.ComputeHash(Encoding.ASCII.GetBytes(TextToHash))).Replace("-", string.Empty); } return HmacHashed; } catch (Exception ex) { throw new Exception("HMACSHA512: " + ex.Message); } }
score: 0
answers question: http://stackoverflow.com/q/23655462
type: Answer

http://stackoverflow.com/q/23777508
type: Question
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36566252
has comment: http://stackoverflow.com/comment/36566204
tagged with: string
linked to: http://stackoverflow.com/q/1532461
has title: Which one to use- String or StringBuffer in concatenation
has answer: http://stackoverflow.com/a/23777545
duplicate of: http://stackoverflow.com/q/1532461
has comment: http://stackoverflow.com/comment/36566260
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36566361
tagged with: object
has body: I saw the java code in my project which constructs a file name from various parameters.The java code is like this String file = null; String fileDirSeperator = System.getProperty("file.separator"); String pwd = System.getProperty("user.dir"); file = pwd + fileDirSeperator + "properties" + fileDirSeperator + folder_name + file_name; I want to know if I should you StringBuffer instead of String. I know that appending anything to String will create new object so I think I should you StringBuffer. May I know your suggestion? Also, file = pwd + fileDirSeperator + "properties" + fileDirSeperator + folder_name + file_name; in the above file name construction, will 6 objects be created(one for each variable)?
linked to: http://stackoverflow.com/q/47605
has answer: http://stackoverflow.com/a/23777534
tagged with: java
tagged with: stringbuffer
has answer: http://stackoverflow.com/a/23777602

http://stackoverflow.com/comment/36520581
type: QuestionComment
comment on: http://stackoverflow.com/q/23752505
score: 0
has text: Well you must invoke it at some point
type: Comment

http://stackoverflow.com/comment/36409636
comment on: http://stackoverflow.com/q/23695353
has text: @JonSkeet yeah thanks on this one, now it's at least working for correct answers but it still doesn't fix the invalid answer infinite loop state, so to speak.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23652289
type: Question
has comment: http://stackoverflow.com/comment/36327110
has comment: http://stackoverflow.com/comment/36328325
tagged with: jpa
has comment: http://stackoverflow.com/comment/36343957
linked to: http://stackoverflow.com/q/11825643
has title: @GeneratedValue in Oracle with no Sequence
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23653700
has body: I have created a trigger so that my entities ids are autogenerated with a sequence each time they're inserted into my Oracle database. The problem comes with annotating these entities for Hibernate/JPA: I need to define a @GeneratedValue annotation but I don't want to specify the sequence name -- doing that will make Hibernate query the sequence first, then insert, which is a work that is already done by the trigger. Is there any way to skip this sequence in the @GeneratedValue with the scenario I've proposed? Exception I get if id is not provided: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): Pattern Pattern class: @Entity @Table(name = "PATTERN") public class Patron extends HistoricoAbstractEntity { /** * */ private static final long serialVersionUID = 1L; @Id @Column(name = "ID_PATTERN") private Integer idPattern; @Column private String description; @Column(name = "NEGATIVE") private Boolean isNegative; @Column(name = "type") private Integer type; @Column(name = "N_DAYS") private Integer numDays; ... (getters &amp; setters) }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36327020
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/36328675
has comment: http://stackoverflow.com/comment/36327052
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/4262600

http://stackoverflow.com/a/69025976
answers question: http://stackoverflow.com/q/23635957
upvote count: 1
has body: this is a bug in rest assured instead of requestSpec.get(); try: Response response = RestAssured.given(requestSpec).get(); or Response response = RestAssured.given().spec(reqSpec).get(); here is the already filed bug: https://github.com/rest-assured/rest-assured/issues/938
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23629422
has comment: http://stackoverflow.com/comment/36282252
answers question: http://stackoverflow.com/q/23629205
has comment: http://stackoverflow.com/comment/36281971
downvote count: 0
type: Answer
has body: There are frameworks out there to do this you will have to pay if you are not an open source project. http://www.license4j.com https://truelicense.java.net Generally, these can be as complex or a simple as you like. It is easy to create such a framework. The trick is implementing a protection mechanism that isn't easy to fool. Generally you would want to encrypt the 'licence' data in some form to ensure that it couldn't be easily altered.
score: 2
upvote count: 2

http://stackoverflow.com/q/23716402
has body: I use cursor.movetonext to get the selecting result like this: while(cursor.moveToNext()){ int index2=cursor.getColumnIndex(DbHelper.KEY_PASSWORD); String password=cursor.getString(index2); buffer.append(password); } return buffer.toString(); But each time, only one result could be returned. What if there are more than one result meet the selecting condition? How can I get all the result back in my main activity?
has comment: http://stackoverflow.com/comment/36449644
tagged with: java
tagged with: cursor
has comment: http://stackoverflow.com/comment/36449547
type: Question
has title: How to get more than one selecting result by using cursor?
answer count: 1
has answer: http://stackoverflow.com/a/23716814
has comment: http://stackoverflow.com/comment/36449473
score: 0
has comment: http://stackoverflow.com/comment/36449560
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36449697

http://stackoverflow.com/comment/36501015
comment on: http://stackoverflow.com/q/23743098
has text: But I'm kind of thinking that in that last assignment to `and` you should be using bitwise OR instead of bitwise AND.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23623651
has comment: http://stackoverflow.com/comment/36271075
has comment: http://stackoverflow.com/comment/36271523
tagged with: regex
accepted answer: http://stackoverflow.com/a/23625307
has body: I am in need of a regex to do this, to move words with bracket from the start to the end of a string. This is my string array... "{"[foo](foo)(foo)bar","bar","(foo)[foo]bar","[foo]bar(foo)bar"}" and I want to move the words within the brackets and the square brackets in the start, to the end of the string. Something like this... bar[foo](foo)(foo) bar bar(foo)[foo] bar(foo)bar[foo] the order is not necessary, but I only want to move the words within the brackets at the start, as previously stated. The words within the middle brackets can stay in the same location. Can someone please help to do this? Notify me if there are any errors or uncertainty in my question.
has comment: http://stackoverflow.com/comment/36271490
downvote count: 1
type: Question
type: AnsweredQuestion
has title: How to move the the words within the brackets to the end of the string
tagged with: java
has comment: http://stackoverflow.com/comment/36271114
possible better answer: http://stackoverflow.com/a/23625372
score: -1
has answer: http://stackoverflow.com/a/23625372
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23625307
favorite count: 0
has comment: http://stackoverflow.com/comment/36271156

http://stackoverflow.com/comment/36516928
type: Comment
comment on: http://stackoverflow.com/a/23707883
score: 0
has text: now I am fine.. :D . pls check my answer , if you see any wrong settings or errors , pls correct me. Thanks for everythings.
type: AnswerComment

http://stackoverflow.com/comment/36435908
comment on: http://stackoverflow.com/q/23709261
has text: Any particular reason to do so? Any particular number of each you need to fulfill?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36432243
type: Comment
type: QuestionComment
has text: look into jgit : http://www.eclipse.org/jgit/
comment on: http://stackoverflow.com/q/23707267
score: 4

http://stackoverflow.com/q/23777556
tagged with: arrays
tagged with: sorting
linked to: http://stackoverflow.com/q/16585507
favorite count: 0
answer count: 3
has title: Find greatest of two arrays, storing result in a third array
has answer: http://stackoverflow.com/a/23778184
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/23778021
score: -4
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23778244
accepted answer: http://stackoverflow.com/a/23778244
has body: How do I sort into two arrays and storing in another array in java? public class SortingDemo { public static void main(String[] args) { int[] num1 = new int[ ] {5,6,2,8}; int [] num2 = new int[] {1,4,10,7}; merge(num1, num2); } public static int[] merge(int [] num1,int [] num2) { int num1_size = num1.length; int num2_size = num2.length; for (int i = 0; i &lt; num1.length; i++) { // System.out.println(num1[i]); for (int j = 0; j &lt; num2.length; j++) { if (num1[i] &gt; num2[j]) { } } } } }
possible better answer: http://stackoverflow.com/a/23778021

http://stackoverflow.com/a/47209027
answers question: http://stackoverflow.com/q/23627476
accepted answer of: http://stackoverflow.com/q/23627476
has body: java.lang.Long might fit well here, however I think this is an issue in the mssql driver.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23647765
score: 0
has title: How to create a jar file for a web application using Netbeans IDE 8.0
linked to: http://stackoverflow.com/q/5871053
has comment: http://stackoverflow.com/comment/36318335
has body: I did a Web Application using Netbeans IDE 8.0 in JAVA platform. The project consists of JSP's, Servlets and normal .java files. I would like to deploy the project as a simple jar file to the client so that they can execute the jar file and use the application. I am trying to generate jar file using Netbeans with the given resources but there were no proper resources for this. When I tried one of the sources provided, a war file is created rather than a jar file. So, please help me in converting my web application into a jar file. Also, please let me know why a war file is created for my application rather than a jar file. Also, let me know how to execute war file.
linked to: http://stackoverflow.com/q/13301882
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36318361
tagged with: java
has answer: http://stackoverflow.com/a/23648021
type: Question
has comment: http://stackoverflow.com/comment/36318238
answer count: 1
tagged with: jar
tagged with: jsp

http://stackoverflow.com/comment/36263426
type: QuestionComment
comment on: http://stackoverflow.com/q/23619508
score: 0
has text: Try this: http://stackoverflow.com/questions/1944468/what-version-of-java-is-running-in-eclipse
type: Comment

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/23778134
type: Tag

http://stackoverflow.com/q/23719266
answer count: 1
linked to: http://stackoverflow.com/q/13119582
has comment: http://stackoverflow.com/comment/36455115
score: 0
has comment: http://stackoverflow.com/comment/36455265
tagged with: android
has comment: http://stackoverflow.com/comment/36455203
has comment: http://stackoverflow.com/comment/36455250
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23719504
tagged with: bitmap
tagged with: java
type: Question
has body: I'm trying to rotate a given bitmap by X degrees in order to send it to my server rotated. I'm using android API8 using this code: private static void rotateBitmap(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); } It works on Nexus 5, but on Galaxy Note2 I get the following error: 05-18 09:06:42.696: E/AndroidRuntime(6044): java.lang.OutOfMemoryError 05-18 09:06:42.696: E/AndroidRuntime(6044): at android.graphics.Bitmap.nativeCreate(Native Method) 05-18 09:06:42.696: E/AndroidRuntime(6044): at android.graphics.Bitmap.createBitmap(Bitmap.java:726) 05-18 09:06:42.696: E/AndroidRuntime(6044): at android.graphics.Bitmap.createBitmap(Bitmap.java:703) 05-18 09:06:42.696: E/AndroidRuntime(6044): at android.graphics.Bitmap.createBitmap(Bitmap.java:636) Than I have read some posts in SOF and changed to the following code: private static void rotateBitmap(Bitmap source, float angle) { Canvas canvas = new Canvas(source); Matrix matrix2 = new Matrix(); matrix2.setRotate(angle, source.getWidth() / 2, source.getHeight() / 2); canvas.drawBitmap(source, matrix2, new Paint()); } but then I have gotten the following error: Immutable bitmap passed to Canvas constructor Update Then I have tried this code: private static void rotateBitmap(Bitmap source, float angle) { // Matrix matrix = new Matrix(); // matrix.postRotate(angle); // return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, // true); // Bitmap workingBitmap = Bitmap.createBitmap(source); Bitmap mutableBitmap = source.copy(Bitmap.Config.ARGB_8888, true); source.recycle(); // Canvas canvas = new Canvas(mutableBitmap); Canvas canvas = new Canvas(); // Canvas canvas = new Canvas(source); Matrix matrix2 = new Matrix(); matrix2.setRotate(angle, mutableBitmap.getWidth() / 2, mutableBitmap.getHeight() / 2); canvas.drawBitmap(mutableBitmap, matrix2, new Paint()); } and g…
has comment: http://stackoverflow.com/comment/36455133
tagged with: layout
has title: java.lang.OutOfMemoryError when rotating a bitmap

http://stackoverflow.com/a/23743247
score: -2
upvote count: 0
has comment: http://stackoverflow.com/comment/36500919
has body: you can resize any image by the following code. $thumb = new Imagick(); $thumb-&gt;readImage('myimage.gif'); $thumb-&gt;resizeImage(320,240,Imagick::FILTER_LANCZOS,1); $thumb-&gt;writeImage('mythumb.gif'); $thumb-&gt;clear(); $thumb-&gt;destroy(); For more information please go to the following link. resize image resize optimized image
type: Answer
has comment: http://stackoverflow.com/comment/36502452
answers question: http://stackoverflow.com/q/23742790
downvote count: 2

http://stackoverflow.com/a/32937848
upvote count: 1
has body: There's no "try-with-resource" template included in Eclipse. There is an open issue for it: Bug 351864 - [1.7][templates] Add 'try-with-resource' template
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23698534
type: Answer
accepted answer of: http://stackoverflow.com/q/23698534

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/23761963

http://stackoverflow.com/comment/36271577
type: Comment
comment on: http://stackoverflow.com/a/23623831
type: AnswerComment
score: 0
has text: How does `commit` affects a `select` here?

http://stackoverflow.com/q/23623577
type: Question
tagged with: jtable
tagged with: jcheckbox
answer count: 1
linked to: http://stackoverflow.com/q/23602711
accepted answer: http://stackoverflow.com/a/23630925
has title: Can you combine a CheckBox and string in one cell in JTable?
linked to: http://stackoverflow.com/q/2833482
linked to: http://stackoverflow.com/q/21744672
tagged with: jlabel
score: 0
tagged with: swing
type: AnsweredQuestion
has body: I'm wondering if it is possible to put a CheckBox and string in one cell. The string would be used to track how long the checkbox was checked for. I'd like the cell to be laid out like the ColorRenderer cell in this example. The problem is I can't find a method to set the checkbox on the JLabel.
has comment: http://stackoverflow.com/comment/36271415
tagged with: java
has answer: http://stackoverflow.com/a/23630925

http://stackoverflow.com/q/23765317
upvote count: 0
has comment: http://stackoverflow.com/comment/36543716
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23765991
downvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/23765383
has comment: http://stackoverflow.com/comment/36543038
favorite count: 0
has answer: http://stackoverflow.com/a/23768595
has body: I want to have user input in a program I am creating is there any way in a jframe in java to have a place a user can type things into.
tagged with: jframe
type: UnansweredQuestion
score: -3
has title: How can I add a place to type user input in a jframe?

http://stackoverflow.com/comment/36371878
score: 0
type: Comment
type: QuestionComment
has text: oops, I edited, plz check
comment on: http://stackoverflow.com/q/23670842

http://stackoverflow.com/a/23637083
answers question: http://stackoverflow.com/q/23632771
score: 0
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23632771
has body: I made a Implementation of CallableProcessingInterceptor and added it in the spring config xml like this. The interceptor is called just before and after running the callback. &lt;mvc:annotation-driven&gt; &lt;mvc:async-support default-timeout="15000"&gt; &lt;mvc:callable-interceptors&gt; &lt;!-- Required to ensure the http request and responsive are available --&gt; &lt;bean class="bla.ServletContextHolderAsyncInterceptor" /&gt; &lt;/mvc:callable-interceptors&gt; &lt;/mvc:async-support&gt; &lt;/mvc:annotation-driven&gt; It will then fill and empty my ThreadLocal that is also filled through a Http Filter in case of sync execution. Spring does something similar through a fixed interceptor to fill it's RequestContextHolder class. It's also used in Spring for Hibernate usage: open/close hibernate session usage instead of using the OpenEntityManagerInViewFilter in sync mode. A post on SO about that: LINKE

http://stackoverflow.com/q/23627341
upvote count: 2
has comment: http://stackoverflow.com/comment/36278014
has answer: http://stackoverflow.com/a/23627446
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36278319
type: Question
has body: I’m trying to run a simple class that’s making use of a class located in a separate sub folder. It’s compiling fine, however, an exception occurs when being run. lol.java: public class lol { public static void main(String Args[]) { test(); } public static Input test() { Input asdf = new Input(); return asdf; } } Input.java: public class Input { public int x; } I compiled with the command: javac lol.java HOME/input.java Folder structure after compiling: Test | |---lol.java |---lol.class |---HOME | |---Input.java |---Input.class Which compiles without errors; However, I’m not sure how to run it afterwards. I tried running it with: java lol But now the “Input” class can’t be found because it’s in a separate folder and thus result in the following exception: java.lang.NoClassDefFoundError: Input at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: Input at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more Exception in thread "main" How would I go about running it while keeping this folder structure?
downvote count: 0
accepted answer: http://stackoverflow.com/a/23627446
has title: Using class file in a different directory
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36411684
score: 1
has text: You have PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras); Go through the array and compare the necessary name with each PrintService's name till required one is found
type: AnswerComment
comment on: http://stackoverflow.com/a/23696144
type: Comment

http://stackoverflow.com/comment/99130490
score: 0
type: Comment
has text: Can you please tell the spring-context maven version used to import ThreadPoolTaskExecutor and AsyncConfigurerSupport
type: AnswerComment
comment on: http://stackoverflow.com/a/33337838

com4j
tags question: http://stackoverflow.com/q/23762908
tags question: http://stackoverflow.com/q/23660921
tag name: com4j
type: Tag

http://stackoverflow.com/a/23698348
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23697622
type: Answer
answers question: http://stackoverflow.com/q/23697622
has body: You're skipping over mocking what retrievePendingTasks returns and directly mocking what the thing returned by that method does. If you change the code to when(station1.retrievePendingTasks()).thenReturn(new HashSet()); or something similar, then the size of the returned set will take care of itself. If all you need is the size then you could make a mock implementation of the Set. Or you could use the deep stubs approach in skegg99's answer. Interestingly there's a caveat in the API documentation: WARNING: This feature should rarely be required for regular clean code! Leave it for legacy code. Mocking a mock to return a mock, to return a mock, (...), to return something meaningful hints at violation of Law of Demeter or mocking a value object (a well known anti-pattern). Mocking things that don't have dependencies, especially things like Java collections that are common building blocks, is usually unnecessary and will make your tests fragile. For instance here, if you change the code to determine the size some other way then your tests will break. if the code under test changes to use an iterator and doesn't test size directly then your test breaks. Or if there are other consequences of having an empty set then you'll have to mock those separately and end up doing a lot more work, and again risk breakage if the implementation changes. I try not to mock unnecessarily.
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/36415351
has comment: http://stackoverflow.com/comment/36415426
upvote count: 2

http://stackoverflow.com/a/23735727
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23735509
accepted answer of: http://stackoverflow.com/q/23735509
score: 3
has comment: http://stackoverflow.com/comment/36487089
has body: Make connection first and than execute statement in constructor DBConnection. String url = "jdbc:" + jdbcServerType + "://" + dbserver + ":" + serverPort + "//" + database; conn = DriverManager.getConnection(url, userName, password); //I guess create is Object of Statement Statement create= conn.createStatement(); create.execute("CREATE SCHEMA IF NOT EXISTS " +database);

http://stackoverflow.com/comment/36431313
type: QuestionComment
score: 1
has text: Then check out your prime method because it's a bit strange, and won't work, even if you do get the for loop going.
comment on: http://stackoverflow.com/q/23706745
type: Comment

http://stackoverflow.com/comment/36268299
score: 0
type: Comment
type: QuestionComment
has text: It's some sort of nonsense, if you think that an interface is already an abstraction.
comment on: http://stackoverflow.com/q/23622054

http://stackoverflow.com/comment/36402894
score: 0
has text: tl;dr you (generally) can't directly add/remove things from a collection while iterating over it
comment on: http://stackoverflow.com/q/23691326
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36369933
comment on: http://stackoverflow.com/q/23674458
type: Comment
type: QuestionComment
score: 4
has text: You are not passing any parent `Window` to `JDialog’s` constructor so it can’t know which parent to block. It should hit your eye as you have made the `//super(parent, modal);` comment in the constructor…

http://stackoverflow.com/comment/36387201
comment on: http://stackoverflow.com/q/23680020
score: 0
has text: You shouldn't need a listener, just keep a reference to the button that launched the MediaPlayer and change it back when you stop the audio.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23684444
has answer: http://stackoverflow.com/a/23684878
tagged with: nosql
accepted answer: http://stackoverflow.com/a/23684878
score: 0
tagged with: java
answer count: 1
type: AnsweredQuestion
tagged with: google-cloud-datastore
has title: Want to access Google Cloud Datastore with embedded credentials
has body: I have a Java Application that I want to store User Data for in Google Cloud Datastore. The steps given in the Getting Started tutorial mention adding the credentials to the Environment, but that doesn't seem like a good solution for end users. What I would like to be able to do is generate a connection to the database from a set of embedded credentials (a file or set of strings). That way I could manage the credentials under the hood while the user just keeps using the application as normal. Is there a way to create a DatastoreService object and pass it credentials manually instead of using the .getCredentialsFromEnv() method?
type: Question

http://stackoverflow.com/a/30385338
has comment: http://stackoverflow.com/comment/48859945
type: Answer
has body: Actually the above option will not work sometimes. At run time it might not find the class YourProgram :( Strange but true! In that case just drop common-io-xx.jar under your ...\Java\jdk1\jre\lib\ext Ofcourse that will work :) Only wasted a few hours to get to that conclusion!
answers question: http://stackoverflow.com/q/23700091
score: 0

http://stackoverflow.com/q/23751744
tagged with: unit-testing
type: Question
tagged with: ant
has title: How to log all Assert statements into Junit report
upvote count: 2
answer count: 1
tagged with: junit
downvote count: 0
has body: i have a class in which i have 6 Test(using @Test annotations). Each test has some set of Assert statements. I have got a Junit html report using ANT. But this report only shows the status of the 6 tests(pass or fail). i want that when i click on any of the Test, it should show the status of the Assertions which were inside that test. I don't know how to log those assertions or how to modify the default HTML report.
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23766505
tagged with: java

http://stackoverflow.com/comment/36520675
comment on: http://stackoverflow.com/a/23753603
score: 0
type: AnswerComment
has text: You can't round doubles to exact decimal places, and he doesn't have doubles, he has BigDecimals.
type: Comment

http://stackoverflow.com/comment/36557406
score: 2
type: Comment
type: QuestionComment
has text: You have to extend "a" View. The methods are protected so the only way of using them is extending the View.
comment on: http://stackoverflow.com/q/23772477

http://stackoverflow.com/comment/36469578
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23726523
score: 0
has text: I'm asking the classloader because according to the information I read not using it might cause portability problems in certain OS's. Is C:\file.xml not a valid resource name? what would be a correct resource name then?

http://stackoverflow.com/comment/36313616
has text: Yes, the documentation for `Collections.sort()` says: "All elements in the list must implement the Comparable interface." The documentation for `Collections.reverseOrder()` makes a similar restriction: "a comparator that imposes the reverse of the natural ordering on a collection of objects that implement the Comparable interface. (The natural ordering is the ordering imposed by the objects' own compareTo method.)"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23645406
type: AnswerComment

http://stackoverflow.com/a/59582149
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23777359
answers question: http://stackoverflow.com/q/23777359
score: 4
type: AcceptedAnswer
downvote count: 0
has body: Vaadin 13+ In Vaadin Flow versions 13 and later, use Button::addClickShortcut. The method in defined in the interface com.vaadin.flow.component.ClickNotifier. This addClickShortcut method replaces the setClickShortcut (add vs set) in Vaadin 7 &amp; 8 as seen in other correct Answer. Button login = new Button("Login"); login.addClickListener(click -&gt; { //do your things here }); login.addClickShortcut(Key.ENTER); // Bind keyboard shortcut. This code binds your ENTER key to the event listener.

http://stackoverflow.com/comment/36313417
score: 0
type: Comment
has text: I tried this but not working.
comment on: http://stackoverflow.com/a/23633683
type: AnswerComment

http://stackoverflow.com/comment/36493440
type: AnswerComment
has text: Note that removing one of them won't solve the problem because of `IOException`.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23739407

http://stackoverflow.com/comment/36335028
score: 0
comment on: http://stackoverflow.com/q/23655552
type: Comment
type: QuestionComment
has text: Ende Neu which version of IDEA are you using?

http://stackoverflow.com/comment/36517004
type: AnswerComment
type: Comment
has text: actually that string comes from mysql database as datetime data type: rs.getDate("column"); can u please tell me how to handle?
score: 0
comment on: http://stackoverflow.com/a/23751350

http://stackoverflow.com/comment/36437203
type: QuestionComment
has text: Solved the problem :)
score: 0
comment on: http://stackoverflow.com/q/23702496
type: Comment

http://stackoverflow.com/comment/36477209
type: Comment
has text: I tried that and it did the exact same thing. I changed runShell to take a String array and called runShell(new String[]{"/usr/local/bin/cordova", "-v"}) and it didn't return anything still
comment on: http://stackoverflow.com/a/23730459
type: AnswerComment
score: 0

http://stackoverflow.com/q/23751759
downvote count: 0
type: UnansweredQuestion
score: 6
has title: Set only maximum height for a panel (without using setMaximumSize) with GroupLayout
tagged with: swing
tagged with: java
tagged with: grouplayout
has body: I looked around at all the other answers, but they all recommend to use GroupLayout, BoxLayout, or to wrap the panel that's using GridBagLayout with another panel that uses one of the layouts mentioned above. I'm currently using GridBagLayout, and I'm wondering if there's a way to set the maximum height of a panel. I don't want a limit on width, only height, so setMaximumSize(Dimension) won't work. Does GridBagLayout support this in any way? Sorry if my question doesn't contain any code, the only attempt I could possibly find is setMaximumSize(Dimension), or wrapping it in another panel (which I'm hoping to avoid)
type: Question
tagged with: gridbaglayout
answer count: 2
has answer: http://stackoverflow.com/a/23751875
upvote count: 6
has answer: http://stackoverflow.com/a/23752112
favorite count: 0
has comment: http://stackoverflow.com/comment/36517051

http://stackoverflow.com/comment/36394937
comment on: http://stackoverflow.com/a/23687336
has text: I typed it correctly. I just did it again, both times I selected it from the list the Eclipse provides.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23653680
has comment: http://stackoverflow.com/comment/36329526
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/40690874
favorite count: 0
has comment: http://stackoverflow.com/comment/36330558
type: Question
answer count: 2
upvote count: 6
has comment: http://stackoverflow.com/comment/36332274
has body: I am trying to insert a Employee entity into the database. I am using JPA and the database is mysql. When I try to insert the entity, it gives me test.employee does not exist. I assume that I dont have to create the table. Entity will automatically create the table with the annotated name. Please find the exception and code below. Exception in thread "main" javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.employee' doesn't exist Error Code: 1146 Call: INSERT INTO employee (FIRST_NAME, LAST_NAME) VALUES (?, ?) bind => [abc,def] Query: InsertObjectQuery(com.example.entities.Employee@ee1ede) at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:157) at com.example.dao.BaseDao.commitAndClose(BaseDao.java:41) at com.example..dao.BaseDao.persist(BaseDao.java:29) at com.example..dao.EmployeeDao.createEmployee(EmployeeDao.java:29) at com.example.Main.main(KITMain.java:27) Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.employee' doesn't exist Error Code: 1146 Call: INSERT INTO employee (FIRST_NAME, LAST_NAME) VALUES (?, ?) bind => [ram, mohan] Query: InsertObjectQuerycom.example.entities.Employee@ee1ede) at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:962) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseA…
linked to: http://stackoverflow.com/q/18622716
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: jpa mysql table does not exists
accepted answer: http://stackoverflow.com/a/23656058
score: 6
has answer: http://stackoverflow.com/a/40690874
has comment: http://stackoverflow.com/comment/36333635
has comment: http://stackoverflow.com/comment/36329633
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23656058

http://stackoverflow.com/q/23619394
tagged with: maven-shade-plugin
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36264121
linked to: http://stackoverflow.com/q/2271926
tagged with: maven
has title: Cant load resources in Maven shade uber jar
tagged with: java
has body: I need to be able to create an executable jar for my project where everything is packaged in the one jar. I think that the Maven shade build plugin is the best way to do this however I'm experiencing some problems loading my resources when running the created uber jar version. To explain this a little futher, when trying to load my resources I experience a NullPointerException because the resource cannot be located. On inspection inside the created jar the resources are located in the root so I cannot figure out why it cannot locate them. To clarify my problem I've created this small example, which prints the contents of a file. The structure is as follows: Debug |-- pom.xml `-- src |-- main | `-- java | `-- Main.java |-- resources `- tmp.txt And the actual content of the files are: Main.java: import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws IOException, URISyntaxException { URL url = Thread.currentThread().getContextClassLoader().getResource("./tmp.txt"); Path path = Paths.get(url.toURI()); String str = new String(Files.readAllBytes(path)); System.out.println(str); } } tmp.txt: Hello World! pom.xml: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 debug debug 1.0-SNAPSHOT org.codehaus.mojo exec-maven-plugin 1.2.1 exec java -cp <classpath/> Main org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 org.apache.maven.plugins maven-shade-plugin 2.3 package shade Main If you run this on the command line via mvn exec:exec everything works fine and the expected result of Hello World! is output. However running mvn package followed by java -jar target/debug-1.0-SNAPSHOT.jar leads to the following error: Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:12) I'd be very grateful if someone could point me in the right direction or tell me how to change my small e…
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36263682
downvote count: 0
tagged with: jar
score: 4

http://stackoverflow.com/comment/36622612
type: AnswerComment
has text: Though after an exchange with Dhanji from Guice team I realized the best way to achieve this is to use modules and then locate them on the classpath to auto create an injector. Works best.
type: Comment
comment on: http://stackoverflow.com/a/23620842
score: 0

jconnect
type: Tag
tags question: http://stackoverflow.com/q/23628217
tag name: jconnect

http://stackoverflow.com/comment/36301278
has text: You want `substring(i+1)`, no?
type: AnswerComment
comment on: http://stackoverflow.com/a/23639071
score: 0
type: Comment

http://stackoverflow.com/q/23640579
tagged with: swing
type: Question
tagged with: graphics
has body: I want to make smth like window - I have completely transparent JFrame and JPanel and move window after a mouse, but it doesn't refresh panel - soon window becomes completely red. Here's my code: public class Main { public static HolePanel panel = new HolePanel(); public static JFrame frame = new JFrame(); public static void main(String[] args) { JFrame frame = new JFrame(); JFrame.setDefaultLookAndFeelDecorated(true); frame.setUndecorated(true); frame.setBackground(new Color(0, 0, 0, 0)); frame.setAlwaysOnTop(true); frame.setBounds(0, 0, (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(), (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()); frame.setContentPane(panel); frame.addMouseMotionListener(new MouseList()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } public class HolePanel extends JPanel { public double centerX = 200; public double centerY = 200; public double diameter = 300; HolePanel(){ setBackground(new Color(0, 0, 0, 0)); repaint(); } public void paintComponent(Graphics badG){ super.paintComponent(badG); Graphics2D g = (Graphics2D)badG; g.setColor(Color.RED.darker().darker()); Area a = new Area (new Rectangle2D.Double(0, 0, (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(), (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight())); a.subtract(new Area(new Ellipse2D.Double(centerX - diameter / 2, centerY - diameter / 2, diameter,diameter))); g.fill(a); } } public class MouseList implements MouseMotionListener { public void mouseDragged(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { Main.panel.centerX = e.getXOnScreen(); Main.panel.centerY = e.getYOnScreen(); Main.panel.repaint(); } } Could you guys help me someway?
score: 0
tagged with: graphics2d
has title: Refreshing fully transparent JFrame
answer count: 1
has answer: http://stackoverflow.com/a/23641540
accepted answer: http://stackoverflow.com/a/23641540
type: AnsweredQuestion
tagged with: java
tagged with: transparent

http://stackoverflow.com/comment/36395575
type: Comment
has text: look at this:http://stackoverflow.com/questions/7344497/android-canvas-draw-rectangle
comment on: http://stackoverflow.com/q/23687630
score: 0
type: QuestionComment

http://stackoverflow.com/q/23622024
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36268274
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23622110
tagged with: tomcat
tagged with: glassfish
has answer: http://stackoverflow.com/a/23635005
has comment: http://stackoverflow.com/comment/36268247
has title: Deployment of a J2EE web app
has comment: http://stackoverflow.com/comment/36296133
has body: Is there a way to deploy apps without deploying it as a war file? At the moment I am repackaging and redeploying the war after every change. Is there a way to host it like IIS so changes can be done to an individual file without having to repackage and redeploy. Im using glassfish at the moment
has answer: http://stackoverflow.com/a/23622080
answer count: 4
score: 0
possible better answer: http://stackoverflow.com/a/23622058
has answer: http://stackoverflow.com/a/23622058
has answer: http://stackoverflow.com/a/23622110
tagged with: jakarta-ee

http://stackoverflow.com/comment/36357684
score: 1
type: AnswerComment
type: Comment
has text: @Dojo_user Take a look at [How to Use GridLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/grid.html) for examples
comment on: http://stackoverflow.com/a/23667868

http://stackoverflow.com/q/23683398
upvote count: 6
has comment: http://stackoverflow.com/comment/36435768
type: AnsweredQuestion
tagged with: dnssec
has comment: http://stackoverflow.com/comment/36392323
tagged with: java
tagged with: ssl
type: Question
has comment: http://stackoverflow.com/comment/36402538
has answer: http://stackoverflow.com/a/32135091
downvote count: 0
has body: How can I write a X509TrustManager in Java that used DANE (DNS-based Authentication of Named Entities)? Are there any samples or a library? Or has Java build in support for DANE?
has title: How to use DANE with Java?
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/32135091
tagged with: dane
score: 6
tagged with: dns

http://stackoverflow.com/comment/36436917
has text: Thanks everyone. I thought as much but it was worth a check.
type: QuestionComment
comment on: http://stackoverflow.com/q/23708726
score: 0
type: Comment

http://stackoverflow.com/comment/36348763
has text: @user3549340 Is the following what you mean? You change the content of the second combo, after that a event is triggered by the second combo, because its selection / content has changed. You want to avoid this one? right?
type: Comment
comment on: http://stackoverflow.com/a/23663044
score: 0
type: AnswerComment

http://stackoverflow.com/a/23737747
has comment: http://stackoverflow.com/comment/36490478
has comment: http://stackoverflow.com/comment/36491160
answers question: http://stackoverflow.com/q/23737638
accepted answer of: http://stackoverflow.com/q/23737638
type: AcceptedAnswer
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/36490372
type: Answer
has body: use quizList.add(qz[i]); instead of quizList.set(i, qz[i]); Your List is empty at the point where you want to set an Object to a specific position. documentation of set: IndexOutOfBoundsException - if the index is out of range (index &lt; 0 || index >= size()) to your update: you removed the line quizList = new ArrayList&lt;Integer&gt;(5);. It initializes your list. You need to ceep this line in place, otherwise there is no list you can add your objects to. A NullPointerException always means an Objects was not created wile you want to read from/write to it.
has comment: http://stackoverflow.com/comment/36491593
score: 3

http://stackoverflow.com/comment/36563625
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23776059
type: AnswerComment
has text: I done that..but I don't want in String Object...I want in Date Object with same format

http://stackoverflow.com/comment/36360574
type: Comment
comment on: http://stackoverflow.com/q/23669358
score: 0
type: QuestionComment
has text: @SuperUser still I would go with a framework. What srarts as a small project can grow into a big project over time and investing a bit of time into right approach from the beginning will pay off big time.

http://stackoverflow.com/q/23628204
has body: I have use a browser that is DJ enabled Browser of Swing. I have jars for the Windows and Linux that is swt.jars and but which jar will I need to run same program for the MAC OS using Java?
type: Question
has comment: http://stackoverflow.com/comment/36297852
answer count: 2
tagged with: djnativeswing
has title: DJ Native Swing Browser for Java
score: 0
possible better answer: http://stackoverflow.com/a/24278543
has answer: http://stackoverflow.com/a/23831215
has comment: http://stackoverflow.com/comment/36314157
has answer: http://stackoverflow.com/a/24278543
tagged with: macos
has comment: http://stackoverflow.com/comment/36287437
accepted answer: http://stackoverflow.com/a/23831215
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36283743

http://stackoverflow.com/q/23764018
accepted answer: http://stackoverflow.com/a/23764921
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23764921
has comment: http://stackoverflow.com/comment/36540821
tagged with: android-seekbar
type: Question
tagged with: java
has title: Set a progress from a SeekBar
score: 0
answer count: 1
has body: I have this seekbar and this TextView in which I want to show the actual progress of the seekbar. The actual XML for the textview: &lt;SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/seekBar1" android:layout_below="@+id/dimension_text"/&gt; &lt;TextView android:layout_width="50dp" android:layout_height="50dp" android:text="@string/num_dimension" //where num_dimension is a number android:id="@+id/textViewProgress"/&gt; And the actual Java: public class MainActivity extends ActionBarActivity { int p=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView t1=(TextView) findViewById(R.id.test); final SeekBar sk=(SeekBar) findViewById(R.id.seekBar1); final TextView textProgress = (TextView)findViewById(R.id.textViewProgress); sk.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub if(p&lt;12) { p=12; sk.setProgress(p); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { // TODO Auto-generated method stub p=progress; t1.setTextSize(p); textProgress.setText(p); //this is the line that should do the work } }); Whenever I tap on the seekbar my app is force-closed. So I'm a little bit confused with this, what am I doing wrong? This is the logcat: 05-20 17:59:04.141 29872-29872/com.myapplication2.app D/dalvikvm﹕ GC_FOR_ALLOC freed 424K, 14% free 10583K/12268K, paused 23ms, total 23ms 05-20 17:59:04.171 29872-29872/com.myapplication2.app I/Xposed﹕ [IconThemer/Mod] [nexbit.moonshine.icons] Loading replacements for package com.myapplication2.app 05-20 17:59:04.251 29872-29872/com.myapplication2.app D/dalvikvm﹕ GC_FOR_ALLOC freed 274K, 13% free 10804K/12348K, paused 19ms, total 19ms 05-…

http://stackoverflow.com/comment/36331504
type: QuestionComment
type: Comment
has text: I assume all your existing java projects still work?
score: 0
comment on: http://stackoverflow.com/q/23654765

http://stackoverflow.com/comment/36503845
has text: Did you also override getHashCode()? You have to do it all the time you override equals().
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23744865

http://stackoverflow.com/q/23672725
tagged with: linked-list
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36366584
has body: In a linked list when there's only one Node situation and I try to remove it using reoveFromHead(); I get a nullpointer at the toString() method. public void removeFromHead(){ if(head==null) return; else{ head=head.next; } } public String toString() { String result = " "; ListNode a=head; while (a.next!=null){ result +=" "+a.item; a=a.next; } result+=" "+a.item; return result; } Can someone please point out where the mistake is?
type: Question
has answer: http://stackoverflow.com/a/23672820
has answer: http://stackoverflow.com/a/23672783
tagged with: data-structures
answer count: 3
score: 2
downvote count: 0
has title: Linked list removing from head
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23672776

http://stackoverflow.com/comment/104156384
has text: Cloning the request attributes solve the problem for me.
comment on: http://stackoverflow.com/a/57368912
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36567502
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23777891
has text: import org.apache.openjpa.jdbc.sql.Raw; for return type of method and import oracle.jdbc.OracleTypes; for oracle types in registeroutparameter. problem is this second part
score: 0